Back to Devexpress

DashboardExportExtension Class

dashboard-js-devexpress-dot-dashboard-640f88c3.md

latest30.9 KB
Original Source

DashboardExportExtension Class

A Web Dashboard extension that allows you to export dashboards and dashboard items.

Declaration

ts
export class DashboardExportExtension implements ISupportOptionExtension<DashboardExportExtensionOptions>

Remarks

To configure the extension, refer to the DashboardExportExtensionOptions class that contains the Web Dashboard control’s export options.

See the following topic for information on how to use the DashboardControl’s client-side API: Extensions Overview.

The table below displays client-side API you can use to configure export options:

|

Export Type

|

DashboardExportExtension

|

DashboardExportExtensionOptions

| | --- | --- | --- | |

Common

|

DashboardExportExtension.allowExportDashboard

DashboardExportExtension.allowExportDashboardItems

DashboardExportExtension.showExportDashboardDialog

DashboardExportExtension.showExportDashboardItemDialog

|

DashboardExportExtensionOptions.allowExportDashboard

DashboardExportExtensionOptions.allowExportDashboardItems

DashboardExportExtensionOptions.onExportDialogHidden

DashboardExportExtensionOptions.onExportDialogShowing

DashboardExportExtensionOptions.onExportDialogShown

| |

Excel

|

DashboardExportExtension.getExcelExportOptions

DashboardExportExtension.setExcelExportOptions

DashboardExportExtension.exportToExcel

DashboardExportExtension.exportDashboardItemToExcel

|

DashboardExportExtensionOptions.excelExportOptions

| |

Pdf

|

DashboardExportExtension.getPdfExportOptions

DashboardExportExtension.setPdfExportOptions

DashboardExportExtension.exportToPdf

DashboardExportExtension.exportDashboardItemToPdf

|

DashboardExportExtensionOptions.pdfExportOptions

| |

Image

|

DashboardExportExtension.getImageExportOptions

DashboardExportExtension.setImageExportOptions

DashboardExportExtension.exportToImage

DashboardExportExtension.exportDashboardItemToImage

|

DashboardExportExtensionOptions.imageExportOptions

|

Implements

ISupportOptionExtension

constructor(dashboardControl)

Initializes a new instance of the DashboardExportExtension class.

Declaration

ts
constructor(
    dashboardControl: DevExpress.Dashboard.DashboardControl,
    options?: DashboardExportExtensionOptions
)

Parameters

NameTypeDescription
dashboardControlDashboardControl

A Web Dashboard control that owns the extension.

| | options | DashboardExportExtensionOptions |

A DashboardExportExtensionOptions object that contains the extension options.

|

Properties

allowExportDashboard Property

Specifies whether a user can export a dashboard.

Declaration

ts
get allowExportDashboard(): any
set allowExportDashboard(value: any)

Property Value

Type
any

Remarks

Use the allowExportDashboardItems property to allow or disallow the export of dashboard items.

allowExportDashboardItems Property

Specifies whether a user can export dashboard items.

Declaration

ts
get allowExportDashboardItems(): any
set allowExportDashboardItems(value: any)

Property Value

Type
any

Remarks

Use the allowExportDashboard property to allow or disallow the export of the entire dashboard.

name Property

Specifies the unique extension name.

Declaration

ts
name: string

Property Value

TypeDescription
string

The unique extension name. The return value is dashboardExport.

|

Remarks

Use the dashboardExport name in the following cases:

  • Call the DashboardControl.findExtension method and pass the extension name as a parameter to access the extension.
  • Call the control’s option method to change the extension options.

Warning

Do not change the unique name of the extension registered in the Web Dashboard to avoid exceptions.

off Property

Unsubscribes from the DashboardExportExtension’s events.

Declaration

ts
off: DevExpress.Dashboard.Internal.EventSubscriber<DashboardExportExtensionEvents>

Property Value

TypeDescription
EventSubscriber<DashboardExportExtensionEvents>

An event subscription.

|

on Property

Subscribes to DashboardExportExtension events.

Declaration

ts
on: DevExpress.Dashboard.Internal.EventSubscriber<DashboardExportExtensionEvents>

