Skip to main content
.NET Framework 4.5.2+

How to: Customize the Report Export Options

  • 2 minutes to read

This example demonstrates how to access the ExportOptions object, which stores the document export options for different formats. These options are applied when you export a report from a Report Viewer in both WinForms and ASP.NET Web Forms applications.


ASP.NET Core Blazor applications do not support the approach described in this topic.

In this topic, it is assumed that you have an XAF application that uses the Reports V2 Module, and you have created one or more reports (see Reports V2 Module Overview).

  • In the platform-agnostic module, declare the following helper class.

    using DevExpress.XtraPrinting;
    // ...
    public static class ExportConfigurator {
        public static void Setup(ExportOptions exportOptions) {
        private static void SetXlsOptions(XlsExportOptions xlsExportOptions) {
            // XLS-specific options: 
            xlsExportOptions.SheetName = "CustomXlsSheetTitle";
            xlsExportOptions.ShowGridLines = true;
        private static void SetPdfOptions(PdfExportOptions pdfExportOptions) {
            // PDF-specific options: 
            pdfExportOptions.DocumentOptions.Title = "CustomPdfTitle";
            pdfExportOptions.ImageQuality = PdfJpegImageQuality.Medium;
        private static void SetHtmlOptions(HtmlExportOptions htmlExportOptions) {
            // HTML-specific options: 
            htmlExportOptions.Title = "CustomHtmlTitle";
            htmlExportOptions.ExportMode = HtmlExportMode.SingleFilePageByPage;
            htmlExportOptions.PageBorderColor = System.Drawing.Color.Gray;
            htmlExportOptions.EmbedImagesInHTML = true;
  • In the Module.cs (Module.vb) file, override the ModuleBase.Setup method, find the ReportsModuleV2 instance using the static ReportsModuleV2.FindReportsModule method and subscribe to the ReportDataSourceHelper.BeforeShowPreview event.

    using DevExpress.ExpressApp.ReportsV2;
    // ...
    public override void Setup(ApplicationModulesManager moduleManager) {
        ReportsModuleV2 reportsModule = ReportsModuleV2.FindReportsModule(moduleManager.Modules);
        if(reportsModule != null) {
            reportsModule.ReportsDataSourceHelper.BeforeShowPreview += ReportsDataSourceHelper_BeforeShowPreview;
  • In the event handler, execute the ExportConfigurator.Setup static helper method implemented in the first step.

    private void ReportsDataSourceHelper_BeforeShowPreview(object sender, BeforeShowPreviewEventArgs e) {
See Also