WPF Spreadsheet - New Layout Calculation Engine (v20.2)

Office-Inspired Products
15 January 2021

As you may already know, our WPF Spreadsheet control v20.2 ships with a new layout calculation engine. In this post, we’ll detail the enhancements made to our new WPF Spreadsheet layout engine and what you can expect when the control is incorporated into your WPF application.

Increased Scroll Performance

Our new WPF Spreadsheet layout engine has improved scroll performance quite significantly. The chart below illustrates the difference between v20.1 and v20.2. We ran our test on a sample worksheet with 50 visible rows and 29 visible columns and a total of 500 rows and 50 columns. We scrolled the sheet by three rows and measured the time required to render document layout. This action was repeated 50 times. The chart below displays the total time taken to complete the test:

PDF Export Enhancements

We implemented a new PDF export engine for our WPF Spreadsheet control. The new engine uses our DevExpress PDF Document API library to generate PDF files. It renders more precise layouts, offers better performance and a smaller memory footprint than its predecessor. Please note that this engine is only available if our new layout calculation engine is used.

The charts below list total export time and memory consumption for our new and our legacy PDF export engines. For tests we used a set of documents with different content: unwrapped and wrapped (multiline) cell text, conditionally formatted cells, and chart sheets.

Print Layout Enhancements

We improved row height and column width calculation for printed documents. Our WPF Spreadsheet control now generates a printout that closely mirrors the print output of Microsoft Excel.

Specifically, this enhancement will help you avoid unwanted page breaks that could appear in previous versions of our Spreadsheet control.

Rich Text Support in Spreadsheet Cells

Another advantage of our new layout calculation engine is its ability to display rich formatted text within worksheet cells. You can easily print and export (to PDF) documents with rich text.

Note: The WPF Spreadsheet control does not allow you to apply rich formatting to cell text via the control’s UI. Use our Rich Text API to create rich text in code and assign it to a cell.

Rich Text Support in Headers and Footers

You can now print and export (to PDF) spreadsheets that contain headers and footers with rich text and inline pictures.

The Spreadsheet control supports special codes to help you add dynamic data to a header or footer and format associated content. These codes are also available as constant fields and static methods of the HeaderFooterCode class.

The example below adds a header to odd pages. We use the following codes in this example:

  • HeaderFooterCode.FontColor method - Applies a theme color to text.
  • &B - Applies bold effect to characters.
  • &A - Inserts the current worksheet's name.
IWorkbook workbook = spreadsheetControl.Document;
Worksheet worksheet = workbook.Worksheets[0];

var options = worksheet.HeaderFooterOptions;
// Add rich formatted text to the header's left section.
options.OddHeader.Left = string.Format("{0}&BDev{1}AV", 
	HeaderFooterCode.FontColor(4, -50), 
    HeaderFooterCode.FontColor(4, 10));
// Insert sheet name into the header's right section
// and make it bold.
options.OddHeader.Right = "&B&A";

Center Continuous Alignment

Our WPF Spreadsheet control now supports Center Continuous (Center Across Selection) horizontal alignment. This alignment type allows you to center text across multiple cells without applying the Merge & Center option.

Disable the New Layout Engine

After the update, our Spreadsheet control can render and print certain documents differently from previous versions. If this is an issue for you, activate the SpreadsheetCompatibilityOptions.EnableLegacyLayoutEngine option to disable the new layout engine and all related features.

<dxsps:SpreadsheetControl.Options>
    <dxsps:SpreadsheetControlOptions>
        <dxsps:SpreadsheetControlOptions.Compatibility>
             <dxsps:SpreadsheetCompatibilityOptions 
             		EnableLegacyLayoutEngine="True"/>
        </dxsps:SpreadsheetControlOptions.Compatibility>
    </dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>

Your Feedback Matters

As always, we welcome your thoughts. Please comment below and let us know what you think of our new WPF Spreadsheet layout calculation engine.

Should you have technical questions, feel free to contact us via the DevExpress Support Center.

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.
No Comments

Please login or register to post comments.