WYSIWYG Export
- 3 minutes to read
In this mode, an exported document retains the layout of grid cells. Grid data shaping features in the exported document are not supported, in comparison to the data-aware export. This mode uses the Printing-Exporting library to export data.
Export Data in Code
The GridControl allows you to export its data to a file or stream. The following code sample exports the GridControl‘s data to a PDF file:
void Button_Click_Export(object sender, RoutedEventArgs e) {
view.ExportToPdf(@"c:\Example\grid_export.pdf");
}
Method | Description |
---|---|
DataViewBase.ExportToHtml | Exports a grid to the specified file path in HTML format. |
DataViewBase.ExportToImage | Exports a grid to the specified file path in image format. |
DataViewBase.ExportToMht | Exports a grid to the specified file path in MHT format |
DataViewBase.ExportToPdf | Exports a grid to the specified file path in PDF format. |
DataViewBase.ExportToRtf | Exports a grid to the specified stream in RTF format. |
DataViewBase.ExportToText | Exports a grid to the specified stream in text format. |
DataViewBase.ExportToXps | Exports a grid to the specified file path in XPS format. |
TableView.ExportToCsv*, TreeListView.ExportToCsv*, CardView.ExportToCsv | Exports a grid to the specified stream in CSV format. |
TableView.ExportToXls*, TreeListView.ExportToXls*, CardView.ExportToXls | Exports a grid to the specified file path in XLS format. |
TableView.ExportToXlsx*, TreeListView.ExportToXlsx*, CardView.ExportToXlsx | Exports a grid to the specified stream in XLSX format. |
*these methods use the data-aware export mode. To enable the WYSIWYG mode in these methods, do one of the following:
Set the ExportSettings.DefaultExportType property to ExportType.WYSIWYG to enable the WYSIWYG export mode for all export methods.
Call a method with the XlsExportOptionsEx.ExportType, XlsxExportOptionsEx.ExportType, or CsvExportOptionsEx.ExportType property set to WYSIWYG.
Export Data with Print Preview
The Print Preview window allows end users to print document and export it to a file in the required format.
Method | Description |
---|---|
DataViewBase.ShowPrintPreview | Creates the print document from the View and displays the document’s Print Preview. |
DataViewBase.ShowPrintPreviewDialog | Creates the print document from the View and displays the document’s modal Print Preview. |
DataViewBase.ShowRibbonPrintPreview | Creates the print document from the View and displays the document’s Print Preview with the Ribbon. |
DataViewBase.ShowRibbonPrintPreviewDialog | Creates the print document from the View and displays the document’s modal Print Preview with the Ribbon. |
Customize Appearance
To customize the exported document, use approaches from the Customize Printed Document Appearance topic.