Office File API and Office-Inspired Controls (WinForms & WPF) — Early Access Preview (v24.1)

This post describes a number of features we expect to ship in the next major release and details what’s inside our current Early Access Preview build v24.1. For additional information on what you can expect, please refer to our v24.1 roadmap.

Early Access and CTP builds are provided solely for early testing purposes and are not ready for production use. This build can be installed side by side with other major versions of DevExpress products. Please back up your project and other important data before installing Early Access and CTP builds. This EAP may not include all features/products we expect to ship in our v24.1 release cycle. As its name implies, the EAP offers an early preview of what we expect to ship in two months.

Office File API

Printing in Unix-based Systems

In this release (v24.1), we address limitations for .NET-based Office File API applications and add printing support for Barcodes, Word, Excel, and PDF documents in non-Windows environments (namely, macOS and Unix-based systems that support printing through Common UNIX Printing System (CUPS)). In older versions, our Word Processing Document API, Spreadsheet Document API, PDF Document API, and Barcode Generation API libraries included Print methods that printed documents and barcodes using PrinterSettings options unavailable in non-Windows environments. To address the .NET limitation, we implemented a new set of APIs that leverage DXPrinterSettings options available within our DevExpress.Drawing library.

Use the following new methods to print your documents and barcodes in Unix-based systems:

// DevExpress.XtraRichEdit.RichEditDocumentServer: 
public void Print(DXPrinterSettings printerSettings, string printDocumentName); 
public void Print(DXPrinterSettings printerSettings); 

public void Print(DXPrinterSettings printerSettings); 
public void Print(DXPrinterSettings printerSettings, params string[] sheetNames); 
public void Print(DXPrinterSettings printerSettings, IEnumerable<string> sheetNames); 

public void Print(DXPrinterSettings printerSettings);

For the DevExpress.Pdf.PdfDocumentProcessor class, you still need to call the current Print(PdfPrinterSettings printerSettings) method. To modify print settings, use the new PdfPrinterSettings.DXPrinterSettings option.

For Unix-based systems, you need to install the libcups2 package separately.

PDF Document API and PDF Viewers for WinForms and WPF

Layer API

This release updates our PDF Facade API and adds new APIs to manage Optional Content (Layers) visibility in code.

Please note that a PDF document only stores the default Optional Content configuration. This means that layer visibility isn't preserved when you save the document. Visibility settings are applicable only when you preview the document in the PDF Viewer component, print the document, or export it to an image. The new API is available via the PdfDocumentFacade.OptionalContentVisibility property. Access Optional Content groups using the PdfOptionalContentVisibility.Groups collection. To change group visibility, modify the PdfOptionalContentGroupVisibility.Visible property value.

The following code snippet adjusts visibility for Optional Content groups stored in the document and generates print/image output to preview results:

PdfDocumentProcessor processor = new PdfDocumentProcessor();

// Set the visibility for each Layer
processor.DocumentFacade.OptionalContentVisibility.Groups[0].Visible = false;
processor.DocumentFacade.OptionalContentVisibility.Groups[1].Visible = false;
processor.DocumentFacade.OptionalContentVisibility.Groups[2].Visible = true;

// Print the document or export its page to an image to check the result
DXBitmap bitmap = processor.CreateDXBitmap(1, 1000);

Word Processing API and Rich Text Editors for WinForms and WPF

Cross-Platform Image Export API

v24.1 will include new cross-platform APIs to export Word documents to an image. This new capability makes it possible to generate document previews in both Windows and non-Windows environments. With our new APIs, you can convert document pages to raster and/or vector images (PNG, JPEG, BMP, multi-page Tiff, emf, wmf), save them as physical files on the disk, or obtain a list of image streams for further processing in code. It's also possible to set the image background color, modify output image resolution, or generate thumbnail images with the specified size.

The new API is available via the RichEditDocumentServerExtensions.ExportToImage extension method of the Document object. You can use it with both the Word Processing Document API library and our Desktop Rich Text Editors (WinForms & WPF).

Note: The RichEditDocumentServerExtensions class is defined in the DevExpress.Docs.v24.1.dll assembly. Add this assembly to your project or install the DevExpress.Document.Processor Nuget Package from the Offline Package source to use RichEditDocumentServerExtensions members. You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this library in production code.

The following code snippet exports the first document page to an image with a specified resolution/JPEG format:

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.Export.Image;
using DevExpress.Drawing;

using (var wordProcessor = new RichEditDocumentServer()) {

    RichEditImageExportOptions options = new RichEditImageExportOptions();
    options.Format = DXImageFormat.Jpeg;
    options.PageRange = "1";
    options.LargestEdgeLength = 1080;

    wordProcessor.Document.ExportToImage(@"C:\Documents\Image.jpeg", options);

Your Feedback Matters

As always, we welcome your feedback. Should you encounter an issue while using this DevExpress Early Access Preview build (v24.1), please submit a support ticket via the DevExpress Support Center. We will be happy to follow up.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.