Manage Exporting Capabilities

The Web Dashboard allows end-users to export an entire dashboard or individual dashboard items.

Server-Side API

The ASP.NET MVC Dashboard extension's server-side API allows you to customize the default export options, customize export documents at runtime, etc. To export an entire dashboard or individual dashboard items, use members of the WebDashboardExporter class.

API Description
DashboardExtensionSettings.AllowExportDashboard

Gets or sets whether end-users can export a dashboard.

DashboardExtensionSettings.AllowExportDashboardItems

Gets or sets whether end-users can export dashboard items.

DashboardExtensionSettings.PdfExportOptions

Provides access to options related to exporting a dashboard/dashboard item to the PDF format.

DashboardExtensionSettings.ImageExportOptions

Provides access to options related to exporting a dashboard/dashboard item to an image.

DashboardExtensionSettings.ExcelExportOptions

Provides access to options related to exporting a dashboard item to the Excel format.

DashboardConfigurator.BeforeExportDocument

Allows you to hide specific dashboard items when exporting the entire dashboard.

DashboardConfigurator.CustomExport

Allows you to customize the exported document.

DashboardConfigurator.CustomizeExportDocument

Allows you to customize the exported document.

WebDashboardExporter.ExportDashboardItemToExcel

Exports the dashboard item to the specified stream in Excel format.

WebDashboardExporter.ExportDashboardItemToImage

Exports the dashboard item to the specified stream in Image format.

WebDashboardExporter.ExportDashboardItemToPdf

Exports the dashboard item to the specified stream in PDF format.

WebDashboardExporter.ExportToExcel

Exports a dashboard to the specified stream in Excel format.

WebDashboardExporter.ExportToImage

Exports a dashboard to the specified stream in Image format.

WebDashboardExporter.ExportToPdf

Exports a dashboard to the specified stream in PDF format.

How to: Add Custom Information to the Exported Dashboard at Runtime using the CustomExport Event

Client-Side API

You can use the MVC Dashboard extension's client-side API for exporting to various formats, customizing export options, etc.

API Description
ASPxClientDashboard.ExportToPdf

Exports a dashboard to a PDF file and writes it to the Response.

ASPxClientDashboard.ExportToImage

Exports a dashboard to an Image file and writes it to the Response.

ASPxClientDashboard.ExportToExcel

Exports dashboard data to the specified file in Excel format.

ASPxClientDashboard.ExportDashboardItemToPdf

Exports a dashboard item to a PDF file and writes it to the Response.

ASPxClientDashboard.ExportDashboardItemToImage

Exports a dashboard item to an Image file and writes it to the Response.

ASPxClientDashboard.ExportDashboardItemToExcel

Exports a dashboard item to an Excel file and writes it to the Response.

ASPxClientDashboard.GetPdfExportOptions

Allows you to obtain options related to exporting a dashboard/dashboard item to the PDF format.

ASPxClientDashboard.GetImageExportOptions

Allows you to obtain options related to exporting a dashboard/dashboard item to an image.

ASPxClientDashboard.GetExcelExportOptions

Allows you to obtain options related to exporting a dashboard/dashboard item to the Excel format.

ASPxClientDashboard.SetPdfExportOptions

Allows you to specify options related to exporting a dashboard/dashboard item to the PDF format.

ASPxClientDashboard.SetImageExportOptions

Allows you to specify options related to exporting a dashboard/dashboard item to an image.

ASPxClientDashboard.SetExcelExportOptions

Allows you to specify options related to exporting a dashboard/dashboard item to the Excel format.

ASPxClientDashboard.ShowExportDashboardDialog

Invokes the dialog that allows end-users to export the entire dashboard to the specified format.

ASPxClientDashboard.ShowExportDashboardItemDialog

Invokes the dialog that allows end-users to export the dashboard item to the specified format.

How to: Add Custom Information to the Exported Dashboard at Runtime using the CustomExport Event

Implement Server-Side Export

The WebDashboardExporter class allows you to implement server export for the ASP.NET MVC Dashboard extension and ASP.NET Core Dashboard control. You can specify a dashboard state and export options to be applied to the resulting document. Refer to the WebDashboardExporter class description for more information.

This example demonstrates how to export a dashboard displayed using the ASP.NET MVC Dashboard extension on the server side using the WebDashboardExporter class. The following API is used to implement this capability:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;

namespace MvcDashboard_ServerExport {
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication {
        protected void Application_Start() {
            DashboardConfig.RegisterService(RouteTable.Routes);
            AreaRegistration.RegisterAllAreas();

            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder();

            DevExpress.Web.ASPxWebControl.CallbackError += Application_Error;
        }

        protected void Application_Error(object sender, EventArgs e) {
            Exception exception = System.Web.HttpContext.Current.Server.GetLastError();
            //TODO: Handle Exception
        }
    }
}

See Also