import type { ExcelExportService as BaseExcelExportService, Column, ContainerService, ExcelExportOption, ExternalResource, FileType, GetDataValueCallback, GetGroupTotalValueCallback, GridOption, KeyTitlePair, Locale, PubSubService, SlickDataView, SlickGrid, TranslaterService } from '@slickgrid-universal/common'; import { Workbook, type ExcelColumnMetadata, type ExcelMetadata, type StyleSheet, type Worksheet } from 'excel-builder-vanilla'; import { type ExcelFormatter } from './excelUtils.js'; interface ExcelColumnExportCache { autoDetectCellFormat?: boolean; exportOptions: ExcelExportOption; fieldProperty: string; hasComplexSpanning: boolean; requiresFormatter: boolean; sanitizeDataExport: boolean; } export declare class ExcelExportService implements ExternalResource, BaseExcelExportService { protected _fileFormat: Extract; protected _grid: SlickGrid; protected _dataView: SlickDataView; protected _locales: Locale; protected _groupedColumnHeaders?: Array; protected _columnHeaders: Array; protected _hasColumnTitlePreHeader: boolean; protected _hasGroupedItems: boolean; protected _excelExportOptions: ExcelExportOption; protected _sheet: Worksheet; protected _stylesheet: StyleSheet; protected _stylesheetFormats: any; protected _pubSubService: PubSubService | null; protected _translaterService: TranslaterService | undefined; protected _workbook: Workbook; protected _timer1?: any; protected _timer2?: any; protected _regularCellExcelFormats: { [fieldId: string]: { excelFormatId?: number; getDataValueParser: GetDataValueCallback; }; }; protected _groupTotalExcelFormats: { [fieldId: string]: { groupType: string; excelFormat?: ExcelFormatter; getGroupTotalParser?: GetGroupTotalValueCallback; }; }; /** ExcelExportService class name which is use to find service instance in the external registered services */ readonly pluginName = "ExcelExportService"; protected get _datasetIdPropName(): string; /** Getter for the Grid Options pulled through the Grid Object */ protected get _gridOptions(): GridOption; get stylesheet(): StyleSheet; get stylesheetFormats(): any; get groupTotalExcelFormats(): any; get regularCellExcelFormats(): any; dispose(): void; /** * Initialize the Export Service * @param grid * @param containerService */ init(grid: SlickGrid, containerService: ContainerService): void; /** * Export the current grid data to Excel (WYSIWYG). * * Notes: * - Column order must match the grid. * - For large datasets, processing yields periodically to keep the UI responsive. * * Events: * - 'onBeforeExportToExcel' before export starts * - 'onAfterExportToExcel' after export completes or fails */ exportToExcel(options?: ExcelExportOption): Promise; /** * Takes a positive integer and returns the corresponding column name. * dealing with the Excel column position is a bit tricky since the first 26 columns are single char (A,B,...) but after that it becomes double char (AA,AB,...) * so we must first see if we are in the first section of 26 chars, if that is the case we just concatenate 1 (1st row) so it becomes (A1, B1, ...) * and again if we go 26, we need to add yet again an extra prefix (AA1, AB1, ...) and so goes the cycle * @param {number} colIndex - The positive integer to convert to a column name. * @return {string} The column name. */ getExcelColumnNameByIndex(colIndex: number): string; /** get columns might include hidden columns when `includeHidden` is enabled */ protected getColumns(): Column[]; /** * Async version of getDataOutput with yielding for UI responsiveness during large dataset processing */ protected getDataOutputAsync(): Promise>; /** Get each column style including a style for the width of each column */ protected getColumnStyles(columns: Column[]): any[]; /** * Get all Grouped Header Titles and their keys, translate the title when required, and format them in Bold * @param {Array} columns - grid column definitions * @param {Object} metadata - Excel metadata * @returns {Object} array of Excel cell format */ protected getColumnGroupedHeaderTitlesData(columns: Column[], metadata: ExcelMetadata): Array; /** Get all column headers and format them in Bold */ protected getColumnHeaderData(columns: Column[], metadata: ExcelMetadata): Array; protected getGroupColumnTitle(): string | null; /** * Get all Grouped Header Titles and their keys, translate the title when required. * @param {Array} columns of the grid */ protected getColumnGroupedHeaderTitles(columns: Column[]): Array; /** * Get all header titles and their keys, translate the title when required. * @param {Array} columns of the grid */ protected getColumnHeaders(columns: Column[]): Array | null; /** * Get all the grid row data and return that as an output string * Async version of pushAllGridRowDataToArray with yielding for UI responsiveness during large dataset processing. * Processes rows directly from DataView with periodic yielding for responsiveness. */ protected pushAllGridRowDataToArrayAsync(originalDaraArray: Array>, columns: Column[], columnMetadataCache?: Map): Promise>>; /** OPTIMIZATION: Pre-calculate column metadata to avoid repeated calculations */ protected preCalculateColumnMetadata(columns: Column[]): Map; /** OPTIMIZATION: Cache regular cell formatters once per column before processing all rows */ protected cacheRegularCellExcelFormats(columns: Column[], columnMetadataCache: Map): void; /** Fast path for non-formatter columns, mirrors raw-value behavior from formatter utilities. */ protected getRawCellValue(itemObj: any, fieldProperty: string): string | number | Date; /** OPTIMIZATION: Efficient yielding - use the fastest available method */ protected efficientYield(): Promise; /** * Get the data of a regular row (a row without grouping) * @param {Array} columns - column definitions * @param {Number} row - row index * @param {Object} itemObj - item datacontext object */ protected readRegularRowData(columns: Column[], row: number, itemObj: any, dataRowIdx: number, columnMetadataCache?: Map): string[]; /** * Get the grouped title(s) and its group title formatter, for example if we grouped by salesRep, the returned result would be:: 'Sales Rep: John Dow (2 items)' * @param itemObj */ protected readGroupedRowTitle(itemObj: any): string; /** * Get the grouped totals (below the regular rows), these are set by Slick Aggregators. * For example if we grouped by "salesRep" and we have a Sum Aggregator on "sales", then the returned output would be:: ["Sum 123$"] * @param itemObj */ protected readGroupedTotalRows(columns: Column[], itemObj: any, dataRowIdx: number): Array; /** Async version of legacy Excel export fallback method */ protected legacyExcelExportAsync(filename: string, mimeType: string, exportStartTime?: number): Promise; } export {}; //# sourceMappingURL=excelExport.service.d.ts.map