Quantcast
Channel: Developer Express Inc.
Viewing all articles
Browse latest Browse all 2370

Office File API & Office-Inspired Desktop UI Controls – Tips & Tricks (January-March 2021)

$
0
0

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

  1. 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

  1. T969099 - How to programmatically scroll a document to a bookmark
    https://supportcenter.devexpress.com/ticket/details/T969099

  2. T966380 - How to disable right-to-left selection
    https://supportcenter.devexpress.com/ticket/details/T966380

    To 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;
    }
  3. 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

  1. T972881 - How to conditionally show/hide the Merge Cells ribbon button
    https://supportcenter.devexpress.com/ticket/details/T972881

  2. T970327 - How to change worksheet tab color
    https://supportcenter.devexpress.com/ticket/details/T970327

  3. T969696 - How to automatically resize a row that contains horizontally merged cells
    https://supportcenter.devexpress.com/ticket/details/T969696

    Activate the SpreadsheetCellOptions.AutoFitMergedCellRowHeight property to enable AutoFit for rows with horizontally merged cells:

    var cellOptions = spreadsheetControl1.Options.Cells;
    cellOptions.AutoFitMergedCellRowHeight = true;

WinForms PDF Viewer

  1. T970229 - How to preset a printer name in the Print dialog
    https://supportcenter.devexpress.com/ticket/details/T970229

    Specify 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

  1. T974031 - How to change suggestion order in the spell checker's Suggestion List
    https://supportcenter.devexpress.com/ticket/details/T974031

  2. T970433 - How to enable spell checking for a ButtonEdit instance
    https://supportcenter.devexpress.com/ticket/details/T970433

    You 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)

  1. T979035 – You can now access an OLE Package object’s properties
    https://supportcenter.devexpress.com/ticket/details/T979035

WinForms Rich Text Editor

  1. 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)

  1. 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);
  2. 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.

  3. We implemented the following Microsoft Excel compatible functions:

Excel Export Library

  1. 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/T970359

    using (IXlCell cell = row.CreateCell())
    {
        cell.Value = "=A2";
        cell.HasQuotePrefix = true;
    }

WinForms PDF Viewer

  1. T974619 – Use the PdfViewer.AllowCommentReplies property to disable replies to comments in the Navigation pane
    https://supportcenter.devexpress.com/ticket/details/T974619

    pdfViewer1.AllowCommentReplies = false;
  2. T974621 – Set the PrintStickyNotes property to false to disable printing for sticky notes
    https://supportcenter.devexpress.com/ticket/details/T974621

    PdfPrinterSettings printerSettings = new PdfPrinterSettings();
    printerSettings.PrintStickyNotes = false;
    pdfViewer1.Print(printerSettings);

PDF Document API

  1. T974576 – You can now use PdfViewerPreferences class properties to specify a document’s initial view settings
    https://supportcenter.devexpress.com/ticket/details/T974576

    using (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");
    }
  2. 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

WPF Rich Text Editor

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.


Viewing all articles
Browse latest Browse all 2370

Trending Articles