The first portion of this blog post includes interesting support tickets answered over the last few months. The second half includes enhancements to our Office & PDF File API/Office-inspired UI controls for WinForms and WPF.
We hope you find the contents of this post of value as you explore our Office-inspired product line. Should you have any questions, feel free to comment below.
Tips & Tricks
PDF Document API
T964645 - How to use PDF Document API in an AWS Lambda function
https://supportcenter.devexpress.com/ticket/details/T964645
WinForms and WPF Rich Text Editors
T969099 - How to programmatically scroll a document to a bookmark
https://supportcenter.devexpress.com/ticket/details/T969099T966380 - How to disable right-to-left selection
https://supportcenter.devexpress.com/ticket/details/T966380To disable backward selection, change cursor position within the
SelectionChanged
event handler:private void RichEditControl1_SelectionChanged(object sender, EventArgs e) { if (richEditControl1.Document.Selection.Length > 0 && richEditControl1.Document.CaretPosition.ToInt() < richEditControl1.Document.Selection.End.ToInt()) richEditControl1.Document.CaretPosition = richEditControl1.Document.Selection.End; }
T967667 - How to preserve custom colors selected in the Border and Shading dialog after the form has been closed
https://supportcenter.devexpress.com/ticket/details/T967667
WinForms Spreadsheet Control
T972881 - How to conditionally show/hide the Merge Cells ribbon button
https://supportcenter.devexpress.com/ticket/details/T972881T970327 - How to change worksheet tab color
https://supportcenter.devexpress.com/ticket/details/T970327T969696 - How to automatically resize a row that contains horizontally merged cells
https://supportcenter.devexpress.com/ticket/details/T969696Activate the SpreadsheetCellOptions.AutoFitMergedCellRowHeight property to enable AutoFit for rows with horizontally merged cells:
var cellOptions = spreadsheetControl1.Options.Cells; cellOptions.AutoFitMergedCellRowHeight = true;
WinForms PDF Viewer
T970229 - How to preset a printer name in the Print dialog
https://supportcenter.devexpress.com/ticket/details/T970229Specify the PrinterSettings.PrinterName property within the PageSetupDialogShowing event handler:
private void PdfViewer1_PageSetupDialogShowing(object sender, PdfPageSetupDialogShowingEventArgs e) { e.PrinterSettings.Settings.PrinterName = "MyPrinter"; }
WinForms and WPF Spell Checker
T974031 - How to change suggestion order in the spell checker's Suggestion List
https://supportcenter.devexpress.com/ticket/details/T974031T970433 - How to enable spell checking for a ButtonEdit instance
https://supportcenter.devexpress.com/ticket/details/T970433You can use the SpellingSettings.RegisterTextControl method to enable spell checking for a text editor that is inherited from TextBox, RichTextBox, or TextEdit.
public MainWindow() { SpellingSettings.RegisterTextControl(typeof(ButtonEdit)); InitializeComponent(); // ... }
In XAML, configure the text control's DXSpellChecker behavior:
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" xmlns:dxspch="http://schemas.devexpress.com/winfx/2008/xaml/spellchecker" <!-- ... --> <dxe:ButtonEdit Height="300" Width="700" Text="Mispelled teext" > <dxmvvm:Interaction.Behaviors> <dxspch:DXSpellChecker CheckAsYouType="True" IgnoreMixedCaseWords="False" SpellingFormType="Word" ShowSpellCheckMenu="True" > </dxspch:DXSpellChecker> </dxmvvm:Interaction.Behaviors> </dxe:ButtonEdit>
Enhancements
Word Processing Document API and Rich Text Editors (for WinForms and WPF)
T979035 – You can now access an OLE Package object’s properties
https://supportcenter.devexpress.com/ticket/details/T979035
WinForms Rich Text Editor
Improved Dialog Form Layout
We redesigned our WinForms Rich Text Editor’s dialogs using our DevExpress Layout Control. This allowed us to address form scaling issues for High-DPI devices and applications with non-default localization and fonts.
Spreadsheet Document API and Spreadsheet Controls (for WinForms and WPF)
T970413 – Use new PivotDataFieldCollection.Add and PivotDataFieldCollection.Insert method overloads to create data fields and specify the summary functions used to calculate field values
https://supportcenter.devexpress.com/ticket/details/T970413// Create pivot table. // Use cell range "A1:E65" as a data source. var pivotTable = worksheet.PivotTables.Add(sourceWorksheet["A1:E65"], worksheet["B2"]); // Add "Category" and "Product" fields to row axis area. pivotTable.RowFields.Add(pivotTable.Fields["Category"]); pivotTable.RowFields.Add(pivotTable.Fields["Product"]); // Add "Amount" field to data area. // Use "Average" function to summarize field values. var dataField = pivotTable.DataFields.Add(pivotTable.Fields["Amount"], "Average of AMOUNT", PivotDataConsolidationFunction.Average);
We improved copy and paste behavior for our WinForms and WPF Spreadsheets. With this update, if you copy data from a worksheet that contains filtered rows, the Spreadsheet control will not paste hidden cells onto a destination worksheet.
We implemented the following Microsoft Excel compatible functions:
Excel Export Library
T970359 - You can now use the IXlCell.HasQuotePrefix property to specify whether to treat a number, date, or formula used in a cell as text and prevent its use in calculations
https://supportcenter.devexpress.com/ticket/details/T970359using (IXlCell cell = row.CreateCell()) { cell.Value = "=A2"; cell.HasQuotePrefix = true; }
WinForms PDF Viewer
T974619 – Use the PdfViewer.AllowCommentReplies property to disable replies to comments in the Navigation pane
https://supportcenter.devexpress.com/ticket/details/T974619pdfViewer1.AllowCommentReplies = false;
T974621 – Set the PrintStickyNotes property to false to disable printing for sticky notes
https://supportcenter.devexpress.com/ticket/details/T974621PdfPrinterSettings printerSettings = new PdfPrinterSettings(); printerSettings.PrintStickyNotes = false; pdfViewer1.Print(printerSettings);
PDF Document API
T974576 – You can now use
PdfViewerPreferences
class properties to specify a document’s initial view settings
https://supportcenter.devexpress.com/ticket/details/T974576using (var pdfDocumentProcessor = new PdfDocumentProcessor()) { pdfDocumentProcessor.LoadDocument("FormDemo.pdf"); var viewerPreferences = new PdfViewerPreferences(); viewerPreferences.DisplayDocTitle = false; viewerPreferences.FitWindow = true; viewerPreferences.HideToolbar = true; pdfDocumentProcessor.Document.ViewerPreferences = viewerPreferences; pdfDocumentProcessor.SaveDocument("FormDemo_Upd.pdf"); }
T971338 – You can now retrieve the number of pages in a document to be signed
https://supportcenter.devexpress.com/ticket/details/T971338
New Help Topics & Examples
Word Processing Document API
WinForms Rich Text Editor
- Import an HTML File into the Rich Text Editor or Export a Document to HTML
- Troubleshooting
This topic will help you identify issues that may occur when our WinForms Rich Text Editor opens and renders documents in different formats.
WPF Rich Text Editor
- Import an HTML File into the Rich Text Editor or Export a Document to HTML
- Troubleshooting
This topic will help you identify issues that may occur when our WPF Rich Text Editor opens and renders documents in different formats.
New Example: PDF Document API
The following example demonstrates use of the Azure Key Vault API to digitally sign a PDF document.
https://github.com/DevExpress-Examples/How-to-sign-a-PDF-document-using-Azure-Key-Vault-API
As always, if you’ve come across an interesting support ticket you’d like to share with the rest of the DevExpress developer community, please comment below and include the appropriate link.