@cj-tech-master/excelts 1.4.3 → 1.4.5-canary.20251212053535.13d32d8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/README_zh.md +3 -3
- package/dist/browser/excelts.iife.js +13026 -7610
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +87 -24
- package/dist/cjs/doc/anchor.js +25 -11
- package/dist/cjs/doc/cell.js +75 -43
- package/dist/cjs/doc/column.js +39 -16
- package/dist/cjs/doc/defined-names.js +53 -7
- package/dist/cjs/doc/image.js +11 -8
- package/dist/cjs/doc/range.js +64 -28
- package/dist/cjs/doc/row.js +33 -17
- package/dist/cjs/doc/table.js +3 -5
- package/dist/cjs/doc/workbook.js +5 -4
- package/dist/cjs/doc/worksheet.js +24 -20
- package/dist/cjs/stream/xlsx/workbook-writer.js +3 -2
- package/dist/cjs/utils/sheet-utils.js +3 -1
- package/dist/cjs/utils/unzip/extract.js +166 -0
- package/dist/cjs/utils/unzip/index.js +7 -1
- package/dist/cjs/utils/xml-stream.js +25 -3
- package/dist/cjs/utils/zip/compress.js +261 -0
- package/dist/cjs/utils/zip/crc32.js +154 -0
- package/dist/cjs/utils/zip/index.js +70 -0
- package/dist/cjs/utils/zip/zip-builder.js +378 -0
- package/dist/cjs/utils/zip-stream.js +30 -34
- package/dist/cjs/xlsx/xform/book/defined-name-xform.js +36 -2
- package/dist/cjs/xlsx/xform/list-xform.js +6 -0
- package/dist/cjs/xlsx/xform/sheet/cell-xform.js +6 -1
- package/dist/cjs/xlsx/xform/sheet/row-xform.js +24 -2
- package/dist/cjs/xlsx/xform/table/filter-column-xform.js +4 -0
- package/dist/esm/doc/anchor.js +25 -11
- package/dist/esm/doc/cell.js +75 -43
- package/dist/esm/doc/column.js +39 -16
- package/dist/esm/doc/defined-names.js +53 -7
- package/dist/esm/doc/image.js +11 -8
- package/dist/esm/doc/range.js +64 -28
- package/dist/esm/doc/row.js +33 -17
- package/dist/esm/doc/table.js +3 -5
- package/dist/esm/doc/workbook.js +5 -4
- package/dist/esm/doc/worksheet.js +24 -20
- package/dist/esm/stream/xlsx/workbook-writer.js +3 -2
- package/dist/esm/utils/sheet-utils.js +3 -1
- package/dist/esm/utils/unzip/extract.js +160 -0
- package/dist/esm/utils/unzip/index.js +2 -0
- package/dist/esm/utils/xml-stream.js +25 -3
- package/dist/esm/utils/zip/compress.js +220 -0
- package/dist/esm/utils/zip/crc32.js +116 -0
- package/dist/esm/utils/zip/index.js +55 -0
- package/dist/esm/utils/zip/zip-builder.js +372 -0
- package/dist/esm/utils/zip-stream.js +30 -34
- package/dist/esm/xlsx/xform/book/defined-name-xform.js +36 -2
- package/dist/esm/xlsx/xform/list-xform.js +6 -0
- package/dist/esm/xlsx/xform/sheet/cell-xform.js +6 -1
- package/dist/esm/xlsx/xform/sheet/row-xform.js +24 -2
- package/dist/esm/xlsx/xform/table/filter-column-xform.js +4 -0
- package/dist/types/doc/anchor.d.ts +14 -7
- package/dist/types/doc/cell.d.ts +85 -40
- package/dist/types/doc/column.d.ts +39 -34
- package/dist/types/doc/defined-names.d.ts +11 -8
- package/dist/types/doc/image.d.ts +29 -12
- package/dist/types/doc/pivot-table.d.ts +1 -1
- package/dist/types/doc/range.d.ts +15 -4
- package/dist/types/doc/row.d.ts +34 -40
- package/dist/types/doc/table.d.ts +21 -36
- package/dist/types/doc/workbook.d.ts +30 -33
- package/dist/types/doc/worksheet.d.ts +105 -80
- package/dist/types/stream/xlsx/worksheet-reader.d.ts +3 -5
- package/dist/types/types.d.ts +86 -26
- package/dist/types/utils/col-cache.d.ts +11 -8
- package/dist/types/utils/unzip/extract.d.ts +92 -0
- package/dist/types/utils/unzip/index.d.ts +1 -0
- package/dist/types/utils/xml-stream.d.ts +2 -0
- package/dist/types/utils/zip/compress.d.ts +83 -0
- package/dist/types/utils/zip/crc32.d.ts +55 -0
- package/dist/types/utils/zip/index.d.ts +52 -0
- package/dist/types/utils/zip/zip-builder.d.ts +110 -0
- package/dist/types/utils/zip-stream.d.ts +6 -12
- package/dist/types/xlsx/xform/list-xform.d.ts +1 -0
- package/dist/types/xlsx/xform/sheet/row-xform.d.ts +2 -0
- package/package.json +8 -8
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { Worksheet } from "./worksheet.js";
|
|
2
|
-
import { DefinedNames } from "./defined-names.js";
|
|
1
|
+
import { Worksheet, type WorksheetModel } from "./worksheet.js";
|
|
2
|
+
import { DefinedNames, type DefinedNameModel } from "./defined-names.js";
|
|
3
3
|
import { XLSX } from "../xlsx/xlsx.js";
|
|
4
4
|
import { CSV } from "../csv/csv.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import type { PivotTable } from "./pivot-table.js";
|
|
6
|
+
import type { AddWorksheetOptions, CalculationProperties, Image, WorkbookProperties, WorkbookView, Buffer as ExcelBuffer } from "../types.js";
|
|
7
|
+
interface WorkbookMedia {
|
|
8
|
+
type: string;
|
|
9
|
+
extension: string;
|
|
10
|
+
filename?: string;
|
|
11
|
+
buffer?: ExcelBuffer;
|
|
12
|
+
base64?: string;
|
|
13
|
+
name?: string;
|
|
10
14
|
}
|
|
11
15
|
interface WorkbookModel {
|
|
12
16
|
creator?: string;
|
|
@@ -14,11 +18,11 @@ interface WorkbookModel {
|
|
|
14
18
|
lastPrinted?: Date;
|
|
15
19
|
created: Date;
|
|
16
20
|
modified: Date;
|
|
17
|
-
properties:
|
|
21
|
+
properties: Partial<WorkbookProperties>;
|
|
18
22
|
worksheets: WorksheetModel[];
|
|
19
23
|
sheets?: WorksheetModel[];
|
|
20
|
-
definedNames:
|
|
21
|
-
views:
|
|
24
|
+
definedNames: DefinedNameModel[];
|
|
25
|
+
views: WorkbookView[];
|
|
22
26
|
company: string;
|
|
23
27
|
manager: string;
|
|
24
28
|
title: string;
|
|
@@ -29,17 +33,10 @@ interface WorkbookModel {
|
|
|
29
33
|
language?: string;
|
|
30
34
|
revision?: number;
|
|
31
35
|
contentStatus?: string;
|
|
32
|
-
themes?:
|
|
33
|
-
media:
|
|
34
|
-
pivotTables:
|
|
35
|
-
calcProperties:
|
|
36
|
-
}
|
|
37
|
-
interface AddWorksheetOptions {
|
|
38
|
-
properties?: any;
|
|
39
|
-
views?: any[];
|
|
40
|
-
pageSetup?: any;
|
|
41
|
-
headerFooter?: any;
|
|
42
|
-
[key: string]: any;
|
|
36
|
+
themes?: unknown;
|
|
37
|
+
media: WorkbookMedia[];
|
|
38
|
+
pivotTables: PivotTable[];
|
|
39
|
+
calcProperties: Partial<CalculationProperties>;
|
|
43
40
|
}
|
|
44
41
|
declare class Workbook {
|
|
45
42
|
category: string;
|
|
@@ -49,24 +46,24 @@ declare class Workbook {
|
|
|
49
46
|
keywords: string;
|
|
50
47
|
manager: string;
|
|
51
48
|
modified: Date;
|
|
52
|
-
properties:
|
|
53
|
-
calcProperties:
|
|
54
|
-
_worksheets
|
|
49
|
+
properties: Partial<WorkbookProperties>;
|
|
50
|
+
calcProperties: Partial<CalculationProperties>;
|
|
51
|
+
private _worksheets;
|
|
55
52
|
subject: string;
|
|
56
53
|
title: string;
|
|
57
|
-
views:
|
|
58
|
-
media:
|
|
59
|
-
pivotTables:
|
|
60
|
-
_definedNames
|
|
54
|
+
views: WorkbookView[];
|
|
55
|
+
media: WorkbookMedia[];
|
|
56
|
+
pivotTables: PivotTable[];
|
|
57
|
+
private _definedNames;
|
|
61
58
|
creator?: string;
|
|
62
59
|
lastModifiedBy?: string;
|
|
63
60
|
lastPrinted?: Date;
|
|
64
61
|
language?: string;
|
|
65
62
|
revision?: number;
|
|
66
63
|
contentStatus?: string;
|
|
67
|
-
_themes
|
|
68
|
-
_xlsx
|
|
69
|
-
_csv
|
|
64
|
+
private _themes?;
|
|
65
|
+
private _xlsx?;
|
|
66
|
+
private _csv?;
|
|
70
67
|
constructor();
|
|
71
68
|
get xlsx(): XLSX;
|
|
72
69
|
get csv(): CSV;
|
|
@@ -79,8 +76,8 @@ declare class Workbook {
|
|
|
79
76
|
eachSheet(iteratee: (sheet: Worksheet, id: number) => void): void;
|
|
80
77
|
get definedNames(): DefinedNames;
|
|
81
78
|
clearThemes(): void;
|
|
82
|
-
addImage(image:
|
|
83
|
-
getImage(id: number):
|
|
79
|
+
addImage(image: Image): number;
|
|
80
|
+
getImage(id: number | string): WorkbookMedia | undefined;
|
|
84
81
|
get model(): WorkbookModel;
|
|
85
82
|
set model(value: WorkbookModel);
|
|
86
83
|
}
|
|
@@ -1,19 +1,49 @@
|
|
|
1
|
-
import { Range } from "./range.js";
|
|
2
|
-
import { Row } from "./row.js";
|
|
3
|
-
import {
|
|
1
|
+
import { Range, type RangeInput } from "./range.js";
|
|
2
|
+
import { Row, type RowModel } from "./row.js";
|
|
3
|
+
import { Column, type ColumnModel, type ColumnDefn } from "./column.js";
|
|
4
|
+
import type { Cell, FormulaResult } from "./cell.js";
|
|
5
|
+
import { Image, type ImageModel } from "./image.js";
|
|
6
|
+
import { Table, type TableModel } from "./table.js";
|
|
4
7
|
import { DataValidations } from "./data-validations.js";
|
|
5
|
-
import type
|
|
8
|
+
import { type PivotTable, type PivotTableModel } from "./pivot-table.js";
|
|
9
|
+
import type { Workbook } from "./workbook.js";
|
|
10
|
+
import type { AddImageRange, AutoFilter, CellValue, ConditionalFormattingOptions, DataValidation, RowBreak, RowValues, TableProperties, WorksheetProperties, WorksheetView } from "../types.js";
|
|
11
|
+
type DataValidationModel = {
|
|
12
|
+
[address: string]: DataValidation | undefined;
|
|
13
|
+
};
|
|
14
|
+
interface SheetProtection {
|
|
15
|
+
sheet?: boolean;
|
|
16
|
+
objects?: boolean;
|
|
17
|
+
scenarios?: boolean;
|
|
18
|
+
selectLockedCells?: boolean;
|
|
19
|
+
selectUnlockedCells?: boolean;
|
|
20
|
+
formatCells?: boolean;
|
|
21
|
+
formatColumns?: boolean;
|
|
22
|
+
formatRows?: boolean;
|
|
23
|
+
insertColumns?: boolean;
|
|
24
|
+
insertRows?: boolean;
|
|
25
|
+
insertHyperlinks?: boolean;
|
|
26
|
+
deleteColumns?: boolean;
|
|
27
|
+
deleteRows?: boolean;
|
|
28
|
+
sort?: boolean;
|
|
29
|
+
autoFilter?: boolean;
|
|
30
|
+
pivotTables?: boolean;
|
|
31
|
+
algorithmName?: string;
|
|
32
|
+
hashValue?: string;
|
|
33
|
+
saltValue?: string;
|
|
34
|
+
spinCount?: number;
|
|
35
|
+
}
|
|
6
36
|
interface WorksheetOptions {
|
|
7
|
-
workbook?:
|
|
37
|
+
workbook?: Workbook;
|
|
8
38
|
id?: number;
|
|
9
39
|
orderNo?: number;
|
|
10
40
|
name?: string;
|
|
11
41
|
state?: string;
|
|
12
|
-
properties?:
|
|
13
|
-
pageSetup?:
|
|
14
|
-
headerFooter?:
|
|
15
|
-
views?:
|
|
16
|
-
autoFilter?:
|
|
42
|
+
properties?: Partial<WorksheetProperties>;
|
|
43
|
+
pageSetup?: Partial<PageSetup>;
|
|
44
|
+
headerFooter?: Partial<HeaderFooter>;
|
|
45
|
+
views?: Partial<WorksheetView>[];
|
|
46
|
+
autoFilter?: AutoFilter | null;
|
|
17
47
|
}
|
|
18
48
|
interface EachRowOptions {
|
|
19
49
|
includeEmpty?: boolean;
|
|
@@ -47,7 +77,6 @@ interface PageSetup {
|
|
|
47
77
|
horizontalCentered: boolean;
|
|
48
78
|
verticalCentered: boolean;
|
|
49
79
|
rowBreaks: RowBreak[];
|
|
50
|
-
colBreaks: any;
|
|
51
80
|
printTitlesRow?: string;
|
|
52
81
|
printTitlesColumn?: string;
|
|
53
82
|
}
|
|
@@ -64,117 +93,113 @@ interface HeaderFooter {
|
|
|
64
93
|
interface WorksheetModel {
|
|
65
94
|
id: number;
|
|
66
95
|
name: string;
|
|
67
|
-
dataValidations:
|
|
68
|
-
properties:
|
|
96
|
+
dataValidations: DataValidationModel;
|
|
97
|
+
properties: Partial<WorksheetProperties>;
|
|
69
98
|
state: string;
|
|
70
99
|
pageSetup: PageSetup;
|
|
71
100
|
headerFooter: HeaderFooter;
|
|
72
101
|
rowBreaks: RowBreak[];
|
|
73
|
-
views:
|
|
74
|
-
autoFilter:
|
|
75
|
-
media:
|
|
76
|
-
sheetProtection:
|
|
77
|
-
tables:
|
|
78
|
-
pivotTables:
|
|
79
|
-
conditionalFormattings:
|
|
80
|
-
cols?:
|
|
81
|
-
rows?:
|
|
102
|
+
views: Partial<WorksheetView>[];
|
|
103
|
+
autoFilter: AutoFilter | null;
|
|
104
|
+
media: ImageModel[];
|
|
105
|
+
sheetProtection: SheetProtection | null;
|
|
106
|
+
tables: TableModel[];
|
|
107
|
+
pivotTables: PivotTable[];
|
|
108
|
+
conditionalFormattings: ConditionalFormattingOptions[];
|
|
109
|
+
cols?: ColumnModel[];
|
|
110
|
+
rows?: RowModel[];
|
|
82
111
|
dimensions?: Range;
|
|
83
112
|
merges?: string[];
|
|
84
113
|
mergeCells?: string[];
|
|
85
114
|
}
|
|
86
115
|
declare class Worksheet {
|
|
87
|
-
_workbook
|
|
116
|
+
private _workbook;
|
|
88
117
|
id: number;
|
|
89
118
|
orderNo: number;
|
|
90
|
-
_name
|
|
119
|
+
private _name;
|
|
91
120
|
state: string;
|
|
92
|
-
_rows
|
|
93
|
-
_columns
|
|
94
|
-
_keys
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
[key: string]: Range;
|
|
99
|
-
};
|
|
100
|
-
rowBreaks: any[];
|
|
101
|
-
properties: any;
|
|
121
|
+
private _rows;
|
|
122
|
+
private _columns;
|
|
123
|
+
private _keys;
|
|
124
|
+
private _merges;
|
|
125
|
+
rowBreaks: RowBreak[];
|
|
126
|
+
properties: Partial<WorksheetProperties>;
|
|
102
127
|
pageSetup: PageSetup;
|
|
103
128
|
headerFooter: HeaderFooter;
|
|
104
129
|
dataValidations: DataValidations;
|
|
105
|
-
views:
|
|
106
|
-
autoFilter:
|
|
107
|
-
_media
|
|
108
|
-
sheetProtection:
|
|
130
|
+
views: Partial<WorksheetView>[];
|
|
131
|
+
autoFilter: AutoFilter | null;
|
|
132
|
+
private _media;
|
|
133
|
+
sheetProtection: SheetProtection | null;
|
|
109
134
|
tables: {
|
|
110
135
|
[key: string]: Table;
|
|
111
136
|
};
|
|
112
|
-
pivotTables:
|
|
113
|
-
conditionalFormattings:
|
|
114
|
-
_headerRowCount
|
|
137
|
+
pivotTables: PivotTable[];
|
|
138
|
+
conditionalFormattings: ConditionalFormattingOptions[];
|
|
139
|
+
private _headerRowCount?;
|
|
115
140
|
constructor(options: WorksheetOptions);
|
|
116
141
|
get name(): string;
|
|
117
142
|
set name(name: string | undefined);
|
|
118
|
-
get workbook():
|
|
143
|
+
get workbook(): Workbook;
|
|
119
144
|
destroy(): void;
|
|
120
145
|
get dimensions(): Range;
|
|
121
|
-
get columns():
|
|
122
|
-
set columns(value:
|
|
123
|
-
getColumnKey(key: string):
|
|
124
|
-
setColumnKey(key: string, value:
|
|
146
|
+
get columns(): Column[] | null;
|
|
147
|
+
set columns(value: ColumnDefn[]);
|
|
148
|
+
getColumnKey(key: string): Column | undefined;
|
|
149
|
+
setColumnKey(key: string, value: Column): void;
|
|
125
150
|
deleteColumnKey(key: string): void;
|
|
126
|
-
eachColumnKey(f: (column:
|
|
127
|
-
getColumn(c: string | number):
|
|
128
|
-
spliceColumns(start: number, count: number, ...inserts:
|
|
129
|
-
get lastColumn():
|
|
151
|
+
eachColumnKey(f: (column: Column, key: string) => void): void;
|
|
152
|
+
getColumn(c: string | number): Column;
|
|
153
|
+
spliceColumns(start: number, count: number, ...inserts: CellValue[][]): void;
|
|
154
|
+
get lastColumn(): Column;
|
|
130
155
|
get columnCount(): number;
|
|
131
156
|
get actualColumnCount(): number;
|
|
132
157
|
_commitRow(row: Row): void;
|
|
133
158
|
get _lastRowNumber(): number;
|
|
134
159
|
get _nextRow(): number;
|
|
135
|
-
get lastRow():
|
|
136
|
-
findRow(r: number):
|
|
137
|
-
findRows(start: number, length: number):
|
|
160
|
+
get lastRow(): Row | undefined;
|
|
161
|
+
findRow(r: number): Row | undefined;
|
|
162
|
+
findRows(start: number, length: number): (Row | undefined)[];
|
|
138
163
|
get rowCount(): number;
|
|
139
164
|
get actualRowCount(): number;
|
|
140
|
-
getRow(r: number):
|
|
141
|
-
getRows(start: number, length: number):
|
|
142
|
-
addRow(value:
|
|
143
|
-
addRows(value:
|
|
144
|
-
insertRow(pos: number, value:
|
|
145
|
-
insertRows(pos: number, values:
|
|
165
|
+
getRow(r: number): Row;
|
|
166
|
+
getRows(start: number, length: number): Row[] | undefined;
|
|
167
|
+
addRow(value: RowValues, style?: string): Row;
|
|
168
|
+
addRows(value: RowValues[], style?: string): Row[];
|
|
169
|
+
insertRow(pos: number, value: RowValues, style?: string): Row;
|
|
170
|
+
insertRows(pos: number, values: RowValues[], style?: string): Row[] | undefined;
|
|
146
171
|
_setStyleOption(pos: number, style?: string): void;
|
|
147
172
|
_copyStyle(src: number, dest: number, styleEmpty?: boolean): void;
|
|
148
173
|
duplicateRow(rowNum: number, count: number, insert?: boolean): void;
|
|
149
|
-
spliceRows(start: number, count: number, ...inserts:
|
|
150
|
-
eachRow(iteratee: (row:
|
|
151
|
-
eachRow(options: EachRowOptions, iteratee: (row:
|
|
152
|
-
getSheetValues():
|
|
153
|
-
findCell(r: number | string, c?: number):
|
|
154
|
-
getCell(r: number | string, c?: number):
|
|
155
|
-
mergeCells(...cells:
|
|
156
|
-
mergeCellsWithoutStyle(...cells:
|
|
174
|
+
spliceRows(start: number, count: number, ...inserts: RowValues[]): void;
|
|
175
|
+
eachRow(iteratee: (row: Row, rowNumber: number) => void): void;
|
|
176
|
+
eachRow(options: EachRowOptions, iteratee: (row: Row, rowNumber: number) => void): void;
|
|
177
|
+
getSheetValues(): CellValue[][];
|
|
178
|
+
findCell(r: number | string, c?: number): Cell | undefined;
|
|
179
|
+
getCell(r: number | string, c?: number): Cell;
|
|
180
|
+
mergeCells(...cells: RangeInput[]): void;
|
|
181
|
+
mergeCellsWithoutStyle(...cells: RangeInput[]): void;
|
|
157
182
|
_mergeCellsInternal(dimensions: Range, ignoreStyle?: boolean): void;
|
|
158
|
-
_unMergeMaster(master:
|
|
183
|
+
_unMergeMaster(master: Cell): void;
|
|
159
184
|
get hasMerges(): boolean;
|
|
160
|
-
unMergeCells(...cells:
|
|
161
|
-
fillFormula(range: string, formula: string, results?:
|
|
162
|
-
addImage(imageId: number, range:
|
|
163
|
-
getImages():
|
|
164
|
-
addBackgroundImage(imageId: number): void;
|
|
165
|
-
getBackgroundImageId():
|
|
166
|
-
protect(password?: string, options?:
|
|
185
|
+
unMergeCells(...cells: RangeInput[]): void;
|
|
186
|
+
fillFormula(range: string, formula: string, results?: FormulaResult[][] | FormulaResult[] | ((row: number, col: number) => FormulaResult | undefined), shareType?: string): void;
|
|
187
|
+
addImage(imageId: string | number, range: AddImageRange): void;
|
|
188
|
+
getImages(): Image[];
|
|
189
|
+
addBackgroundImage(imageId: string | number): void;
|
|
190
|
+
getBackgroundImageId(): string | undefined;
|
|
191
|
+
protect(password?: string, options?: Partial<SheetProtection>): Promise<void>;
|
|
167
192
|
unprotect(): void;
|
|
168
|
-
addTable(model:
|
|
193
|
+
addTable(model: TableProperties): Table;
|
|
169
194
|
getTable(name: string): Table;
|
|
170
195
|
removeTable(name: string): void;
|
|
171
196
|
getTables(): Table[];
|
|
172
|
-
addPivotTable(model:
|
|
173
|
-
addConditionalFormatting(cf:
|
|
174
|
-
removeConditionalFormatting(filter: number | ((value:
|
|
197
|
+
addPivotTable(model: PivotTableModel): PivotTable;
|
|
198
|
+
addConditionalFormatting(cf: ConditionalFormattingOptions): void;
|
|
199
|
+
removeConditionalFormatting(filter: number | ((value: ConditionalFormattingOptions, index: number, array: ConditionalFormattingOptions[]) => boolean)): void;
|
|
175
200
|
get model(): WorksheetModel;
|
|
176
201
|
_parseRows(model: WorksheetModel): void;
|
|
177
202
|
_parseMergeCells(model: WorksheetModel): void;
|
|
178
203
|
set model(value: WorksheetModel);
|
|
179
204
|
}
|
|
180
|
-
export { Worksheet };
|
|
205
|
+
export { Worksheet, type WorksheetModel };
|
|
@@ -12,11 +12,9 @@ declare class WorksheetReader extends EventEmitter {
|
|
|
12
12
|
options: any;
|
|
13
13
|
name: string;
|
|
14
14
|
state?: string;
|
|
15
|
-
_columns
|
|
16
|
-
_keys
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
_dimensions: any;
|
|
15
|
+
private _columns;
|
|
16
|
+
private _keys;
|
|
17
|
+
private _dimensions;
|
|
20
18
|
hyperlinks?: {
|
|
21
19
|
[key: string]: any;
|
|
22
20
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Type definitions for ExcelTS
|
|
3
3
|
* This file exports all public types used by the library
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
export type Buffer = ArrayBuffer;
|
|
5
|
+
export type Buffer = Uint8Array;
|
|
7
6
|
export declare enum PaperSize {
|
|
8
7
|
Legal = 5,
|
|
9
8
|
Executive = 7,
|
|
@@ -92,14 +91,26 @@ export interface FillGradientPath {
|
|
|
92
91
|
stops: GradientStop[];
|
|
93
92
|
}
|
|
94
93
|
export type Fill = FillPattern | FillGradientAngle | FillGradientPath;
|
|
95
|
-
export interface
|
|
96
|
-
|
|
94
|
+
export interface NumFmt {
|
|
95
|
+
id: number;
|
|
96
|
+
formatCode: string;
|
|
97
|
+
}
|
|
98
|
+
interface StyleBase {
|
|
97
99
|
font: Partial<Font>;
|
|
98
100
|
alignment: Partial<Alignment>;
|
|
99
101
|
protection: Partial<Protection>;
|
|
100
102
|
border: Partial<Borders>;
|
|
101
103
|
fill: Fill;
|
|
102
104
|
}
|
|
105
|
+
export interface StyleInput extends StyleBase {
|
|
106
|
+
numFmt: string;
|
|
107
|
+
}
|
|
108
|
+
export interface StyleOutput extends StyleBase {
|
|
109
|
+
numFmt: NumFmt;
|
|
110
|
+
}
|
|
111
|
+
export interface Style extends StyleBase {
|
|
112
|
+
numFmt: string | NumFmt;
|
|
113
|
+
}
|
|
103
114
|
export interface Margins {
|
|
104
115
|
top: number;
|
|
105
116
|
left: number;
|
|
@@ -143,13 +154,13 @@ export interface HeaderFooter {
|
|
|
143
154
|
firstFooter: string;
|
|
144
155
|
}
|
|
145
156
|
export interface WorksheetViewCommon {
|
|
146
|
-
rightToLeft
|
|
147
|
-
activeCell
|
|
148
|
-
showRuler
|
|
149
|
-
showRowColHeaders
|
|
150
|
-
showGridLines
|
|
151
|
-
zoomScale
|
|
152
|
-
zoomScaleNormal
|
|
157
|
+
rightToLeft?: boolean;
|
|
158
|
+
activeCell?: string;
|
|
159
|
+
showRuler?: boolean;
|
|
160
|
+
showRowColHeaders?: boolean;
|
|
161
|
+
showGridLines?: boolean;
|
|
162
|
+
zoomScale?: number;
|
|
163
|
+
zoomScaleNormal?: number;
|
|
153
164
|
}
|
|
154
165
|
export interface WorksheetViewNormal {
|
|
155
166
|
state: "normal";
|
|
@@ -248,13 +259,22 @@ export interface CellFormulaValue {
|
|
|
248
259
|
result?: number | string | boolean | Date | CellErrorValue;
|
|
249
260
|
date1904?: boolean;
|
|
250
261
|
}
|
|
262
|
+
/** Array formula that spans multiple cells */
|
|
263
|
+
export interface CellArrayFormulaValue {
|
|
264
|
+
formula: string;
|
|
265
|
+
result?: number | string | boolean | Date | CellErrorValue;
|
|
266
|
+
/** Must be "array" for array formulas */
|
|
267
|
+
shareType: "array";
|
|
268
|
+
/** The range this array formula applies to, e.g. "A1:B2" */
|
|
269
|
+
ref: string;
|
|
270
|
+
}
|
|
251
271
|
export interface CellSharedFormulaValue {
|
|
252
272
|
sharedFormula: string;
|
|
253
273
|
readonly formula?: string;
|
|
254
274
|
result?: number | string | boolean | Date | CellErrorValue;
|
|
255
275
|
date1904?: boolean;
|
|
256
276
|
}
|
|
257
|
-
export type CellValue = null | number | string | boolean | Date | undefined | CellErrorValue | CellRichTextValue | CellHyperlinkValue | CellFormulaValue | CellSharedFormulaValue;
|
|
277
|
+
export type CellValue = null | number | string | boolean | Date | undefined | CellErrorValue | CellRichTextValue | CellHyperlinkValue | CellFormulaValue | CellArrayFormulaValue | CellSharedFormulaValue;
|
|
258
278
|
export interface CommentMargins {
|
|
259
279
|
insetmode: "auto" | "custom";
|
|
260
280
|
inset: number[];
|
|
@@ -271,11 +291,9 @@ export interface Comment {
|
|
|
271
291
|
editAs?: CommentEditAs;
|
|
272
292
|
}
|
|
273
293
|
export type DataValidationOperator = "between" | "notBetween" | "equal" | "notEqual" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
formulae: any[];
|
|
294
|
+
/** Base properties shared by all data validation types */
|
|
295
|
+
interface DataValidationBase {
|
|
277
296
|
allowBlank?: boolean;
|
|
278
|
-
operator?: DataValidationOperator;
|
|
279
297
|
error?: string;
|
|
280
298
|
errorTitle?: string;
|
|
281
299
|
errorStyle?: string;
|
|
@@ -284,16 +302,23 @@ export interface DataValidation {
|
|
|
284
302
|
showErrorMessage?: boolean;
|
|
285
303
|
showInputMessage?: boolean;
|
|
286
304
|
}
|
|
305
|
+
/** Data validation that requires formulae and operator */
|
|
306
|
+
export interface DataValidationWithFormulae extends DataValidationBase {
|
|
307
|
+
type: "list" | "whole" | "decimal" | "date" | "textLength" | "custom";
|
|
308
|
+
formulae: any[];
|
|
309
|
+
operator?: DataValidationOperator;
|
|
310
|
+
}
|
|
311
|
+
/** Data validation type 'any' - no formulae needed */
|
|
312
|
+
export interface DataValidationAny extends DataValidationBase {
|
|
313
|
+
type: "any";
|
|
314
|
+
}
|
|
315
|
+
export type DataValidation = DataValidationWithFormulae | DataValidationAny;
|
|
287
316
|
export interface Image {
|
|
288
317
|
extension: "jpeg" | "png" | "gif";
|
|
289
318
|
base64?: string;
|
|
290
319
|
filename?: string;
|
|
291
320
|
buffer?: Buffer;
|
|
292
321
|
}
|
|
293
|
-
export interface ImageRange {
|
|
294
|
-
tl: IAnchor;
|
|
295
|
-
br: IAnchor;
|
|
296
|
-
}
|
|
297
322
|
export interface ImagePosition {
|
|
298
323
|
tl: {
|
|
299
324
|
col: number;
|
|
@@ -304,6 +329,34 @@ export interface ImagePosition {
|
|
|
304
329
|
height: number;
|
|
305
330
|
};
|
|
306
331
|
}
|
|
332
|
+
/** Anchor position for image placement */
|
|
333
|
+
export interface ImageAnchor {
|
|
334
|
+
col: number;
|
|
335
|
+
row: number;
|
|
336
|
+
nativeCol?: number;
|
|
337
|
+
nativeRow?: number;
|
|
338
|
+
nativeColOff?: number;
|
|
339
|
+
nativeRowOff?: number;
|
|
340
|
+
}
|
|
341
|
+
/** Range input for addImage - can be a string like "A1:B2" or an object */
|
|
342
|
+
export type AddImageRange = string | {
|
|
343
|
+
/** Top-left anchor position */
|
|
344
|
+
tl: ImageAnchor | string;
|
|
345
|
+
/** Bottom-right anchor position (optional if ext is provided) */
|
|
346
|
+
br?: ImageAnchor | string;
|
|
347
|
+
/** Image dimensions (alternative to br) */
|
|
348
|
+
ext?: {
|
|
349
|
+
width: number;
|
|
350
|
+
height: number;
|
|
351
|
+
};
|
|
352
|
+
/** How the image behaves when cells are resized */
|
|
353
|
+
editAs?: "oneCell" | "twoCell" | "absolute";
|
|
354
|
+
/** Hyperlink for the image */
|
|
355
|
+
hyperlinks?: {
|
|
356
|
+
hyperlink?: string;
|
|
357
|
+
tooltip?: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
307
360
|
export interface ImageHyperlinkValue {
|
|
308
361
|
hyperlink: string;
|
|
309
362
|
tooltip?: string;
|
|
@@ -319,7 +372,7 @@ export type Address = {
|
|
|
319
372
|
address: string;
|
|
320
373
|
col: number;
|
|
321
374
|
row: number;
|
|
322
|
-
$col$row
|
|
375
|
+
$col$row?: string;
|
|
323
376
|
};
|
|
324
377
|
export type RowValues = CellValue[] | {
|
|
325
378
|
[key: string]: CellValue;
|
|
@@ -331,10 +384,10 @@ export type IconSetTypes = "5Arrows" | "5ArrowsGray" | "5Boxes" | "5Quarters" |
|
|
|
331
384
|
export type CfvoTypes = "percentile" | "percent" | "num" | "min" | "max" | "formula" | "autoMin" | "autoMax";
|
|
332
385
|
export interface Cvfo {
|
|
333
386
|
type: CfvoTypes;
|
|
334
|
-
value?: number;
|
|
387
|
+
value?: number | string;
|
|
335
388
|
}
|
|
336
389
|
export interface ConditionalFormattingBaseRule {
|
|
337
|
-
priority
|
|
390
|
+
priority?: number;
|
|
338
391
|
style?: Partial<Style>;
|
|
339
392
|
}
|
|
340
393
|
export interface ExpressionRuleType extends ConditionalFormattingBaseRule {
|
|
@@ -350,11 +403,11 @@ export interface Top10RuleType extends ConditionalFormattingBaseRule {
|
|
|
350
403
|
type: "top10";
|
|
351
404
|
rank: number;
|
|
352
405
|
percent: boolean;
|
|
353
|
-
bottom
|
|
406
|
+
bottom?: boolean;
|
|
354
407
|
}
|
|
355
408
|
export interface AboveAverageRuleType extends ConditionalFormattingBaseRule {
|
|
356
409
|
type: "aboveAverage";
|
|
357
|
-
aboveAverage
|
|
410
|
+
aboveAverage?: boolean;
|
|
358
411
|
}
|
|
359
412
|
export interface ColorScaleRuleType extends ConditionalFormattingBaseRule {
|
|
360
413
|
type: "colorScale";
|
|
@@ -390,12 +443,17 @@ export interface DataBarRuleType extends ConditionalFormattingBaseRule {
|
|
|
390
443
|
axisPosition?: "auto" | "middle" | "none";
|
|
391
444
|
direction?: "context" | "leftToRight" | "rightToLeft";
|
|
392
445
|
cfvo?: Cvfo[];
|
|
446
|
+
color?: Partial<Color>;
|
|
393
447
|
}
|
|
394
448
|
export type ConditionalFormattingRule = ExpressionRuleType | CellIsRuleType | Top10RuleType | AboveAverageRuleType | ColorScaleRuleType | IconSetRuleType | ContainsTextRuleType | TimePeriodRuleType | DataBarRuleType;
|
|
395
449
|
export interface ConditionalFormattingOptions {
|
|
396
450
|
ref: string;
|
|
397
451
|
rules: ConditionalFormattingRule[];
|
|
398
452
|
}
|
|
453
|
+
export interface ConditionalFormattingOptions {
|
|
454
|
+
ref: string;
|
|
455
|
+
rules: ConditionalFormattingRule[];
|
|
456
|
+
}
|
|
399
457
|
export interface TableStyleProperties {
|
|
400
458
|
theme?: string;
|
|
401
459
|
showFirstColumn?: boolean;
|
|
@@ -409,6 +467,7 @@ export interface TableColumnProperties {
|
|
|
409
467
|
totalsRowLabel?: string;
|
|
410
468
|
totalsRowFunction?: "none" | "average" | "countNums" | "count" | "max" | "min" | "stdDev" | "var" | "sum" | "custom";
|
|
411
469
|
totalsRowFormula?: string;
|
|
470
|
+
totalsRowResult?: CellFormulaValue["result"];
|
|
412
471
|
style?: Partial<Style>;
|
|
413
472
|
}
|
|
414
473
|
export interface TableProperties {
|
|
@@ -459,6 +518,7 @@ export type DefinedNamesModel = DefinedNamesRanges[];
|
|
|
459
518
|
export interface RowBreak {
|
|
460
519
|
id: number;
|
|
461
520
|
max: number;
|
|
462
|
-
min
|
|
521
|
+
min?: number;
|
|
463
522
|
man: number;
|
|
464
523
|
}
|
|
524
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Address, Location } from "../types.js";
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type CachedAddress = Address & {
|
|
3
|
+
$col$row: string;
|
|
4
|
+
};
|
|
5
|
+
export type DecodedRange = Location & {
|
|
6
|
+
tl: string | CachedAddress;
|
|
7
|
+
br: string | CachedAddress;
|
|
5
8
|
dimensions: string;
|
|
6
9
|
sheetName?: string;
|
|
7
10
|
};
|
|
@@ -9,21 +12,21 @@ interface ErrorReference {
|
|
|
9
12
|
error: string;
|
|
10
13
|
sheetName?: string;
|
|
11
14
|
}
|
|
12
|
-
type DecodeExResult =
|
|
15
|
+
type DecodeExResult = CachedAddress | DecodedRange | ErrorReference;
|
|
13
16
|
interface ColCache {
|
|
14
17
|
_dictionary: string[];
|
|
15
18
|
_l2nFill: number;
|
|
16
19
|
_l2n: Record<string, number>;
|
|
17
20
|
_n2l: string[];
|
|
18
|
-
_hash: Record<string,
|
|
21
|
+
_hash: Record<string, CachedAddress>;
|
|
19
22
|
_level(n: number): number;
|
|
20
23
|
_fill(level: number): void;
|
|
21
24
|
l2n(l: string): number;
|
|
22
25
|
n2l(n: number): string;
|
|
23
26
|
validateAddress(value: string): boolean;
|
|
24
|
-
decodeAddress(value: string):
|
|
25
|
-
getAddress(r: number | string, c?: number):
|
|
26
|
-
decode(value: string):
|
|
27
|
+
decodeAddress(value: string): CachedAddress;
|
|
28
|
+
getAddress(r: number | string, c?: number): CachedAddress;
|
|
29
|
+
decode(value: string): CachedAddress | DecodedRange;
|
|
27
30
|
decodeEx(value: string): DecodeExResult;
|
|
28
31
|
encodeAddress(row: number, col: number): string;
|
|
29
32
|
encode(...args: number[]): string;
|