[]
        
(Showing Draft Content)

TabularDataExport

Namespace: TabularDataExport

Table of contents

Type aliases

Functions

Type aliases

CheckCancelCallback

Ƭ CheckCancelCallback: () => boolean

Type declaration

▸ (): boolean

Defines a callback that determines whether export should be canceled.

example

const shouldCancel: CheckCancelCallback = () => false;
Returns

boolean

true to cancel the export; otherwise, false.


CsvSettings

Ƭ CsvSettings: Object

Represents CSV export settings.

example

const settings: CsvSettings = {
	colSeparator: ',',
	rowSeparator: '\n',
	outputType: 'plain',
};

Type declaration

Name Type Description
colSeparator? string Gets or sets the column separator character.
outputType? "zip" | "plain" Gets or sets how CSV output is produced. remarks Accepted values: - 'zip': Export each table as a separate file in a ZIP archive. - 'plain': Combine all tables into a single CSV string.
quotationSymbol? string Gets or sets the quotation symbol.
rowSeparator? string Gets or sets the row separator character.
tableSeparator? string Gets or sets the table separator character.

OnProgressCallback

Ƭ OnProgressCallback: (pageNumber: number) => void

Type declaration

▸ (pageNumber): void

Defines a callback invoked after each page is rendered.

example

const onProgress: OnProgressCallback = (pageNumber) => console.log(pageNumber);
Parameters
Name Type Description
pageNumber number The one-based page number that has finished rendering.
Returns

void


TabularDataExportResult

Ƭ TabularDataExportResult: Object

Represents the result of a tabular data export.

example

const result: TabularDataExportResult = {
	data: 'a,b,c',
	download: (name) => console.log(name),
};

Type declaration

Name Type Description
data Blob | string Gets or sets the exported content. remarks Returns a string for 'plain' output and a Blob for 'zip' output.
download (filename?: string) => void Gets or sets the function that triggers a browser download of the export result. example ts const result = {} as TabularDataExportResult; result.download('data.csv');

TabularDataSettings

Ƭ TabularDataSettings: Object

Represents tabular data export settings.

example

const settings: TabularDataSettings = {
	format: 'csv',
	csvSettings: { outputType: 'plain' },
};

Type declaration

Name Type Description
csvSettings? CsvSettings Gets or sets CSV export settings.
format? "csv" Gets or sets the export format. remarks Accepted values: - 'csv'

Functions

exportDocument

exportDocument(source, settings?, onProgress?, checkCancel?): Promise<TabularDataExportResult>

Exports a PageDocument or VDomRenderer to tabular data format.

example

const result = await exportDocument(report, { format: 'csv' });
result.download('report.csv');

Parameters

Name Type Description
source PageDocument | VDomRenderer The source document or renderer to export.
settings? TabularDataSettings The tabular data export settings.
onProgress? OnProgressCallback The callback invoked after each page is rendered.
checkCancel? CheckCancelCallback The callback invoked before rendering each page. Return true to cancel.

Returns

Promise<TabularDataExportResult>

A promise that resolves to the export result.