Back to Devexpress

Print and Export

windowsforms-404355-controls-and-libraries-vertical-grid-print-and-export.md

latest3.9 KB
Original Source

Print and Export

  • Nov 06, 2023
  • 2 minutes to read

You can render WinForms Vertical Grid content to paper like a traditional WYSIWYG report or export data to numerous file formats. With its API, you can save your data as PDF, XLS, XLSX, MHT, HTML, RTF, DOCX, TXT.

Note

The Vertical Grid can be printed, exported, and previewed only if the DevExpress Printing Library is available. The Printing Library ships as part of the DevExpress WinForms Subscription.

Use the IsPrintingAvailable property to check whether the Vertical Grid can be printed.

Use the VGridControl.OptionsPrint.PrintRecordHeaders property to specify whether to print or export record headers.

API NameDescription
Print()Prints the vertical grid control.
ShowPrintPreview()Opens the Print Preview window with a traditional toolbar UI.
ShowRibbonPrintPreview()Opens the Print Preview window with a Ribbon UI.
IsPrintingAvailableIndicates whether the Vertical Grid can be printed.

The following example demonstrates how to open the Print Preview window:

csharp
if(vGridControl1.IsPrintingAvailable)
    vGridControl1.ShowRibbonPrintPreview();
vb
If vGridControl1.IsPrintingAvailable Then
    vGridControl1.ShowRibbonPrintPreview()
End If

Export API

API NameDescription
ExportExports data in the specified format.
ExportToHtmlExports data as HTML.
ExportToPdfExports data as PDF.
ExportToRtfExports data in RTF format.
ExportToDocxExports data in the Office Open XML file format (DOCX).
ExportToTextExports data as text.
ExportToXlsExports data in XLS format.
ExportToXlsxExports data in XLSX (MS Excel 2007) format
ExportToMhtExports data in MHT format.

The following example demonstrates how to export data in PDF format and save it to a file:

csharp
if(vGridControl1.IsPrintingAvailable)
    vGridControl1.ExportToPdf(@"d://verticalgrid.pdf");
vb
If vGridControl1.IsPrintingAvailable Then
    vGridControl1.ExportToPdf("d://verticalgrid.pdf")
End If

See Also

Document Post-Processing