Back to Devexpress

DashboardDesigner.BeforeExportDocument Event

dashboard-devexpress-dot-dashboardwin-dot-dashboarddesigner-b47a7f09.md

latest5.2 KB
Original Source

DashboardDesigner.BeforeExportDocument Event

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

Namespace : DevExpress.DashboardWin

Assembly : DevExpress.Dashboard.v25.2.Win.dll

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public event BeforeExportDocumentEventHandler BeforeExportDocument
vb
Public Event BeforeExportDocument As BeforeExportDocumentEventHandler

Event Data

The BeforeExportDocument event's data class is BeforeExportDocumentEventArgs. The following properties provide information specific to this event:

PropertyDescription
ExcelExportOptionsGets options related to exporting a dashboard/dashboard item to XLSX/XLS/CSV format.
ExportActionGets the export action performed by an end-user.
ImageExportOptionsGets export options related to exporting a dashboard/dashboard item as an image.
PdfExportOptionsGets export options related to exporting a dashboard/dashboard item to PDF format.
PrintPreviewOptionsGets options related to printing a dashboard/dashboard item using the Print Preview window.

The event data class exposes the following methods:

MethodDescription
HideItem(Predicate<DashboardItem>)Hides the dashboard item matching the specified predicate in the exported dashboard.
HideItem(String)Hides the dashboard item with the specified name in the exported dashboard.

Remarks

The BeforeExportDocument event allows you to hide specific dashboard items from the printed or exported document using the BeforeExportDocumentEventArgs.HideItem method overloads. See the example below to learn how to do this.

Example

This example demonstrates how to hide dashboard filter items when a dashboard is exported to PDF and the ExportFilters export option is set to false.

This method can be the used to handle the following events:

csharp
using DevExpress.DashboardCommon;
// ...
        dashboardDesigner1.BeforeExportDocument += DashboardDesigner1_BeforeExportDocument;
// ...
    private void DashboardDesigner1_BeforeExportDocument(object sender, BeforeExportDocumentEventArgs e)
    {
        if (e.ExportAction == DashboardExportAction.ExportToPdf &&
            e.PdfExportOptions.ExportFilters == false)
        {
            e.HideItem(item => item is FilterElementDashboardItem ||
            item is DateFilterDashboardItem);
        }
    }
vb
Imports DevExpress.DashboardCommon
' ...
        AddHandler dashboardDesigner1.BeforeExportDocument, AddressOf DashboardDesigner1_BeforeExportDocument
' ...
    Private Sub DashboardDesigner1_BeforeExportDocument(ByVal sender As Object, ByVal e As BeforeExportDocumentEventArgs)
        If e.ExportAction = DashboardExportAction.ExportToPdf AndAlso e.PdfExportOptions.ExportFilters = False Then
            e.HideItem(Function(item) TypeOf item Is FilterElementDashboardItem OrElse TypeOf item Is DateFilterDashboardItem)
        End If
    End Sub

Implements

BeforeExportDocument

See Also

DashboardDesigner Class

DashboardDesigner Members

DevExpress.DashboardWin Namespace