Property Value

TypeDescription
EventSubscriber<DashboardExportExtensionEvents>

An event subscription.

|

Remarks

The extension’s on and off methods help you subscribe to and unsubscribe from events.

Methods

exportDashboardItemToExcel(itemName) Method

Exports a dashboard item to an Excel file.

Declaration

ts
exportDashboardItemToExcel(
    itemName: string,
    options?: DevExpress.Dashboard.DashboardExcelExportOptions,
    fileName?: string
): void

Parameters

NameTypeDescription
itemNamestring

A string that is the component name of the dashboard item to be exported.

| | options | DashboardExcelExportOptions |

A DashboardExcelExportOptions object containing PDF-specific export options.

| | fileName | string |

A string that specifies the name of the exported file.

|

See Also

exportToExcel

exportToPdf

exportToImage

exportDashboardItemToPdf(itemName)

exportDashboardItemToImage(itemName)

exportDashboardItemToImage(itemName) Method

Exports a dashboard item to an image.

Declaration

ts
exportDashboardItemToImage(
    itemName: string,
    options?: DevExpress.Dashboard.DashboardImageExportOptions,
    fileName?: string
): void

Parameters

NameTypeDescription
itemNamestring

A string that is the component name of the dashboard item to be exported.

| | options | DashboardImageExportOptions |

A DashboardImageExportOptions object containing PDF-specific export options.

| | fileName | string |

A string that specifies the name of the exported file.

|

See Also

exportToExcel

exportToPdf

exportToImage

exportDashboardItemToExcel(itemName)

exportDashboardItemToPdf(itemName)

exportDashboardItemToPdf(itemName) Method

Exports a dashboard item to a PDF file.

Declaration

ts
exportDashboardItemToPdf(
    itemName: string,
    options?: DevExpress.Dashboard.DashboardPdfExportOptions,
    fileName?: string
): void

Parameters

NameTypeDescription
itemNamestring

A string that is the component name of the dashboard item to be exported.

| | options | DashboardPdfExportOptions |

A DashboardPdfExportOptions object containing PDF-specific export options.

| | fileName | string |

A string that specifies the name of the exported file.

|

See Also

exportToExcel

exportToPdf

exportToImage

exportDashboardItemToExcel(itemName)

exportDashboardItemToImage(itemName)

exportToExcel Method

Exports the entire dashboard to an Excel file.

Declaration

ts
exportToExcel(
    options?: DevExpress.Dashboard.DashboardExcelExportOptions,
    fileName?: string
): void

Parameters

NameTypeDescription
optionsDashboardExcelExportOptions

A DashboardExcelExportOptions object containing Excel-specific options.

| | fileName | string |

A string value that specifies the name of the exported file.

|

See Also

exportToPdf

exportToImage

exportDashboardItemToExcel(itemName)

exportDashboardItemToPdf(itemName)

exportDashboardItemToImage(itemName)

exportToImage Method

Exports the entire dashboard to an image.

Declaration

ts
exportToImage(
    options?: DevExpress.Dashboard.DashboardImageExportOptions,
    fileName?: string
): void

Parameters

NameTypeDescription
optionsDashboardImageExportOptions

A DashboardImageExportOptions object containing image-specific export options.

| | fileName | string |

A string that specifies the name of the exported file.

|

See Also

exportToExcel

exportToPdf

exportDashboardItemToExcel(itemName)

exportDashboardItemToPdf(itemName)

exportDashboardItemToImage(itemName)

exportToPdf Method

Exports the entire dashboard to a PDF file.

Declaration

ts
exportToPdf(
    options?: DevExpress.Dashboard.DashboardPdfExportOptions,
    fileName?: string
): void

Parameters

NameTypeDescription
optionsDashboardPdfExportOptions

A DashboardPdfExportOptions object containing PDF-specific export options.

| | fileName | string |

A string that specifies the name of the exported file.

|

See Also

exportToExcel

exportToImage

exportDashboardItemToExcel(itemName)

exportDashboardItemToPdf(itemName)

exportDashboardItemToImage(itemName)

getExcelExportOptions Method

Returns options related to exporting a dashboard/dashboard item to Excel format.

