没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|产品更新|编辑:龚雪|2025-05-23 10:27:44.450|阅读 46 次
概述:DevExpress WinForms控件v24.2日前已经全新发布,新版本全新升级富文本编辑器组件等功能,欢迎下载最新版体验!
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
DevExpress WinForms拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!
DevExpress WinForms控件v24.2日前已经全新发布,新版本全新升级富文本编辑器组件等功能,欢迎下载最新版体验!
DevExpress技术交流群11:749942875 欢迎一起进群讨论
DevExpress WinForms富文本编辑器支持大小写字符格式,使用小写字母格式的Word文档可以预览、打印和导出为PDF。要在代码中启用格式化,请使用CharacterProperties.SmallCaps属性:
C#
Document document = richEditControl.Document; Paragraph paragraph = document.Paragraphs[0]; CharacterProperties characterProperties = document.BeginUpdateCharacters(paragraph.Range); characterProperties.SmallCaps = true; document.EndUpdateCharacters(characterProperties);
此外,v24.2在Font复选框中添加了一个Small Caps复选框,以便通过UI应用格式。
DevExpress WinForms富文本编辑器现在支持页面边框,具有页面边框的Word文档可以保存而不会丢失内容,可以预览、打印和导出为PDF。
v24.2还实现了用于在代码中管理页面边框的API,可以为每个文档部分单独设置边框。使用Section.PageBorders属性来访问和修改特定部分的边框。使用新的API,您可以修改以下边框设置:
您还可以对部分中的特定页面应用边框:对所有页面、仅对第一个页面或除第一个页面外的所有页面应用边框,您可以更改边框的z轴顺序来显示它们在主文本的前面或后面。下面的代码片段在包含两个部分的文档中应用不同的边框:
C#
Document document = richEditControl.Document; string pageBreaks = "\f\f\f"; // Generate a document with two sections and multiple pages in each section document.AppendText(pageBreaks); document.Paragraphs.Append(); document.AppendSection(); document.AppendText(pageBreaks); // Set borders for the first page of the first section SetPageBorders(pageBorders1.LeftBorder, BorderLineStyle.Single, 1f, Color.Red); SetPageBorders(pageBorders1.TopBorder, BorderLineStyle.Single, 1f, Color.Red); SetPageBorders(pageBorders1.RightBorder, BorderLineStyle.Single, 1f, Color.Red); SetPageBorders(pageBorders1.BottomBorder, BorderLineStyle.Single, 1f, Color.Red); pageBorders1.AppliesTo = PageBorderAppliesTo.FirstPage; Section secondSection = document.Sections[1]; SectionPageBorders pageBorders2 = secondSection.PageBorders; // Set borders for all pages of the second section SetPageBorders(pageBorders2.LeftBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetPageBorders(pageBorders2.TopBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetPageBorders(pageBorders2.RightBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetPageBorders(pageBorders2.BottomBorder, BorderLineStyle.Double, 1.5f, Color.Green); pageBorders2.AppliesTo = PageBorderAppliesTo.AllPages; pageBorders2.ZOrder = PageBorderZOrder.Back; //..... void SetPageBorders(PageBorder border, BorderLineStyle lineStyle, float borderWidth, Color color) { border.LineStyle = lineStyle; border.LineWidth = borderWidth; border.LineColor = color; }
v24.2版本在代码中实现了新的API来管理Word文档的段落边框,使用这些新的API,您可以为文档段落添加边框,单独更改每种边框类型(上、左、右、下或水平)的边框样式、颜色和厚度,或者删除边框格式。此外,还可以管理段落样式的段落边框设置和编号列表中的列表级别。
段落的边框设置可以通过ParagraphBorders类来实现,使用Paragraph.Borders、ParagraphProperties.Borders或ParagraphStyle.Borders属性来获取ParagraphBorders对象,并根据您的具体使用场景修改边框设置。
C#
richEditControl.Text = "paragraph 1\r\nparagraph 2\r\nparagraph 3\r\nparagraph 4\r\n"; Document document = richEditControl.Document; // Setup borders for one paragraph Paragraph firstParagraph = document.Paragraphs[0]; ParagraphBorders borders1 = firstParagraph.Borders; SetBorders(borders1.LeftBorder, BorderLineStyle.Single, 1f, Color.Red); SetBorders(borders1.TopBorder, BorderLineStyle.Single, 1f, Color.Red); SetBorders(borders1.RightBorder, BorderLineStyle.Single, 1f, Color.Red); SetBorders(borders1.BottomBorder, BorderLineStyle.Single, 1f, Color.Red); // Setup borders for multiple paragraphs Paragraph secondParagraph = document.Paragraphs[1]; Paragraph forthParagraph = document.Paragraphs[3]; DocumentRange paragraphRange = document.CreateRange(secondParagraph.Range.Start, forthParagraph.Range.End.ToInt() - secondParagraph.Range.Start.ToInt()); ParagraphProperties paragraphProperties = document.BeginUpdateParagraphs(paragraphRange); ParagraphBorders borders2 = paragraphProperties.Borders; SetBorders(borders2.LeftBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetBorders(borders2.TopBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetBorders(borders2.RightBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetBorders(borders2.BottomBorder, BorderLineStyle.Double, 1.5f, Color.Green); SetBorders(borders2.HorizontalBorder, BorderLineStyle.Double, 1.5f, Color.Green); document.EndUpdateParagraphs(paragraphProperties); // Reset paragraph borders secondParagraph.Borders.Reset(); //... void SetBorders(ParagraphBorder border, BorderLineStyle lineStyle, float borderWidth, Color color) { border.LineStyle = lineStyle; border.LineWidth = borderWidth; border.LineColor = color; }
Table.Title和Table.Description属性允许您指定Word文档表中包含的信息的替代、基于文本的表示形式。在将Word文档导出为可访问的PDF格式时,也会使用表格标题和描述。
C#
RichEditDocumentServer documentProcessor = new RichEditDocumentServer(); documentProcessor.LoadDocument("tables.docx"); Document document = documentProcessor.Document; if(document.Tables.Count > 0) { Table table = document.Tables[0]; table.Title = "Table title.."; table.Description = "Table description.."; }
注意,表格标题和描述只支持OpenXml文档格式(.docx, .docm, .dotx, .dotm)和HTML。
DevExpress WinForms v24.2附带了一个新的AI支持的Alt Text对话框,该对话框允许您为Word文档中的形状对象设置可访问的描述,或将非信息文档图形标记为装饰性(此设置允许屏幕阅读器在扫描文档时忽略装饰性图形)。此外,您可以使用AI支持的Alt Text对话框来为文档图像生成有意义的描述。
要启用此功能,请注册AI服务,然后在WinForms应用程序中附加GenerateImageDescriptionBehavior操作。
C#
using DevExpress.AIIntegration.WinForms; //... public RichEditControlForm() { InitializeComponent(); behaviorManager1.Attach<GenerateImageDescriptionBehavior>(richEditControl1); }
如果GenerateDescriptionBehavior没有为DevExpress富文本编辑器注册,则Generate按钮将被禁用,只能为文档图像生成描述。当选择形状或图表对象时,Generate选项将被禁用。
新的内置对话框可以从形状的上下文菜单中获得,要激活Alt Text对话框,请选择文档形状、图像或图表,打开上下文菜单并单击 "View Alt Text..."上下文菜单项。
Document.VbaProject属性允许您以编程方式访问存储在启用宏的Word文件中的VBA项目,使用VbaProject.Modules集合来获取有关VBA项目模块的信息(模块的数量、模块的名称和二进制数据),或者从项目中删除特定的模块。如果当前文档格式不支持宏,或者启用宏的文档不包含宏,则VbaProject.Modules集合为空。
C#
// Check if the current document has macros and remove them Document document = wordProcessor.Document; if(document.VbaProject.Modules.Count > 0) document.VbaProject.Modules.Clear();
更多产品资讯及授权,欢迎来电咨询:023-68661681
更多DevExpress线上公开课、中文教程资讯请上中文网获取
慧都是⼀家⾏业数字化解决⽅案公司,专注于软件、⽯油与⼯业领域,以深⼊的业务理解和⾏业经验,帮助企业实现智能化转型与持续竞争优势。
慧都是DevExpress的中国区的合作伙伴,DevExpress作为用户界面领域的优秀产品,帮助企业高效构建权限管理、数据可视化(如网格/图表/仪表盘)、跨平台系统(WinForms/ASP.NET/.NET MAUI)及行业定制解决方案,加速开发并强化交互体验。
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
文章转载自:慧都网DevExpress WPF控件近期全新发布v24.2,此版本进一步升级了富文本编辑器的功能,欢迎下载最新版体验!
全球知名前端控件开发商 DHTMLX 宣布:其两大旗舰产品 DHTMLX Gantt(甘特图) 与 DHTMLX Scheduler(日程排程器) 的官方文档现已支持 中文、德语、韩语。开发者们终于可以用母语轻松学习、快速上手!
知名开发工具RubyMine全新发布v2025.1,新版本新增适用于 Ruby 和 RBS 的 AI 功能、改进对 Ruby 3.4 的支持等,欢迎下载最新版组件体验!
Stimulsoft Reports、Dashboards 和 PDF-Forms 2025.3新版本即将发布!让我们先睹为快新版本有哪些新功能!
优秀的界面控件开发包,帮助企业构建卓越应用!
DevExpress DXperience Subscription高性价比的企业级.NET用户界面套包,助力企业创建卓越应用!
DevExpress WinForms Subscription为Windows Forms平台创建具有影响力的业务解决方案,高性价比WinForms界面控件套包。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号