没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:鲍佳佳|2021-08-26 11:07:32.817|阅读 141 次
概述:TX Text Control Server for ASP.NET (incl. WPF)是企业级的服务器端文字处理控件。它为ASP.NET服务器环境提供了一个完整的文本处理引擎,并且包含一个WPF客户端版本。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
TX Text Control Server for ASP.NET (incl. WPF)是企业级的服务器端文字处理控件。它为ASP.NET服务器环境提供了一个完整的文本处理引擎,并且包含一个WPF客户端版本。
点击下载TX Text Control Server for ASP.NET (incl. WPF)最新试用版
MailMerge 是一个强大的、可扩展的框架,允许您将自定义逻辑注入合并过程。
TXTextControl.DocumentServer.MailMerge.FieldMerged事件可用于处理结果,但也可以访问TXTextControl.TableCell类的已实例。这使您根据特定的过滤器指令来可以实现条件表单元格颜色之类的功能。
在此示例中,如果数量大于 10,则表单元格“数量”应突出显示为红色,否则应为红色。
该示例显示了两个有趣的方面:
该示例实现HTML表单元素以设置表单元格的条件。如果输入位置在表格单元格内部,则以下代码用于通过将对象序列化为Json字符串将条件存储在表格单元格中:
// stores the selected conditions in the cell name function setTableCellConditions(empty = false) { TXTextControl.tables.getItem(function (table) { if (table === null) return; // no table // create a cellFilterInstructions object var cellFilterInstructions = { compareValue: document.getElementById("compareValue").value, operator: document.getElementById("operator").value, trueColor: document.getElementById("trueColor").value, falseColor: document.getElementById("falseColor").value } table.cells.getItemAtInputPosition(function (cell) { if (cell === null) return; // no cell if (empty === true) cell.setName(""); // delete instructions else // sel instructions to cell name cell.setName(JSON.stringify(cellFilterInstructions)); }); }) }
如果将输入位置更改为另一个单元格,则会更新表单元素以反映该单元格的条件:
// check cell status on input position changes TXTextControl.addEventListener("inputPositionChanged", function () { TXTextControl.tables.getItem(function (table) { // table at input pos? if (table === null) { // return if no table available EnableFormElements( ["operator", "compareValue", "trueColor", "falseColor", "enableCondition"], false); return; } // enable form elements EnableFormElements( ["operator", "compareValue", "trueColor", "falseColor", "enableCondition"], true); table.cells.getItemAtInputPosition(function (cell) { // cell at input pos if (cell == null) { // return if more cells are selected enableCellConditions(false); document.getElementById("enableCondition").setAttribute( "disabled", "disabled"); return; } // check the cell name that stores the conditions cell.getName(function (cellName) { if (cellName === "") { enableCellConditions(false); return; } updateSettings(JSON.parse(cellName)); }); }); }) });
最后,当单击合并时,将保存文档并将其发送到后端控制器:
function mergeDocument() { TXTextControl.saveDocument(TXTextControl.streamType.InternalUnicodeFormat, function (e) { var serviceURL = "/Home/MergeDocument"; $.ajax({ type: "POST", url: serviceURL, contentType: 'application/json', data: JSON.stringify({ Document: e.data, }), success: successFunc, error: errorFunc }); function successFunc(data, status) { TXTextControl.loadDocument(TXTextControl.streamType.InternalUnicodeFormat, data); } function errorFunc(error) { console.log(error); } }); }
在控制器中,HttpPost方法接受文档并调用MergeJsonData方法以将数据合并到给定的模板中:
[HttpPost] public string MergeDocument(string Document) { using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { tx.Create(); tx.Load(Convert.FromBase64String(Document), TXTextControl.BinaryStreamType.InternalUnicodeFormat); using (TXTextControl.DocumentServer.MailMerge mailMerge = new TXTextControl.DocumentServer.MailMerge()) { mailMerge.TextComponent = tx; mailMerge.FieldMerged += MailMerge_FieldMerged; string data = System.IO.File.ReadAllText(Server.MapPath("~/App_Data/data.json")); mailMerge.MergeJsonData(data, false); } byte[] results; tx.Save(out results, TXTextControl.BinaryStreamType.InternalUnicodeFormat); return Convert.ToBase64String(results); } }
附加了FieldMerged事件以处理自定义条件。 如果字段在表格单元格内,则将TableCell.Name属性反序列化为CellFilterInstructions对象,以便根据定义的指令应用表格单元格的颜色。
private void MailMerge_FieldMerged(object sender, TXTextControl.DocumentServer.MailMerge.FieldMergedEventArgs e) { // custom field handling if (e.TableCell == null) return; // if TableCell.Name has instructions, create a CellFilterInstructions object // and evaluate the instructions and set the table cell color if (e.TableCell.Name != "") { CellFilterInstructions instructions = (CellFilterInstructions)JsonConvert.DeserializeObject( e.TableCell.Name, typeof(CellFilterInstructions)); // retrieve the color Color? color = instructions.GetColor(e.MailMergeFieldAdapter.ApplicationField.Text); // apply the color if (color != null) e.TableCell.CellFormat.BackColor = (Color)color; } }
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
文章转载自:Text Control本文主要介绍如何使用DevExpress WPF Grid控件实现展开和折叠节点,欢迎下载最新版组件体验!
本文将介绍两种方法,讲述如何使用 C# 从 PDF 中提取条码信息:一种是提取 PDF 页面中的嵌入图片后识别条码,另一种是将整个页面渲染为图像再进行识别。这两种方法都支持识别多种 1D 和 2D 条码类型。
本教程主要为大家介绍DevExpress WinForms WinExplorer视图的项目自定义,欢迎下载最新版组件体验!
将复杂的 DGN 文件转换为可缩放矢量图形 (SVG),SVG 广泛应用于 Web 应用程序和数字媒体,以及建筑、工程和施工等行业,本教程将展示如何使用Aspose.CAD 将DGN导出为SVG。
TX Text Control .NET for WPF 分标准,专业,及企业三个版本,是一套专业的文字处理控件。
TX Text Control .NET for Windows FormsTX Text Control .NET for Windows Forms 是一套功能丰富的文字处理控件。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号