This post includes a series of interesting support tickets answered throughout June and July along with a few enhancements made to our Office-inspired product line in recent months. We hope you find the contents of this post interesting and of business value. Should you have any questions about a particular support ticket, feel free to post a comment in the DevExpress Support Center.
Tips & Tricks
Word Processing Document API and Rich Text Editors (WinForms and WPF)
T1094793 - How to customize "Normal" margins displayed in the "Margins" ribbon menu
https://supportcenter.devexpress.com/ticket/details/t1094793T1094305 - How to keep table rows together
https://supportcenter.devexpress.com/ticket/details/t1094305T1089928 - How to insert a cell range from the Excel worksheet in the RichEditControl document
https://supportcenter.devexpress.com/ticket/details/t1089928You can export cell range content to HTML and insert it into the RichEditControl. Call the Workbook.ExportToHtml method to export a cell range. The InsertHtmlText or InsertDocumentContent methods allow you to insert HTML content within a RichEditControl document.
using DevExpress.Spreadsheet; using DevExpress.XtraRichEdit; using DevExpress.XtraRichEdit.API.Native; Document document = richEditControl.Document; Workbook workbook = new Workbook(); workbook.LoadDocument("test.xlsx"); Worksheet worksheet = workbook.Worksheets[0]; HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions(); options.SheetIndex = worksheet.Index; options.Range = worksheet.GetDataRange().GetReferenceA1(); options.UseColumnGroupTag = false; using (MemoryStream stream = new MemoryStream()) { workbook.ExportToHtml(stream, options); stream.Position = 0; document.InsertDocumentContent(document.CaretPosition, stream, DocumentFormat.Html); }
T1088489 - How to cancel the paragraph indent when the Tab is inserted at the paragraph start
https://supportcenter.devexpress.com/ticket/details/t1088489T1097118 - Add custom clickable tags that can be replaced with the correct text in the RichEditControl
https://supportcenter.devexpress.com/ticket/details/t1097118T1096314 - How to replace text in paragraphs that contain fields
https://supportcenter.devexpress.com/ticket/details/t1096314T1095980 - How to get text in a bulleted or numbered list without a list marker
https://supportcenter.devexpress.com/ticket/details/t1095980You can use the PlainTextDocumentExporterOptions.ExportBulletsAndNumbering property to exclude list markers from exported text. Set this property to false and pass the PlainTextDocumentExporterOptions object as the Get... method parameter.
if (paragraph.IsInList == true) { PlainTextDocumentExporterOptions textOptions = new PlainTextDocumentExporterOptions { ExportBulletsAndNumbering = false }; string text = wordProcessor.Document.GetText(paragraph.Range, textOptions); }
Spreadsheet Document API and Spreadsheet Controls (WinForms and WPF)
T1099759 - How to implement a popup menu to edit cell values and show tooltips for popup items
https://supportcenter.devexpress.com/ticket/details/T1099759T1093861 - How to check if the CellValueChanged event is raised during the Paste operation
https://supportcenter.devexpress.com/ticket/details/t1093861Check the SpreadsheetCellEventArgs.Action property value and perform required actions when set to CellValueChangedAction.Paste.
void spreadsheetControl1_CellValueChanged(object sender, SpreadsheetCellEventArgs e) { if (e.Action == CellValueChangedAction.Paste) // your code here }
T1084994 - How to determine a worksheet protection status
https://supportcenter.devexpress.com/ticket/details/t1084994
PDF Viewer
T1102035 - How to use custom zoom buttons
https://supportcenter.devexpress.com/ticket/details/t1102035Use a custom button located outside the built-in Ribbon to change zoom factor. To do so, execute the PdfZoomInCommand and PdfZoomOutCommand commands in the button’s click event handler:
PdfZoomInCommand command = new PdfZoomInCommand(pdfViewer); command.Execute();
Enhancements
WinForms and WPF PDF Viewers
T1083840 – You can now use the PdfViewer.FormFieldEditorShowing and PdfViewer.FormFieldEditorShown events to determine when a form field editor is activated.
https://supportcenter.devexpress.com/ticket/details/t1083840These events allow you to obtain the activated field name and its value and cancel the opening of the field editor.
private void PdfViewer1_FormFieldEditorShowing(object sender, PdfFormFieldEditorShowingEventArgs e) { object value = e.Value; string fieldName = e.FieldName; e.Cancel = true; }
T1094915 – We implemented a GetPageInfo method in PdfViewer and PdfViewerControl classes. This method helps you obtain information about PDF page size and rotation angle.
https://supportcenter.devexpress.com/ticket/details/t1094915The GetPageInfo method returns a PdfPageInfo object. You can use its CropBox and RotationAngle properties to obtain the page crop box (the region in which page contents are clipped when displayed or printed) and page rotation angle.
PDF Document API
T1098494 - New PdfSaveOptions class properties prevent updates to xmp:CreateDate, xmp:ModifyDate or xmp:MetadataDate metadata when you save a PDF document.
https://supportcenter.devexpress.com/ticket/details/t1098494
New Examples and Documentation Updates
We created an example that shows how to add a sticky note at a specific point on a PDF page. In this example, we use the new PdfViewer.GetPageInfo method to calculate a point for the sticky note based on the current page size and rotation angle.
How to: Use the GetPageInfo Method to Add a Sticky Note at a Specific Page Corner
We also updated the following articles: