Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 4.63 KB

Readme.md

File metadata and controls

42 lines (25 loc) · 4.63 KB

How to Export ASP.NET MVC Pivot Grid to PDF and XLSX Formats with Custom Settings

This example demonstrates how to export ASP.NET MVC Pivot Grid to PDF and XLSX formats, specify various export options and customize the exported cell's content and appearance.

The following image shows the MVCXPivotGrid when the example is run.

Click the Export to XLSX (DataAware), Export to XLSX (WYSIWYG) or Export to PDF button to perform export.

Export to XLSX format is performed using the PivotGridExtension.ExportToXlsx method. To specify export options, this example creates the PivotXlsxExportOptions class instance, modifies it as required and passes to the method as a parameter. The PivotXlsxExportOptions type is properly accepted because it inherits the XlsxExportOptions class.

To customize the cell content and appearance individually for each cell, this example handles the PivotXlsxExportOptions.CustomizeCell event.

Default export type is data-aware. The resultant file is shown below.

To set the export type to WYSIWYG, this example uses the PivotGridExtension.ExportToXlsx method with the DevExpress.XtraPrinting.XlsxExportOptionsEx parameter whose ExportType property is set to the DevExpress.Export.ExportType.WYSIWYG value. The resultant file is shown below.

Export to PDF is performed using the PivotGridExtension.ExportToPdf method with the PivotGridSettings instance passed as the method parameter. The PivotGridSettings.SettingsExport.OptionsPrint property is used to specify page settings.

To customize the cell content and appearance individually for each cell, this example handles the PivotGridSettings.SettingsExport.CustomExportCell event.

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)