@progress/kendo-angular-excel-export
Version:
Kendo UI for Angular Excel Export component
46 lines (45 loc) • 1.56 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { IntlService, ExcelExporter, Workbook } from '@progress/kendo-ooxml';
import { toExporterColumns, destroyColumns } from './exporter-columns';
import { toString } from '@progress/kendo-intl';
IntlService.register({ toString });
/**
*
* @hidden
*/
export const workbookOptions = (options) => {
const columns = toExporterColumns(options.columns);
const exporter = new ExcelExporter({
columns: columns,
data: options.data,
filterable: options.filterable,
groups: options.group,
paddingCellOptions: options.paddingCellOptions,
headerPaddingCellOptions: options.headerPaddingCellOptions,
collapsible: options.collapsible,
hierarchy: options.hierarchy,
aggregates: options.aggregates
});
const result = exporter.workbook();
result.creator = options.creator;
result.date = options.date;
result.rtl = options.rtl;
destroyColumns(columns);
return result;
};
/**
* @hidden
*/
export const toDataURL = (options) => {
const workbook = new Workbook(options);
return workbook.toDataURL();
};
/**
* @hidden
*/
export const isWorkbookOptions = (value) => {
return value && value.sheets;
};