翻譯|產品更新|編輯:龔雪|2024-09-29 10:13:22.227|閱讀 97 次
概述:DevExpress WinForms控件v24.1日前已經全新發布,新版本進一步升級了富文本編輯器、電子表格組件功能等,歡迎下載最新版體驗!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
DevExpress WinForms擁有180+組件和UI庫,能為Windows Forms平臺創建具有影響力的業務解決方案。DevExpress WinForms能完美構建流暢、美觀且易于使用的應用程序,無論是Office風格的界面,還是分析處理大批量的業務數據,它都能輕松勝任!
DevExpress WinForms控件v24.1日前已經全新發布,新版本進一步升級了富文本編輯器、電子表格組件功能等,歡迎下載最新版體驗!
DevExpress技術交流群10:532598169 歡迎一起進群討論
DevExpress WinForms v24.1增加了對關鍵可訪問性相關需求的支持,包括輔助技術(如屏幕閱讀器)讀取文檔主體中的文本、圖像的替代文本和名稱、文本框內容、頁眉和頁腳的能力。
在將Word文檔導出為可訪問的PDF文件時,官方擴展了對以下元素的可訪問性相關支持:
使用Adobe Acrobat Pro和PDF Accessibility Checker 2024 進行質量控制,新版本的測試文檔成功地通過了PDF/UA兼容性和WCAG 2.1兼容性的驗證。
當您指定PdfUACompatibility選項時,與可訪問性相關的導出增強功能可以開箱即用:
C#
using System.IO; using DevExpress.XtraRichEdit; //... using(FileStream stream = new FileStream(resultFilePath, FileMode.Create, FileAccess.Write, FileShare.Read)) { PdfExportOptions exportOptions = new PdfExportOptions(); exportOptions.PdfUACompatibility = PdfUACompatibility.PdfUA1; richEditControl.ExportToPdf(stream, exportOptions); }
DevExpress WinForms v24.1為Shape類添加了一個Decorative屬性,將文檔圖形(圖片、形狀和圖表)標記為裝飾性的。裝飾性的形狀增加了視覺上的趣味,但它們不能提供信息。因此在生成可訪問文檔時,不需要為裝飾性對象指定Alt Text(有意義的描述)。
富文本編輯器現在保存文檔時保留數學方程,您可以在DevExpress WinForms富文本編輯器中導入帶有數學方程的Word文檔,并將其保存為RTF和OpenXml (.docx/.docm)格式,而不會丟失內容。
注意:只有當源文檔包含數學方程的備用圖像時,數學方程才會被打印或導出為PDF。要抑制數學方程的導入,請將屬性設置為DocumentCapability.Disabled。
DevExpress WinForms Rich Text Editor v24.1允許您指定溝邊距-額外的空間,以確保綁定不會模糊打印頁面上的文本。您可以指定溝位置(上、左、右)和邊距大小,使用, 和 屬性來解決特定的使用需求。
下面的代碼片段向第一個文檔部分添加了左gutter:
C#
using DevExpress.XtraRichEdit; using DevExpress.XtraRichEdit.API.Native; using DevExpress.Office.Utils; //... richEditControl.LoadDocument(@"Documents//Alice.docx"); Document document = richEditControl.Document; Section firstSection = wordProcessor.Document.Sections[0]; var pageMargins = firstSection.Margins; pageMargins.GutterPosition = GutterPosition.Left; pageMargins.Gutter = Units.InchesToDocumentsF(1); richEditControl.SaveDocument("Alice_formatted.docx", DocumentFormat.OpenXml);
新的DocumentMarginType屬性允許您定義一個規則的或鏡像的邊距類型,如果在紙張的兩面打印并希望綁定打印輸出,則啟用鏡像頁邊距。
下面的代碼片段啟用鏡像邊距并指定一個額外的空格值:
C#
using DevExpress.XtraRichEdit; using DevExpress.XtraRichEdit.API.Native; using DevExpress.Office.Utils; //... richEditControl.LoadDocument(@"Documents//Alice.docx"); Document document = richEditControl.Document; // Enable mirrored margins document.MarginsType = MarginsType.Mirrored; foreach (Section section in richEditControl.Document.Sections) { var pageMargins = section.Margins; // Set the value for mirrored margins pageMargins.Gutter = Units.InchesToDocumentsF(0.5f); } richEditControl.SaveDocument("Alice_formatted.docx", DocumentFormat.OpenXml);
新的UI元素也可用。
v24.1包括新的跨平臺API,用于將Word文檔頁面導出為圖像,這個新功能允許您生成文檔預覽。使用新的API您可以將文檔頁面轉換為光柵和矢量圖像(PNG, JPEG, BMP,多頁Tiff, emf),將它們保存為磁盤上的物理文件或獲取圖像流列表以便在代碼中進行進一步處理,還可以設置圖像背景顏色、修改輸出圖像分辨率或生成具有指定大小的縮略圖圖像。
新的API可以通過Document對象的擴展方法獲得。
請注意,RichEditDocumentServerExtensions類是在DevExpress.Docs.v24.1.dll程序集中定義的。將這個程序集添加到你的項目中,或者安裝"DevExpress.Document.Processor" NuGet包來使用RichEditDocumentServerExtensions成員。
下面的代碼片段將第一個文檔頁面導出為具有指定大小和JPEG格式的圖像:
C#
using DevExpress.XtraRichEdit; using DevExpress.XtraRichEdit.Export.Image; using DevExpress.Drawing; richEditControl.LoadDocument(@"C:\Documents\Alice.docx"); //... RichEditImageExportOptions options = new RichEditImageExportOptions(); options.Format = DXImageFormat.Jpeg; options.PageRange = "1"; options.LargestEdgeLength = 1080; richEditControl.Document.ExportToImage(@"C:\Documents\Image.jpeg", options);
全新的 Image Export APIs允許您將文檔頁面導出為SVG,使用RichEditImageExportOptions.Format選項將SVG設置為目標圖像格式。
C#
RichEditImageExportOptions options = new RichEditImageExportOptions(); options.Format = DXImageFormat.Svg; options.PageRange = "1"; richEditControl.Document.ExportToImage(@"C:\Documents\Image.svg", options);
SVG Export也可以從用戶界面-打開打印預覽對話框,單擊導出到圖像按鈕,在圖像選項對話框中選擇SVG格式并完成文檔導出。
帶有可滾動內容的DevExpress WinForms數據感知控件現在附帶了與DPI無關的滾動光標(當用戶按下鼠標中鍵時出現的光標),無論屏幕分辨率如何,都可以提供平滑和精確的導航。
DevExpress WinForms v24.1為Shape類添加了一個Decorative屬性,將文檔圖形(圖片、形狀和圖表)標記為裝飾性的。裝飾性的形狀增加了視覺上的趣味,但它們不能提供信息。因此在生成可訪問文檔時,不需要為裝飾性對象指定Alt Text(有意義的描述)。
DevExpress WinForms v24.1增加了對電子表格單元格內的水平對齊類型的支持,使用這些對齊選項的Excel文件可以打印并導出為PDF。
您可以使用屬性在代碼中指定水平對齊方式。
下面的代碼片段指定了代碼中的對齊方式:
C#
var workbook = new Workbook(); var worksheet = workbook.Worksheets[0]; Cell cellA1 = worksheet.Cells["A1"]; cellA1.Value = "Justified and top"; cellA1.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Justify; cellA1.Alignment.Vertical = SpreadsheetVerticalAlignment.Top; workbook.ExportToPdf("Result.pdf");
DevExpress WinForms Spreadsheet附帶了增強的過濾器和排序相關功能,新版本添加了新的API,可以根據背景和字體顏色對工作簿數據進行排序和過濾,按單元格顏色過濾/排序的單元格范圍也可以打印并導出為PDF。
排序API包括新的工作表,排序方法重載設計用于按字體顏色或填充設置(背景顏色和圖案)對指定范圍進行排序。
下面的代碼片段跨兩個單元格區域對單元格值進行排序——第一個單元格按紅色字體顏色排序,第二個單元格按區域中第一個單元格指定的填充設置排序:
C#
spreadsheetControl.LoadDocument("sort-filter.xlsx"); Worksheet worksheet = spreadsheetControl.ActiveWorksheet; // Sort cell range by font color worksheet.Sort(worksheet["B2:B10"], Color.Red); // Sort cell range by fill color worksheet.Sort(worksheet["D2:D10"], worksheet["D2"].Fill);
若要按字體或背景顏色篩選單元格,需要對所需的單元格區域或表應用自動篩選器。完成后您需要從AutoFilter中獲得所需的列,列集合并調用以下方法當中的一個:
下面的代碼片段對單元格范圍和表使用了這些方法:
C#
spreadsheetControl.LoadDocument("sort-filter.xlsx"); Worksheet worksheet = spreadsheetControl.ActiveWorksheet; // Apply an auto-filter to a cell range and filter the first column by font color worksheet.AutoFilter.Apply(worksheet["B1:B10"]); worksheet.AutoFilter.Columns[0].ApplyFontColorFilter(Color.Red); // Create a table, apply an auto-filter and filter the first column by fill color Table table = worksheet.Tables.Add(worksheet["B12:B21"], true); table.AutoFilter.Apply(); table.AutoFilter.Columns[0].ApplyFillColorFilter(Color.Red);
此外新API允許您跨篩選范圍(當啟用自動篩選時)對數據進行排序,并同時按其值/顏色對單元格進行排序(使用排序條件)。
在這個版本中增強了 方法并添加了對SVG圖像格式的支持。
CellRangeExtensions類是在DevExpress.Docs.v24.1.dll程序集中定義的,將此程序集添加到您的項目中或安裝DevExpress.Document.Processor NuGet包來使用CellRangeExtensions成員。
C#
spreadsheetControl.LoadDocument("InvestmentPortfolio.xlsx", DocumentFormat.Xlsx); Worksheet worksheet = spreadsheetControl.ActiveWorksheet; worksheet.Range["B18:I30"].ExportToImage("cell_range_image.svg", ImageFileFormat.Svg);
SVG導出也可以從用戶界面-打開打印預覽對話框,單擊導出到圖像按鈕,在圖像選項對話框中選擇SVG格式并完成文檔導出。
更多產品更新咨詢,請
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都網