Declaration

ts
getExcelExportOptions(): DevExpress.Dashboard.DashboardExcelExportOptions

Returns

TypeDescription
DashboardExcelExportOptions

A DashboardExcelExportOptions object containing options related to exporting a dashboard item to Excel format.

|

Remarks

Use the getExcelExportOptions method to get the current excel export options instance. Configure the instance and use the DashboardExportExtension.setExcelExportOptions(options) method to reassign options:

typescript
var exportExtension = <DashboardExportExtension>this.dashboardControl.findExtension("dashboardExport");
var excelExportOptions = exportExtension.getExcelExportOptions();
excelExportOptions.Format = "Xlsx";
excelExportOptions.DashboardStatePosition = "SeparateSheet";
exportExtension.setExcelExportOptions(excelExportOptions);

this.dashboardControl.render();

Use the DashboardExportExtensionOptions.excelExportOptions property to configure Excel export options when you initialize a dashboard control instance.

getImageExportOptions Method

Returns options related to exporting a dashboard/dashboard item to the Image format.

Declaration

ts
getImageExportOptions(): DevExpress.Dashboard.DashboardImageExportOptions

Returns

TypeDescription
DashboardImageExportOptions

A DashboardImageExportOptions object containing options related to exporting a dashboard item to the Image format.

|

Remarks

Use the getImageExportOptions method to get the current image export options instance. Configure the instance and use the DashboardExportExtension.setImageExportOptions method to reassign options:

typescript
var exportExtension = <DashboardExportExtension>this.dashboardControl.findExtension("dashboardExport");
var imageExportOptions = exportExtension.getImageExportOptions();
imageExportOptions.Format = "Png";
imageExportOptions.FontInfo.UseCustomFontInfo = true;
imageExportOptions.FontInfo.Name = "Arial Black";
imageExportOptions.FontInfo.GdiCharSet = 1;
exportExtension.setImageExportOptions(imageExportOptions);

this.dashboardControl.render();

Use the DashboardExportExtensionOptions.imageExportOptions property to configure image export options when you initialize a dashboard control instance.

getPdfExportOptions Method

Returns options related to exporting a dashboard/dashboard item to PDF format.

Declaration

ts
getPdfExportOptions(): DevExpress.Dashboard.DashboardPdfExportOptions

Returns

TypeDescription
DashboardPdfExportOptions

A DashboardPdfExportOptions object containing options related to exporting a dashboard item to PDF format.

|

Remarks

Use the getPdfExportOptions method to get the current pdf export options instance. Configure the instance and use the DashboardExportExtension.setPdfExportOptions method to reassign options:

typescript
var exportExtension = <DashboardExportExtension>this.dashboardControl.findExtension("dashboardExport");
var pdfExportOptions = exportExtension.getPdfExportOptions();
pdfExportOptions.FontInfo.UseCustomFontInfo = true;
pdfExportOptions.FontInfo.Name = "Arial Black";
pdfExportOptions.FontInfo.GdiCharSet = 1;
exportExtension.setPdfExportOptions(pdfExportOptions);

this.dashboardControl.render();

Use the DashboardExportExtensionOptions.pdfExportOptions property to configure pdf export options when you initialize a dashboard control instance.

See Also

pdfExportOptions

setPdfExportOptions(options)

hideExportDialog Method

Hides the dialog that allows end-users to export the dashboard/dashboard item.

Declaration

ts
hideExportDialog(): void

Remarks

To show the export dialog for the dashboard/dashboard item, use the showExportDashboardDialog(format) and showExportDashboardItemDialog(itemComponentName, format) methods, respectively.

setExcelExportOptions(options) Method

Sets options related to exporting a dashboard/dashboard item to Excel format.

Declaration

ts
setExcelExportOptions(
    options: DevExpress.Dashboard.DashboardExcelExportOptions
): void

Parameters

NameTypeDescription
optionsDashboardExcelExportOptions

A DashboardExcelExportOptions object containing options related to exporting a dashboard item to Excel format.

|

Remarks

Use the DashboardExportExtension.getExcelExportOptions method to get the current Excel export options instance. Configure the instance and use the setExcelExportOptions method to reassign options:

