Manage Exporting Capabilities
- 4 minutes to read
The Web Dashboard allows end-users to export an entire dashboard or individual dashboard items.
Server-Side API
The ASP.NET Core Dashboard control’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 |
---|---|
DashboardExportOptionBuilder.AllowExportDashboard | Specifies whether end-users can export a dashboard. |
DashboardExportOptionBuilder.AllowExportDashboardItems | Specifies whether the dashboard items can be exported by end-users. |
DashboardExportOptionBuilder.PdfExportOptions | Contains options which define how the dashboard item is exported to the PDF format. |
DashboardExportOptionBuilder.ImageExportOptions | Contains options which define how the dashboard item is exported to the Image format. |
DashboardExportOptionBuilder.ExcelExportOptions | Contains options which define how the dashboard item is exported to the Excel format. |
DashboardExportOptionBuilder.OnExportDialogHidden | A handler for the event occurring when the export dialog is hidden. |
DashboardExportOptionBuilder.OnExportDialogShowing | A handler for the event occurring before the export dialog is shown. |
DashboardExportOptionBuilder.OnExportDialogShown | A handler for the event occurring after the export dialog is shown. |
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. |
Client-Side API
You can use the Web Dashboard’s client-side API for exporting to various formats, customizing export options, etc.
API | Description |
---|---|
DashboardExportExtension.exportToPdf | Exports the entire dashboard to a PDF file. |
DashboardExportExtension.exportToImage | Exports the entire dashboard to an image. |
DashboardExportExtension.exportToExcel | Exports the entire dashboard to an Excel file. |
DashboardExportExtension.exportDashboardItemToPdf | Exports a dashboard item to a PDF file. |
DashboardExportExtension.exportDashboardItemToImage | Exports a dashboard item to an image. |
DashboardExportExtension.exportDashboardItemToExcel | Exports a dashboard item to an Excel file. |
DashboardExportExtension.getPdfExportOptions | Returns options related to exporting a dashboard/dashboard item to the PDF format. |
DashboardExportExtension.getImageExportOptions | Returns options related to exporting a dashboard/dashboard item to the Image format. |
DashboardExportExtension.getExcelExportOptions | Returns options related to exporting a dashboard/dashboard item to the Excel format. |
DashboardExportExtension.setPdfExportOptions | Sets options related to exporting a dashboard/dashboard item to the PDF format. |
DashboardExportExtension.setImageExportOptions | Sets options related to exporting a dashboard/dashboard item to the Image format. |
DashboardExportExtension.setExcelExportOptions | Sets options related to exporting a dashboard/dashboard item to the Excel format. |
DashboardExportExtension.showExportDashboardDialog | Invokes the dialog that allows end-users to export the entire dashboard to the specified format. |
DashboardExportExtension.showExportDashboardItemDialog | Invokes the dialog that allows end users to export the dashboard item to the specified format. |
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.
Exporting Specifics
The ASP.NET Core Dashboard has the following exporting specifics:
Compatibility Mode
If the dashboard or specific dashboard items are exported to PDF or image formats, their content is saved to the Windows Metafile format, which is not supported by .NET Core. To overcome this limitation, set the DashboardExportSettings.CompatibilityMode property to DashboardExportCompatibilityMode.Restricted at the application startup.
using DevExpress.DashboardCommon;
// ...
public Startup(IConfiguration configuration, IHostingEnvironment hostingEnvironment) {
Configuration = configuration;
FileProvider = hostingEnvironment.ContentRootFileProvider;
DashboardExportSettings.CompatibilityMode = DashboardExportCompatibilityMode.Restricted;
}
In this case, images from the corresponding exported documents will be always rendered as bitmaps.
Docker Support
Refer to the Visual Studio Tools for Docker with ASP.NET Core tutorial for instructions on how to dockerize (add to a Docker container) your ASP.NET Core Web Dashboard application.
Add the following changes in the Dockerfile when you add the application to a Linux container:
...
FROM microsoft/aspnetcore:2.1 AS base
RUN apt-get update
RUN apt-get install -y libgdiplus libc6-dev
...
Libgdiplus is a library that provides a GDI+-compatible API on non-Windows operating systems and is necessary for export in .NET Core.
Export to Image
Export to image is disabled for .NET Core because of some problems in the Libgdiplus library. See T685212 and T685811 for more information.