typescript
var exportExtension = <DashboardExportExtension>this.dashboardControl.findExtension("dashboardExport");
var excelExportOptions = exportExtension.getExcelExportOptions();
excelExportOptions.Format = "Xlsx";
excelExportOptions.DashboardStatePosition = "SeparateSheet";
exportExtension.setExcelExportOptions(excelExportOptions);

this.dashboardControl.render();

Use the DashboardExportExtensionOptions.excelExportOptions property to configure Excel export options when you initialize a dashboard control instance.

setImageExportOptions(options) Method

Sets options related to exporting a dashboard/dashboard item to the Image format.

Declaration

ts
setImageExportOptions(
    options: DevExpress.Dashboard.DashboardImageExportOptions
): void

Parameters

NameTypeDescription
optionsDashboardImageExportOptions

A DashboardImageExportOptions object containing options related to exporting a dashboard item to the Image format.

|

Remarks

Use the DashboardExportExtension.getImageExportOptions method to get the current image export options instance. Configure the instance and use the setImageExportOptions method to reassign options:

typescript
var exportExtension = <DashboardExportExtension>this.dashboardControl.findExtension("dashboardExport");
var imageExportOptions = exportExtension.getImageExportOptions();
imageExportOptions.Format = "Png";
imageExportOptions.FontInfo.UseCustomFontInfo = true;
imageExportOptions.FontInfo.Name = "Arial Black";
imageExportOptions.FontInfo.GdiCharSet = 1;
exportExtension.setImageExportOptions(imageExportOptions);

this.dashboardControl.render();

Use the DashboardExportExtensionOptions.imageExportOptions property to configure image export options when you initialize a dashboard control instance.

setPdfExportOptions(options) Method

Sets options related to exporting a dashboard/dashboard item to PDF format.

Declaration

ts
setPdfExportOptions(
    options: DevExpress.Dashboard.DashboardPdfExportOptions
): void

Parameters

NameTypeDescription
optionsDashboardPdfExportOptions

A DashboardPdfExportOptions object containing options related to exporting a dashboard item to PDF format.

|

Remarks

Use the DashboardExportExtension.getPdfExportOptions method to get the current pdf export options instance. Configure the instance and use the setPdfExportOptions method to reassign options:

typescript
var exportExtension = <DashboardExportExtension>this.dashboardControl.findExtension("dashboardExport");
var pdfExportOptions = exportExtension.getPdfExportOptions();
pdfExportOptions.FontInfo.UseCustomFontInfo = true;
pdfExportOptions.FontInfo.Name = "Arial Black";
pdfExportOptions.FontInfo.GdiCharSet = 1;
exportExtension.setPdfExportOptions(pdfExportOptions);

this.dashboardControl.render();

Use the DashboardExportExtensionOptions.pdfExportOptions property to configure pdf export options when you initialize a dashboard control instance.

showExportDashboardDialog(format) Method

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

Declaration

ts
showExportDashboardDialog(
    format: DashboardExportFormat
): void

Parameters

NameTypeDescription
formatDashboardExportFormat

A DashboardExportFormat value that specifies the export format.

|

Remarks

Use the showExportDashboardItemDialog(itemComponentName, format) method to show the export dialog for the specified dashboard item. The hideExportDialog method allows you to hide the opened export dialog.

showExportDashboardItemDialog(itemComponentName, format) Method

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

Declaration

ts
showExportDashboardItemDialog(
    itemComponentName: string,
    format: DashboardExportFormat
): void

Parameters

NameTypeDescription
itemComponentNamestring

A string value that specifies the component name of the dashboard item to export.

| | format | DashboardExportFormat |

A DashboardExportFormat value that specifies the export format.

|

Remarks

Use the showExportDashboardDialog(format) method to show the export dialog for the entire dashboard. The hideExportDialog method allows you to hide the opened export dialog.

Warning

Note that some items (for example, Text Box or Image dashboard items) do not support exporting to the Excel format.

start Method

Contains code that is executed when you register the dashboard extension.

Declaration

ts
start(): void

stop Method

Contains code that is executed when you unregister the dashboard extension.

Declaration

ts
stop(): void