tinyweb-office-cells 1.0.0
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/LICENSE +21 -0
- package/README.md +615 -0
- package/dist/index.d.mts +2084 -0
- package/dist/index.d.ts +2084 -0
- package/dist/index.js +8874 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8868 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +78 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2084 @@
|
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Aspose.Cells for Node.js - Style Module
|
|
5
|
+
*
|
|
6
|
+
* Provides classes for cell styling: Font, Fill, Border, Borders,
|
|
7
|
+
* Alignment, NumberFormat, Protection, and Style.
|
|
8
|
+
*
|
|
9
|
+
* Compatible with Aspose.Cells for .NET API structure.
|
|
10
|
+
*/
|
|
11
|
+
interface FontOptions {
|
|
12
|
+
name?: string;
|
|
13
|
+
size?: number;
|
|
14
|
+
color?: string;
|
|
15
|
+
bold?: boolean;
|
|
16
|
+
italic?: boolean;
|
|
17
|
+
underline?: boolean;
|
|
18
|
+
strikethrough?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents font settings for a cell or range of cells.
|
|
22
|
+
*/
|
|
23
|
+
declare class Font {
|
|
24
|
+
name: string;
|
|
25
|
+
size: number;
|
|
26
|
+
color: string;
|
|
27
|
+
bold: boolean;
|
|
28
|
+
italic: boolean;
|
|
29
|
+
underline: boolean;
|
|
30
|
+
strikethrough: boolean;
|
|
31
|
+
constructor(options?: FontOptions);
|
|
32
|
+
/** .NET-style alias: snake_case getter */
|
|
33
|
+
get is_bold(): boolean;
|
|
34
|
+
set is_bold(v: boolean);
|
|
35
|
+
/** .NET-style alias: camelCase getter */
|
|
36
|
+
get isBold(): boolean;
|
|
37
|
+
set isBold(v: boolean);
|
|
38
|
+
get is_italic(): boolean;
|
|
39
|
+
set is_italic(v: boolean);
|
|
40
|
+
get isItalic(): boolean;
|
|
41
|
+
set isItalic(v: boolean);
|
|
42
|
+
}
|
|
43
|
+
interface FillOptions {
|
|
44
|
+
patternType?: string;
|
|
45
|
+
foregroundColor?: string;
|
|
46
|
+
backgroundColor?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents fill settings for a cell or range of cells.
|
|
50
|
+
*/
|
|
51
|
+
declare class Fill {
|
|
52
|
+
patternType: string;
|
|
53
|
+
foregroundColor: string;
|
|
54
|
+
backgroundColor: string;
|
|
55
|
+
constructor(options?: FillOptions);
|
|
56
|
+
get pattern_type(): string;
|
|
57
|
+
set pattern_type(v: string);
|
|
58
|
+
get foreground_color(): string;
|
|
59
|
+
set foreground_color(v: string);
|
|
60
|
+
get background_color(): string;
|
|
61
|
+
set background_color(v: string);
|
|
62
|
+
/** Sets a solid fill pattern with specified color. */
|
|
63
|
+
setSolidFill(color: string): void;
|
|
64
|
+
/** snake_case alias */
|
|
65
|
+
set_solid_fill(color: string): void;
|
|
66
|
+
/** Sets a gradient fill (simplified as solid). */
|
|
67
|
+
setGradientFill(startColor: string, endColor: string): void;
|
|
68
|
+
set_gradient_fill(startColor: string, endColor: string): void;
|
|
69
|
+
/** Sets a pattern fill with specified pattern type and colors. */
|
|
70
|
+
setPatternFill(patternType: string, fgColor?: string, bgColor?: string): void;
|
|
71
|
+
set_pattern_fill(patternType: string, fgColor?: string, bgColor?: string): void;
|
|
72
|
+
/** Sets no fill (transparent background). */
|
|
73
|
+
setNoFill(): void;
|
|
74
|
+
set_no_fill(): void;
|
|
75
|
+
}
|
|
76
|
+
interface BorderOptions {
|
|
77
|
+
lineStyle?: string;
|
|
78
|
+
color?: string;
|
|
79
|
+
weight?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Represents border settings for a single side of a cell.
|
|
83
|
+
*/
|
|
84
|
+
declare class Border {
|
|
85
|
+
lineStyle: string;
|
|
86
|
+
color: string;
|
|
87
|
+
weight: number;
|
|
88
|
+
constructor(options?: BorderOptions);
|
|
89
|
+
get line_style(): string;
|
|
90
|
+
set line_style(v: string);
|
|
91
|
+
}
|
|
92
|
+
declare enum BorderType {
|
|
93
|
+
TopBorder = "top",
|
|
94
|
+
BottomBorder = "bottom",
|
|
95
|
+
LeftBorder = "left",
|
|
96
|
+
RightBorder = "right",
|
|
97
|
+
DiagonalUp = "diagonalUp",
|
|
98
|
+
DiagonalDown = "diagonalDown"
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Represents border settings for all sides of a cell.
|
|
102
|
+
*/
|
|
103
|
+
declare class Borders {
|
|
104
|
+
top: Border;
|
|
105
|
+
bottom: Border;
|
|
106
|
+
left: Border;
|
|
107
|
+
right: Border;
|
|
108
|
+
diagonal: Border;
|
|
109
|
+
diagonalUp: boolean;
|
|
110
|
+
diagonalDown: boolean;
|
|
111
|
+
constructor();
|
|
112
|
+
get diagonal_up(): boolean;
|
|
113
|
+
set diagonal_up(v: boolean);
|
|
114
|
+
get diagonal_down(): boolean;
|
|
115
|
+
set diagonal_down(v: boolean);
|
|
116
|
+
/** Gets a border by BorderType. */
|
|
117
|
+
getByBorderType(borderType: BorderType): Border;
|
|
118
|
+
/** Sets border properties for a specific side or 'all'. */
|
|
119
|
+
setBorder(side: string, lineStyle?: string, color?: string, weight?: number): void;
|
|
120
|
+
set_border(side: string, lineStyle?: string, color?: string, weight?: number): void;
|
|
121
|
+
}
|
|
122
|
+
interface AlignmentOptions {
|
|
123
|
+
horizontal?: string;
|
|
124
|
+
vertical?: string;
|
|
125
|
+
wrapText?: boolean;
|
|
126
|
+
indent?: number;
|
|
127
|
+
textRotation?: number;
|
|
128
|
+
shrinkToFit?: boolean;
|
|
129
|
+
readingOrder?: number;
|
|
130
|
+
relativeIndent?: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Represents alignment settings for a cell.
|
|
134
|
+
*/
|
|
135
|
+
declare class Alignment {
|
|
136
|
+
horizontal: string;
|
|
137
|
+
vertical: string;
|
|
138
|
+
wrapText: boolean;
|
|
139
|
+
indent: number;
|
|
140
|
+
textRotation: number;
|
|
141
|
+
shrinkToFit: boolean;
|
|
142
|
+
readingOrder: number;
|
|
143
|
+
relativeIndent: number;
|
|
144
|
+
constructor(options?: AlignmentOptions);
|
|
145
|
+
get wrap_text(): boolean;
|
|
146
|
+
set wrap_text(v: boolean);
|
|
147
|
+
get text_rotation(): number;
|
|
148
|
+
set text_rotation(v: number);
|
|
149
|
+
get shrink_to_fit(): boolean;
|
|
150
|
+
set shrink_to_fit(v: boolean);
|
|
151
|
+
get reading_order(): number;
|
|
152
|
+
set reading_order(v: number);
|
|
153
|
+
get relative_indent(): number;
|
|
154
|
+
set relative_indent(v: number);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Built-in number format lookup.
|
|
158
|
+
*/
|
|
159
|
+
declare class NumberFormat {
|
|
160
|
+
static readonly BUILTIN_FORMATS: Record<number, string>;
|
|
161
|
+
/** Gets a built-in format string by format ID. */
|
|
162
|
+
static getBuiltinFormat(formatId: number): string;
|
|
163
|
+
static get_builtin_format(formatId: number): string;
|
|
164
|
+
/** Checks if a format code is a built-in format. */
|
|
165
|
+
static isBuiltinFormat(formatCode: string): boolean;
|
|
166
|
+
static is_builtin_format(formatCode: string): boolean;
|
|
167
|
+
/** Looks up the format ID for a built-in format code. */
|
|
168
|
+
static lookupBuiltinFormat(formatCode: string): number | null;
|
|
169
|
+
static lookup_builtin_format(formatCode: string): number | null;
|
|
170
|
+
}
|
|
171
|
+
interface ProtectionOptions {
|
|
172
|
+
locked?: boolean;
|
|
173
|
+
hidden?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Represents cell protection settings.
|
|
177
|
+
*/
|
|
178
|
+
declare class Protection {
|
|
179
|
+
locked: boolean;
|
|
180
|
+
hidden: boolean;
|
|
181
|
+
constructor(options?: ProtectionOptions);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Represents formatting settings for a cell or range of cells.
|
|
185
|
+
*/
|
|
186
|
+
declare class Style {
|
|
187
|
+
font: Font;
|
|
188
|
+
fill: Fill;
|
|
189
|
+
borders: Borders;
|
|
190
|
+
alignment: Alignment;
|
|
191
|
+
numberFormat: string;
|
|
192
|
+
protection: Protection;
|
|
193
|
+
constructor();
|
|
194
|
+
get number_format(): string;
|
|
195
|
+
set number_format(v: string);
|
|
196
|
+
/** Creates a deep copy of this Style. */
|
|
197
|
+
copy(): Style;
|
|
198
|
+
setFillColor(color: string): void;
|
|
199
|
+
set_fill_color(color: string): void;
|
|
200
|
+
setFillPattern(patternType: string, fgColor?: string, bgColor?: string): void;
|
|
201
|
+
set_fill_pattern(patternType: string, fgColor?: string, bgColor?: string): void;
|
|
202
|
+
setNoFill(): void;
|
|
203
|
+
set_no_fill(): void;
|
|
204
|
+
setBorderColor(side: string, color: string): void;
|
|
205
|
+
set_border_color(side: string, color: string): void;
|
|
206
|
+
setBorderStyle(side: string, style: string): void;
|
|
207
|
+
set_border_style(side: string, style: string): void;
|
|
208
|
+
setBorder(side: string, lineStyle?: string, color?: string, weight?: number): void;
|
|
209
|
+
set_border(side: string, lineStyle?: string, color?: string, weight?: number): void;
|
|
210
|
+
setDiagonalBorder(lineStyle?: string, color?: string, weight?: number, up?: boolean, down?: boolean): void;
|
|
211
|
+
set_diagonal_border(lineStyle?: string, color?: string, weight?: number, up?: boolean, down?: boolean): void;
|
|
212
|
+
setHorizontalAlignment(alignment: string): void;
|
|
213
|
+
set_horizontal_alignment(alignment: string): void;
|
|
214
|
+
setVerticalAlignment(alignment: string): void;
|
|
215
|
+
set_vertical_alignment(alignment: string): void;
|
|
216
|
+
setTextWrap(wrap?: boolean): void;
|
|
217
|
+
set_text_wrap(wrap?: boolean): void;
|
|
218
|
+
setShrinkToFit(shrink?: boolean): void;
|
|
219
|
+
set_shrink_to_fit(shrink?: boolean): void;
|
|
220
|
+
setIndent(indent: number): void;
|
|
221
|
+
set_indent(indent: number): void;
|
|
222
|
+
setTextRotation(rotation: number): void;
|
|
223
|
+
set_text_rotation(rotation: number): void;
|
|
224
|
+
setReadingOrder(order: number): void;
|
|
225
|
+
set_reading_order(order: number): void;
|
|
226
|
+
setNumberFormat(formatCode: string): void;
|
|
227
|
+
set_number_format(formatCode: string): void;
|
|
228
|
+
setBuiltinNumberFormat(formatId: number): void;
|
|
229
|
+
set_builtin_number_format(formatId: number): void;
|
|
230
|
+
setLocked(locked?: boolean): void;
|
|
231
|
+
set_locked(locked?: boolean): void;
|
|
232
|
+
setFormulaHidden(hidden?: boolean): void;
|
|
233
|
+
set_formula_hidden(hidden?: boolean): void;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Aspose.Cells for Node.js - Cell Module
|
|
238
|
+
*
|
|
239
|
+
* Represents a single cell in a worksheet.
|
|
240
|
+
* Compatible with Aspose.Cells for .NET API structure.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
interface CellComment {
|
|
244
|
+
text: string;
|
|
245
|
+
author: string;
|
|
246
|
+
width?: number | null;
|
|
247
|
+
height?: number | null;
|
|
248
|
+
}
|
|
249
|
+
type CellDataType = 'none' | 'boolean' | 'numeric' | 'datetime' | 'string' | 'unknown';
|
|
250
|
+
type CellValue = null | undefined | string | number | boolean | Date;
|
|
251
|
+
/**
|
|
252
|
+
* Represents a single cell in a worksheet.
|
|
253
|
+
*/
|
|
254
|
+
declare class Cell {
|
|
255
|
+
private _value;
|
|
256
|
+
private _formula;
|
|
257
|
+
private _style;
|
|
258
|
+
private _comment;
|
|
259
|
+
/** Internal use for saving */
|
|
260
|
+
_styleIndex: number;
|
|
261
|
+
constructor(value?: CellValue, formula?: string | null);
|
|
262
|
+
get value(): CellValue;
|
|
263
|
+
set value(val: CellValue);
|
|
264
|
+
get formula(): string | null;
|
|
265
|
+
set formula(val: string | null);
|
|
266
|
+
get style(): Style;
|
|
267
|
+
set style(val: Style);
|
|
268
|
+
get comment(): CellComment | null;
|
|
269
|
+
get dataType(): CellDataType;
|
|
270
|
+
/** snake_case alias */
|
|
271
|
+
get data_type(): CellDataType;
|
|
272
|
+
private getDataType;
|
|
273
|
+
isEmpty(): boolean;
|
|
274
|
+
is_empty(): boolean;
|
|
275
|
+
clearValue(): void;
|
|
276
|
+
clear_value(): void;
|
|
277
|
+
clearFormula(): void;
|
|
278
|
+
clear_formula(): void;
|
|
279
|
+
clear(): void;
|
|
280
|
+
setComment(text: string, author?: string, width?: number | null, height?: number | null): void;
|
|
281
|
+
/** snake_case alias */
|
|
282
|
+
set_comment(text: string, author?: string, width?: number | null, height?: number | null): void;
|
|
283
|
+
/** .NET-style alias */
|
|
284
|
+
addComment(text: string, author?: string): void;
|
|
285
|
+
add_comment(text: string, author?: string): void;
|
|
286
|
+
getComment(): CellComment | null;
|
|
287
|
+
get_comment(): CellComment | null;
|
|
288
|
+
clearComment(): void;
|
|
289
|
+
clear_comment(): void;
|
|
290
|
+
removeComment(): void;
|
|
291
|
+
remove_comment(): void;
|
|
292
|
+
hasComment(): boolean;
|
|
293
|
+
has_comment(): boolean;
|
|
294
|
+
setCommentSize(width: number, height: number): void;
|
|
295
|
+
set_comment_size(width: number, height: number): void;
|
|
296
|
+
getCommentSize(): [number, number] | null;
|
|
297
|
+
get_comment_size(): [number, number] | null;
|
|
298
|
+
applyStyle(style: Style): void;
|
|
299
|
+
apply_style(style: Style): void;
|
|
300
|
+
setStyle(style: Style): void;
|
|
301
|
+
set_style(style: Style): void;
|
|
302
|
+
getStyle(): Style;
|
|
303
|
+
get_style(): Style;
|
|
304
|
+
clearStyle(): void;
|
|
305
|
+
clear_style(): void;
|
|
306
|
+
hasFormula(): boolean;
|
|
307
|
+
has_formula(): boolean;
|
|
308
|
+
isNumericValue(): boolean;
|
|
309
|
+
is_numeric_value(): boolean;
|
|
310
|
+
isTextValue(): boolean;
|
|
311
|
+
is_text_value(): boolean;
|
|
312
|
+
isBooleanValue(): boolean;
|
|
313
|
+
is_boolean_value(): boolean;
|
|
314
|
+
isDateTimeValue(): boolean;
|
|
315
|
+
is_date_time_value(): boolean;
|
|
316
|
+
/** Sets the value of the cell (.NET compatibility). */
|
|
317
|
+
putValue(value: CellValue): void;
|
|
318
|
+
put_value(value: CellValue): void;
|
|
319
|
+
getValue(): CellValue;
|
|
320
|
+
get_value(): CellValue;
|
|
321
|
+
toString(): string;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Aspose.Cells for Node.js - Cells Module
|
|
326
|
+
*
|
|
327
|
+
* A1-keyed collection of cells in a worksheet.
|
|
328
|
+
* Compatible with Aspose.Cells for .NET API structure.
|
|
329
|
+
*/
|
|
330
|
+
|
|
331
|
+
interface WorksheetLike$1 {
|
|
332
|
+
_mergedCells: string[];
|
|
333
|
+
_rowHeights: Record<number, number>;
|
|
334
|
+
_columnWidths: Record<number, number>;
|
|
335
|
+
_hiddenRows: Set<number>;
|
|
336
|
+
_hiddenColumns: Set<number>;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Represents a collection of cells in a worksheet.
|
|
340
|
+
*/
|
|
341
|
+
declare class Cells {
|
|
342
|
+
/** Internal cell storage keyed by A1 reference. */
|
|
343
|
+
_cells: Map<string, Cell>;
|
|
344
|
+
/** Back-reference to owning worksheet (set at runtime). */
|
|
345
|
+
_worksheet: WorksheetLike$1 | null;
|
|
346
|
+
constructor(worksheet?: WorksheetLike$1 | null);
|
|
347
|
+
private requireWorksheet;
|
|
348
|
+
/** Normalize tuple-like [row, col] into A1 key. */
|
|
349
|
+
private normalizeKey;
|
|
350
|
+
/** Gets a cell by its A1 reference. Creates if not exists. */
|
|
351
|
+
get(key: string | [number, number | string]): Cell;
|
|
352
|
+
/** Sets a cell value by A1 reference. */
|
|
353
|
+
set(key: string | [number, number | string], value: Cell | CellValue): void;
|
|
354
|
+
/** Access cell by row/column (1-based). */
|
|
355
|
+
cell(row: number, column: number | string): Cell;
|
|
356
|
+
static columnIndexFromString(column: string): number;
|
|
357
|
+
/** snake_case alias */
|
|
358
|
+
static column_index_from_string(column: string): number;
|
|
359
|
+
static columnLetterFromIndex(index: number): string;
|
|
360
|
+
static column_letter_from_index(index: number): string;
|
|
361
|
+
static coordinateFromString(coord: string): [number, number];
|
|
362
|
+
static coordinate_from_string(coord: string): [number, number];
|
|
363
|
+
static coordinateToString(row: number, column: number): string;
|
|
364
|
+
static coordinate_to_string(row: number, column: number): string;
|
|
365
|
+
/** Iterates row-by-row, yielding arrays of Cell (or values). */
|
|
366
|
+
iterRows(options?: {
|
|
367
|
+
minRow?: number;
|
|
368
|
+
maxRow?: number;
|
|
369
|
+
minCol?: number;
|
|
370
|
+
maxCol?: number;
|
|
371
|
+
valuesOnly?: boolean;
|
|
372
|
+
}): Generator<(Cell | CellValue)[]>;
|
|
373
|
+
/** snake_case alias */
|
|
374
|
+
iter_rows(options?: {
|
|
375
|
+
minRow?: number;
|
|
376
|
+
maxRow?: number;
|
|
377
|
+
minCol?: number;
|
|
378
|
+
maxCol?: number;
|
|
379
|
+
valuesOnly?: boolean;
|
|
380
|
+
}): Generator<(Cell | CellValue)[]>;
|
|
381
|
+
count(): number;
|
|
382
|
+
clear(): void;
|
|
383
|
+
getCellByName(cellName: string): Cell;
|
|
384
|
+
get_cell_by_name(cellName: string): Cell;
|
|
385
|
+
setCellByName(cellName: string, value: CellValue): void;
|
|
386
|
+
set_cell_by_name(cellName: string, value: CellValue): void;
|
|
387
|
+
getCell(row: number, column: number): Cell;
|
|
388
|
+
get_cell(row: number, column: number): Cell;
|
|
389
|
+
setCell(row: number, column: number, value: CellValue): void;
|
|
390
|
+
set_cell(row: number, column: number, value: CellValue): void;
|
|
391
|
+
setRowHeight(row: number, height: number): void;
|
|
392
|
+
set_row_height(row: number, height: number): void;
|
|
393
|
+
SetRowHeight(row: number, height: number): void;
|
|
394
|
+
getRowHeight(row: number): number;
|
|
395
|
+
get_row_height(row: number): number;
|
|
396
|
+
GetRowHeight(row: number): number;
|
|
397
|
+
setColumnWidth(column: number | string, width: number): void;
|
|
398
|
+
set_column_width(column: number | string, width: number): void;
|
|
399
|
+
SetColumnWidth(column: number | string, width: number): void;
|
|
400
|
+
getColumnWidth(column: number | string): number;
|
|
401
|
+
get_column_width(column: number | string): number;
|
|
402
|
+
GetColumnWidth(column: number | string): number;
|
|
403
|
+
hideRow(row: number): void;
|
|
404
|
+
hide_row(row: number): void;
|
|
405
|
+
unhideRow(row: number): void;
|
|
406
|
+
unhide_row(row: number): void;
|
|
407
|
+
isRowHidden(row: number): boolean;
|
|
408
|
+
is_row_hidden(row: number): boolean;
|
|
409
|
+
IsRowHidden(row: number): boolean;
|
|
410
|
+
hideColumn(column: number | string): void;
|
|
411
|
+
hide_column(column: number | string): void;
|
|
412
|
+
unhideColumn(column: number | string): void;
|
|
413
|
+
unhide_column(column: number | string): void;
|
|
414
|
+
isColumnHidden(column: number | string): boolean;
|
|
415
|
+
is_column_hidden(column: number | string): boolean;
|
|
416
|
+
IsColumnHidden(column: number | string): boolean;
|
|
417
|
+
/** Merges a rectangular range. Row/column are 0-based. */
|
|
418
|
+
merge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number): void;
|
|
419
|
+
/** .NET alias */
|
|
420
|
+
Merge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number): void;
|
|
421
|
+
/** Unmerges a previously merged rectangular range. */
|
|
422
|
+
unmerge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number): void;
|
|
423
|
+
UnMerge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number): void;
|
|
424
|
+
mergeRange(rangeRef: string): void;
|
|
425
|
+
merge_range(rangeRef: string): void;
|
|
426
|
+
unmergeRange(rangeRef: string): void;
|
|
427
|
+
unmerge_range(rangeRef: string): void;
|
|
428
|
+
getMergedCells(): string[];
|
|
429
|
+
get_merged_cells(): string[];
|
|
430
|
+
getRange(startRow: number, startColumn: number, endRow: number, endColumn: number): Cell[][];
|
|
431
|
+
get_range(startRow: number, startColumn: number, endRow: number, endColumn: number): Cell[][];
|
|
432
|
+
hasCell(cellName: string): boolean;
|
|
433
|
+
has_cell(cellName: string): boolean;
|
|
434
|
+
deleteCell(cellName: string): void;
|
|
435
|
+
delete_cell(cellName: string): void;
|
|
436
|
+
getAllCells(): Map<string, Cell>;
|
|
437
|
+
get_all_cells(): Map<string, Cell>;
|
|
438
|
+
/** Track max data row (1-based). */
|
|
439
|
+
get maxDataRow(): number;
|
|
440
|
+
get max_data_row(): number;
|
|
441
|
+
/** Track max data column (1-based). */
|
|
442
|
+
get maxDataColumn(): number;
|
|
443
|
+
get max_data_column(): number;
|
|
444
|
+
[Symbol.iterator](): Iterator<[string, Cell]>;
|
|
445
|
+
get length(): number;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Data Validation Module
|
|
450
|
+
*
|
|
451
|
+
* Provides classes for Excel data validation according to ECMA-376 specification.
|
|
452
|
+
* Data validation allows controlling what data can be entered into cells.
|
|
453
|
+
*
|
|
454
|
+
* References:
|
|
455
|
+
* - ECMA-376 Part 4, Section 3.3.1.30 (dataValidation)
|
|
456
|
+
*/
|
|
457
|
+
declare enum DataValidationType {
|
|
458
|
+
NONE = 0,
|
|
459
|
+
WHOLE_NUMBER = 1,
|
|
460
|
+
DECIMAL = 2,
|
|
461
|
+
LIST = 3,
|
|
462
|
+
DATE = 4,
|
|
463
|
+
TIME = 5,
|
|
464
|
+
TEXT_LENGTH = 6,
|
|
465
|
+
CUSTOM = 7
|
|
466
|
+
}
|
|
467
|
+
declare enum DataValidationOperator {
|
|
468
|
+
BETWEEN = 0,
|
|
469
|
+
NOT_BETWEEN = 1,
|
|
470
|
+
EQUAL = 2,
|
|
471
|
+
NOT_EQUAL = 3,
|
|
472
|
+
GREATER_THAN = 4,
|
|
473
|
+
LESS_THAN = 5,
|
|
474
|
+
GREATER_THAN_OR_EQUAL = 6,
|
|
475
|
+
LESS_THAN_OR_EQUAL = 7
|
|
476
|
+
}
|
|
477
|
+
declare enum DataValidationAlertStyle {
|
|
478
|
+
STOP = 0,
|
|
479
|
+
WARNING = 1,
|
|
480
|
+
INFORMATION = 2
|
|
481
|
+
}
|
|
482
|
+
declare enum DataValidationImeMode {
|
|
483
|
+
NO_CONTROL = 0,
|
|
484
|
+
OFF = 1,
|
|
485
|
+
ON = 2,
|
|
486
|
+
DISABLED = 3,
|
|
487
|
+
HIRAGANA = 4,
|
|
488
|
+
FULL_KATAKANA = 5,
|
|
489
|
+
HALF_KATAKANA = 6,
|
|
490
|
+
FULL_ALPHA = 7,
|
|
491
|
+
HALF_ALPHA = 8,
|
|
492
|
+
FULL_HANGUL = 9,
|
|
493
|
+
HALF_HANGUL = 10
|
|
494
|
+
}
|
|
495
|
+
declare class DataValidation {
|
|
496
|
+
private _sqref;
|
|
497
|
+
private _type;
|
|
498
|
+
private _operator;
|
|
499
|
+
private _formula1;
|
|
500
|
+
private _formula2;
|
|
501
|
+
private _alertStyle;
|
|
502
|
+
private _showErrorMessage;
|
|
503
|
+
private _errorTitle;
|
|
504
|
+
private _errorMessage;
|
|
505
|
+
private _showInputMessage;
|
|
506
|
+
private _inputTitle;
|
|
507
|
+
private _inputMessage;
|
|
508
|
+
private _allowBlank;
|
|
509
|
+
private _showDropdown;
|
|
510
|
+
private _imeMode;
|
|
511
|
+
constructor(sqref?: string | null);
|
|
512
|
+
get sqref(): string | null;
|
|
513
|
+
set sqref(value: string | null);
|
|
514
|
+
get ranges(): string[];
|
|
515
|
+
get type(): DataValidationType;
|
|
516
|
+
set type(value: DataValidationType);
|
|
517
|
+
get operator(): DataValidationOperator;
|
|
518
|
+
set operator(value: DataValidationOperator);
|
|
519
|
+
get formula1(): string | null;
|
|
520
|
+
set formula1(value: string | null);
|
|
521
|
+
get formula2(): string | null;
|
|
522
|
+
set formula2(value: string | null);
|
|
523
|
+
get alertStyle(): DataValidationAlertStyle;
|
|
524
|
+
set alertStyle(value: DataValidationAlertStyle);
|
|
525
|
+
get showErrorMessage(): boolean;
|
|
526
|
+
set showErrorMessage(value: boolean);
|
|
527
|
+
/** Alias for showErrorMessage */
|
|
528
|
+
get showError(): boolean;
|
|
529
|
+
set showError(value: boolean);
|
|
530
|
+
get errorTitle(): string | null;
|
|
531
|
+
set errorTitle(value: string | null);
|
|
532
|
+
get errorMessage(): string | null;
|
|
533
|
+
set errorMessage(value: string | null);
|
|
534
|
+
/** Alias for errorMessage */
|
|
535
|
+
get error(): string | null;
|
|
536
|
+
set error(value: string | null);
|
|
537
|
+
get showInputMessage(): boolean;
|
|
538
|
+
set showInputMessage(value: boolean);
|
|
539
|
+
/** Alias for showInputMessage */
|
|
540
|
+
get showInput(): boolean;
|
|
541
|
+
set showInput(value: boolean);
|
|
542
|
+
get inputTitle(): string | null;
|
|
543
|
+
set inputTitle(value: string | null);
|
|
544
|
+
/** Alias for inputTitle */
|
|
545
|
+
get promptTitle(): string | null;
|
|
546
|
+
set promptTitle(value: string | null);
|
|
547
|
+
get inputMessage(): string | null;
|
|
548
|
+
set inputMessage(value: string | null);
|
|
549
|
+
/** Alias for inputMessage */
|
|
550
|
+
get prompt(): string | null;
|
|
551
|
+
set prompt(value: string | null);
|
|
552
|
+
get allowBlank(): boolean;
|
|
553
|
+
set allowBlank(value: boolean);
|
|
554
|
+
/** Alias for allowBlank */
|
|
555
|
+
get ignoreBlank(): boolean;
|
|
556
|
+
set ignoreBlank(value: boolean);
|
|
557
|
+
/**
|
|
558
|
+
* Whether to show the in-cell dropdown for list validations.
|
|
559
|
+
* Note: In ECMA-376, showDropDown="1" means HIDE dropdown (counterintuitive).
|
|
560
|
+
*/
|
|
561
|
+
get showDropdown(): boolean;
|
|
562
|
+
set showDropdown(value: boolean);
|
|
563
|
+
/** Alias for showDropdown */
|
|
564
|
+
get inCellDropdown(): boolean;
|
|
565
|
+
set inCellDropdown(value: boolean);
|
|
566
|
+
get imeMode(): DataValidationImeMode;
|
|
567
|
+
set imeMode(value: DataValidationImeMode);
|
|
568
|
+
add(validationType: DataValidationType, alertStyle?: DataValidationAlertStyle, operator?: DataValidationOperator, formula1?: string | null, formula2?: string | null): void;
|
|
569
|
+
modify(options: {
|
|
570
|
+
validationType?: DataValidationType;
|
|
571
|
+
alertStyle?: DataValidationAlertStyle;
|
|
572
|
+
operator?: DataValidationOperator;
|
|
573
|
+
formula1?: string | null;
|
|
574
|
+
formula2?: string | null;
|
|
575
|
+
}): void;
|
|
576
|
+
delete(): void;
|
|
577
|
+
copy(): DataValidation;
|
|
578
|
+
}
|
|
579
|
+
declare class DataValidationCollection {
|
|
580
|
+
private _validations;
|
|
581
|
+
private _disablePrompts;
|
|
582
|
+
private _xWindow;
|
|
583
|
+
private _yWindow;
|
|
584
|
+
get count(): number;
|
|
585
|
+
get disablePrompts(): boolean;
|
|
586
|
+
set disablePrompts(value: boolean);
|
|
587
|
+
get xWindow(): number | null;
|
|
588
|
+
set xWindow(value: number | null);
|
|
589
|
+
get yWindow(): number | null;
|
|
590
|
+
set yWindow(value: number | null);
|
|
591
|
+
add(sqref: string, validationType?: DataValidationType, operator?: DataValidationOperator, formula1?: string | null, formula2?: string | null): DataValidation;
|
|
592
|
+
addValidation(validation: DataValidation): void;
|
|
593
|
+
remove(validation: DataValidation): boolean;
|
|
594
|
+
removeAt(index: number): void;
|
|
595
|
+
removeByRange(sqref: string): void;
|
|
596
|
+
clear(): void;
|
|
597
|
+
getValidation(cellRef: string): DataValidation | null;
|
|
598
|
+
private _cellInRange;
|
|
599
|
+
private _colFromRef;
|
|
600
|
+
private _rowFromRef;
|
|
601
|
+
get(index: number): DataValidation;
|
|
602
|
+
[Symbol.iterator](): Iterator<DataValidation>;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Conditional Formatting Module
|
|
607
|
+
*
|
|
608
|
+
* Provides classes for Excel conditional formatting according to ECMA-376 specification.
|
|
609
|
+
*/
|
|
610
|
+
|
|
611
|
+
declare class ConditionalFormat {
|
|
612
|
+
private _type;
|
|
613
|
+
private _range;
|
|
614
|
+
private _stopIfTrue;
|
|
615
|
+
private _priority;
|
|
616
|
+
private _operator;
|
|
617
|
+
private _formula1;
|
|
618
|
+
private _formula2;
|
|
619
|
+
private _textOperator;
|
|
620
|
+
private _textFormula;
|
|
621
|
+
private _dateOperator;
|
|
622
|
+
private _dateFormula;
|
|
623
|
+
private _duplicate;
|
|
624
|
+
private _top;
|
|
625
|
+
private _percent;
|
|
626
|
+
private _rank;
|
|
627
|
+
private _above;
|
|
628
|
+
private _stdDev;
|
|
629
|
+
private _colorScaleType;
|
|
630
|
+
private _minColor;
|
|
631
|
+
private _midColor;
|
|
632
|
+
private _maxColor;
|
|
633
|
+
private _barColor;
|
|
634
|
+
private _negativeColor;
|
|
635
|
+
private _showBorder;
|
|
636
|
+
private _direction;
|
|
637
|
+
private _barLength;
|
|
638
|
+
private _iconSetType;
|
|
639
|
+
private _reverseIcons;
|
|
640
|
+
private _showIconOnly;
|
|
641
|
+
private _formula;
|
|
642
|
+
private _font;
|
|
643
|
+
private _border;
|
|
644
|
+
private _fill;
|
|
645
|
+
private _alignment;
|
|
646
|
+
private _numberFormat;
|
|
647
|
+
_dxfId: number | null;
|
|
648
|
+
get type(): string | null;
|
|
649
|
+
set type(value: string | null);
|
|
650
|
+
get range(): string | null;
|
|
651
|
+
set range(value: string | null);
|
|
652
|
+
get stopIfTrue(): boolean;
|
|
653
|
+
set stopIfTrue(value: boolean);
|
|
654
|
+
get priority(): number;
|
|
655
|
+
set priority(value: number);
|
|
656
|
+
get operator(): string | null;
|
|
657
|
+
set operator(value: string | null);
|
|
658
|
+
get formula1(): string | null;
|
|
659
|
+
set formula1(value: string | null);
|
|
660
|
+
get formula2(): string | null;
|
|
661
|
+
set formula2(value: string | null);
|
|
662
|
+
get textOperator(): string | null;
|
|
663
|
+
set textOperator(value: string | null);
|
|
664
|
+
get textFormula(): string | null;
|
|
665
|
+
set textFormula(value: string | null);
|
|
666
|
+
get dateOperator(): string | null;
|
|
667
|
+
set dateOperator(value: string | null);
|
|
668
|
+
get dateFormula(): string | null;
|
|
669
|
+
set dateFormula(value: string | null);
|
|
670
|
+
get duplicate(): boolean | null;
|
|
671
|
+
set duplicate(value: boolean | null);
|
|
672
|
+
get top(): boolean | null;
|
|
673
|
+
set top(value: boolean | null);
|
|
674
|
+
get percent(): boolean;
|
|
675
|
+
set percent(value: boolean);
|
|
676
|
+
get rank(): number;
|
|
677
|
+
set rank(value: number);
|
|
678
|
+
get above(): boolean | null;
|
|
679
|
+
set above(value: boolean | null);
|
|
680
|
+
get stdDev(): number;
|
|
681
|
+
set stdDev(value: number);
|
|
682
|
+
get colorScaleType(): string | null;
|
|
683
|
+
set colorScaleType(value: string | null);
|
|
684
|
+
get minColor(): string | null;
|
|
685
|
+
set minColor(value: string | null);
|
|
686
|
+
get midColor(): string | null;
|
|
687
|
+
set midColor(value: string | null);
|
|
688
|
+
get maxColor(): string | null;
|
|
689
|
+
set maxColor(value: string | null);
|
|
690
|
+
get barColor(): string | null;
|
|
691
|
+
set barColor(value: string | null);
|
|
692
|
+
get negativeColor(): string | null;
|
|
693
|
+
set negativeColor(value: string | null);
|
|
694
|
+
get showBorder(): boolean;
|
|
695
|
+
set showBorder(value: boolean);
|
|
696
|
+
get direction(): string | null;
|
|
697
|
+
set direction(value: string | null);
|
|
698
|
+
get barLength(): [number, number] | null;
|
|
699
|
+
set barLength(value: [number, number] | null);
|
|
700
|
+
get iconSetType(): string | null;
|
|
701
|
+
set iconSetType(value: string | null);
|
|
702
|
+
get reverseIcons(): boolean;
|
|
703
|
+
set reverseIcons(value: boolean);
|
|
704
|
+
get showIconOnly(): boolean;
|
|
705
|
+
set showIconOnly(value: boolean);
|
|
706
|
+
get formula(): string | null;
|
|
707
|
+
set formula(value: string | null);
|
|
708
|
+
get font(): Font;
|
|
709
|
+
get border(): Borders;
|
|
710
|
+
get fill(): Fill;
|
|
711
|
+
get alignment(): Alignment;
|
|
712
|
+
get numberFormat(): string | null;
|
|
713
|
+
set numberFormat(value: string | null);
|
|
714
|
+
hasFont(): boolean;
|
|
715
|
+
hasFill(): boolean;
|
|
716
|
+
hasBorder(): boolean;
|
|
717
|
+
hasAlignment(): boolean;
|
|
718
|
+
}
|
|
719
|
+
declare class ConditionalFormatCollection {
|
|
720
|
+
private _formats;
|
|
721
|
+
get count(): number;
|
|
722
|
+
add(): ConditionalFormat;
|
|
723
|
+
getByIndex(index: number): ConditionalFormat | null;
|
|
724
|
+
getByRange(rangeStr: string): ConditionalFormat[];
|
|
725
|
+
remove(cf: ConditionalFormat): boolean;
|
|
726
|
+
clear(): void;
|
|
727
|
+
get(index: number): ConditionalFormat;
|
|
728
|
+
[Symbol.iterator](): Iterator<ConditionalFormat>;
|
|
729
|
+
get length(): number;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Hyperlink Module
|
|
734
|
+
*
|
|
735
|
+
* Provides classes for Excel hyperlinks according to ECMA-376 specification.
|
|
736
|
+
*/
|
|
737
|
+
type HyperlinkType = 'external' | 'internal' | 'email' | 'unknown';
|
|
738
|
+
declare class Hyperlink {
|
|
739
|
+
private _range;
|
|
740
|
+
private _address;
|
|
741
|
+
private _subAddress;
|
|
742
|
+
private _textToDisplay;
|
|
743
|
+
private _screenTip;
|
|
744
|
+
private _deleted;
|
|
745
|
+
constructor(rangeAddress: string, address?: string, subAddress?: string, textToDisplay?: string, screenTip?: string);
|
|
746
|
+
get range(): string;
|
|
747
|
+
set range(value: string);
|
|
748
|
+
get address(): string;
|
|
749
|
+
set address(value: string);
|
|
750
|
+
get subAddress(): string;
|
|
751
|
+
set subAddress(value: string);
|
|
752
|
+
get textToDisplay(): string;
|
|
753
|
+
set textToDisplay(value: string);
|
|
754
|
+
get screenTip(): string;
|
|
755
|
+
set screenTip(value: string);
|
|
756
|
+
get type(): HyperlinkType;
|
|
757
|
+
delete(): void;
|
|
758
|
+
get isDeleted(): boolean;
|
|
759
|
+
}
|
|
760
|
+
declare class HyperlinkCollection {
|
|
761
|
+
private _hyperlinks;
|
|
762
|
+
add(rangeAddress: string, address?: string, subAddress?: string, textToDisplay?: string, screenTip?: string): Hyperlink;
|
|
763
|
+
/** Add a pre-built hyperlink object */
|
|
764
|
+
addHyperlink(hl: Hyperlink): void;
|
|
765
|
+
delete(indexOrHyperlink?: number | Hyperlink): void;
|
|
766
|
+
clear(): void;
|
|
767
|
+
get count(): number;
|
|
768
|
+
get(index: number): Hyperlink;
|
|
769
|
+
[Symbol.iterator](): Iterator<Hyperlink>;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* AutoFilter Module
|
|
774
|
+
*
|
|
775
|
+
* Provides classes for Excel auto-filter according to ECMA-376 specification.
|
|
776
|
+
*/
|
|
777
|
+
interface CustomFilter {
|
|
778
|
+
operator: string;
|
|
779
|
+
value: string;
|
|
780
|
+
}
|
|
781
|
+
interface ColorFilter {
|
|
782
|
+
color: string;
|
|
783
|
+
cellColor: boolean;
|
|
784
|
+
}
|
|
785
|
+
interface DynamicFilter {
|
|
786
|
+
type: string;
|
|
787
|
+
value?: string;
|
|
788
|
+
}
|
|
789
|
+
interface Top10Filter {
|
|
790
|
+
top: boolean;
|
|
791
|
+
percent: boolean;
|
|
792
|
+
val: number;
|
|
793
|
+
}
|
|
794
|
+
declare class FilterColumn {
|
|
795
|
+
private _colId;
|
|
796
|
+
private _filters;
|
|
797
|
+
private _customFilters;
|
|
798
|
+
private _colorFilter;
|
|
799
|
+
private _dynamicFilter;
|
|
800
|
+
private _top10Filter;
|
|
801
|
+
private _filterButton;
|
|
802
|
+
constructor(colId: number);
|
|
803
|
+
get colId(): number;
|
|
804
|
+
get filters(): string[];
|
|
805
|
+
get customFilters(): CustomFilter[];
|
|
806
|
+
get colorFilter(): ColorFilter | null;
|
|
807
|
+
set colorFilter(value: ColorFilter | null);
|
|
808
|
+
get dynamicFilter(): DynamicFilter | null;
|
|
809
|
+
set dynamicFilter(value: DynamicFilter | null);
|
|
810
|
+
get top10Filter(): Top10Filter | null;
|
|
811
|
+
set top10Filter(value: Top10Filter | null);
|
|
812
|
+
get filterButton(): boolean;
|
|
813
|
+
set filterButton(value: boolean);
|
|
814
|
+
addFilter(value: string): void;
|
|
815
|
+
addCustomFilter(operator: string, value: string): void;
|
|
816
|
+
clearFilters(): void;
|
|
817
|
+
}
|
|
818
|
+
interface SortState {
|
|
819
|
+
ref: string;
|
|
820
|
+
columnIndex: number;
|
|
821
|
+
ascending: boolean;
|
|
822
|
+
}
|
|
823
|
+
declare class AutoFilter {
|
|
824
|
+
private _range;
|
|
825
|
+
private _filterColumns;
|
|
826
|
+
private _sortState;
|
|
827
|
+
get range(): string | null;
|
|
828
|
+
set range(value: string | null);
|
|
829
|
+
get filterColumns(): Map<number, FilterColumn>;
|
|
830
|
+
get sortState(): SortState | null;
|
|
831
|
+
set sortState(value: SortState | null);
|
|
832
|
+
setRange(startRow: number, startCol: number, endRow: number, endCol: number): void;
|
|
833
|
+
filter(colIndex: number, values: string[]): FilterColumn;
|
|
834
|
+
addFilter(colIndex: number, value: string): FilterColumn;
|
|
835
|
+
customFilter(colIndex: number, operator: string, value: string): FilterColumn;
|
|
836
|
+
filterByColor(colIndex: number, color: string, cellColor?: boolean): FilterColumn;
|
|
837
|
+
filterTop10(colIndex: number, top?: boolean, percent?: boolean, val?: number): FilterColumn;
|
|
838
|
+
filterDynamic(colIndex: number, filterType: string, value?: string): FilterColumn;
|
|
839
|
+
clearColumnFilter(colIndex: number): void;
|
|
840
|
+
clearAllFilters(): void;
|
|
841
|
+
remove(): void;
|
|
842
|
+
showFilterButton(colIndex: number, show?: boolean): void;
|
|
843
|
+
sort(colIndex: number, ascending?: boolean): void;
|
|
844
|
+
getFilterColumn(colIndex: number): FilterColumn | null;
|
|
845
|
+
hasFilter(colIndex: number): boolean;
|
|
846
|
+
get hasAnyFilter(): boolean;
|
|
847
|
+
private _getOrCreateColumn;
|
|
848
|
+
private _colToLetter;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Aspose.Cells for Node.js - Page Break Module
|
|
853
|
+
*
|
|
854
|
+
* Manual page break collections aligned with Aspose.Cells/.NET API.
|
|
855
|
+
* Ported from Python `page_break.py`.
|
|
856
|
+
*
|
|
857
|
+
* @module features/PageBreak
|
|
858
|
+
*/
|
|
859
|
+
/**
|
|
860
|
+
* Collection of manual horizontal page breaks (row breaks).
|
|
861
|
+
*/
|
|
862
|
+
declare class HorizontalPageBreakCollection {
|
|
863
|
+
/** @internal */
|
|
864
|
+
_breaks: Set<number>;
|
|
865
|
+
private _normalizeRow;
|
|
866
|
+
/**
|
|
867
|
+
* Adds a manual horizontal page break.
|
|
868
|
+
* @param rowOrCell 0-based row index or A1 cell reference.
|
|
869
|
+
* @returns The 0-based row index.
|
|
870
|
+
*/
|
|
871
|
+
add(rowOrCell: number | string): number;
|
|
872
|
+
/**
|
|
873
|
+
* Removes the break at zero-based collection index.
|
|
874
|
+
*/
|
|
875
|
+
removeAt(index: number): void;
|
|
876
|
+
/**
|
|
877
|
+
* Removes a manual horizontal page break by row/cell.
|
|
878
|
+
*/
|
|
879
|
+
remove(rowOrCell: number | string): void;
|
|
880
|
+
/** Clears all manual horizontal page breaks. */
|
|
881
|
+
clear(): void;
|
|
882
|
+
get count(): number;
|
|
883
|
+
/** Returns a sorted array of break rows. */
|
|
884
|
+
toList(): number[];
|
|
885
|
+
/** Alias */
|
|
886
|
+
to_list(): number[];
|
|
887
|
+
get(index: number): number;
|
|
888
|
+
[Symbol.iterator](): Iterator<number>;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Collection of manual vertical page breaks (column breaks).
|
|
892
|
+
*/
|
|
893
|
+
declare class VerticalPageBreakCollection {
|
|
894
|
+
/** @internal */
|
|
895
|
+
_breaks: Set<number>;
|
|
896
|
+
private _normalizeColumn;
|
|
897
|
+
/**
|
|
898
|
+
* Adds a manual vertical page break.
|
|
899
|
+
* @param columnOrCell 0-based column index, column letters, or A1 cell reference.
|
|
900
|
+
* @returns The 0-based column index.
|
|
901
|
+
*/
|
|
902
|
+
add(columnOrCell: number | string): number;
|
|
903
|
+
/**
|
|
904
|
+
* Removes a manual vertical page break by column/cell.
|
|
905
|
+
*/
|
|
906
|
+
remove(columnOrCell: number | string): void;
|
|
907
|
+
/**
|
|
908
|
+
* Removes the break at zero-based collection index.
|
|
909
|
+
*/
|
|
910
|
+
removeAt(index: number): void;
|
|
911
|
+
/** Clears all manual vertical page breaks. */
|
|
912
|
+
clear(): void;
|
|
913
|
+
get count(): number;
|
|
914
|
+
/** Returns a sorted array of break columns. */
|
|
915
|
+
toList(): number[];
|
|
916
|
+
/** Alias */
|
|
917
|
+
to_list(): number[];
|
|
918
|
+
get(index: number): number;
|
|
919
|
+
[Symbol.iterator](): Iterator<number>;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Aspose.Cells for Node.js - Worksheet Module
|
|
924
|
+
*
|
|
925
|
+
* Represents a single worksheet in an Excel workbook.
|
|
926
|
+
* Compatible with Aspose.Cells for .NET API structure.
|
|
927
|
+
*/
|
|
928
|
+
|
|
929
|
+
declare class SheetProtection {
|
|
930
|
+
sheet: boolean;
|
|
931
|
+
password: string | null;
|
|
932
|
+
objects: boolean;
|
|
933
|
+
scenarios: boolean;
|
|
934
|
+
formatCells: boolean;
|
|
935
|
+
formatColumns: boolean;
|
|
936
|
+
formatRows: boolean;
|
|
937
|
+
insertColumns: boolean;
|
|
938
|
+
insertRows: boolean;
|
|
939
|
+
insertHyperlinks: boolean;
|
|
940
|
+
deleteColumns: boolean;
|
|
941
|
+
deleteRows: boolean;
|
|
942
|
+
selectLockedCells: boolean;
|
|
943
|
+
selectUnlockedCells: boolean;
|
|
944
|
+
sort: boolean;
|
|
945
|
+
autoFilter: boolean;
|
|
946
|
+
pivotTables: boolean;
|
|
947
|
+
get format_cells(): boolean;
|
|
948
|
+
set format_cells(v: boolean);
|
|
949
|
+
get format_columns(): boolean;
|
|
950
|
+
set format_columns(v: boolean);
|
|
951
|
+
get format_rows(): boolean;
|
|
952
|
+
set format_rows(v: boolean);
|
|
953
|
+
get insert_columns(): boolean;
|
|
954
|
+
set insert_columns(v: boolean);
|
|
955
|
+
get insert_rows(): boolean;
|
|
956
|
+
set insert_rows(v: boolean);
|
|
957
|
+
get insert_hyperlinks(): boolean;
|
|
958
|
+
set insert_hyperlinks(v: boolean);
|
|
959
|
+
get delete_columns(): boolean;
|
|
960
|
+
set delete_columns(v: boolean);
|
|
961
|
+
get delete_rows(): boolean;
|
|
962
|
+
set delete_rows(v: boolean);
|
|
963
|
+
get select_locked_cells(): boolean;
|
|
964
|
+
set select_locked_cells(v: boolean);
|
|
965
|
+
get select_unlocked_cells(): boolean;
|
|
966
|
+
set select_unlocked_cells(v: boolean);
|
|
967
|
+
get auto_filter(): boolean;
|
|
968
|
+
set auto_filter(v: boolean);
|
|
969
|
+
get pivot_tables(): boolean;
|
|
970
|
+
set pivot_tables(v: boolean);
|
|
971
|
+
}
|
|
972
|
+
declare const PROTECTION_KEYS: readonly ["protected", "password", "sheet", "objects", "scenarios", "format_cells", "format_columns", "format_rows", "insert_columns", "insert_rows", "insert_hyperlinks", "delete_columns", "delete_rows", "select_locked_cells", "select_unlocked_cells", "sort", "auto_filter", "pivot_tables"];
|
|
973
|
+
type ProtectionKey = typeof PROTECTION_KEYS[number];
|
|
974
|
+
/**
|
|
975
|
+
* Dictionary-like wrapper around SheetProtection for backward compatibility.
|
|
976
|
+
*/
|
|
977
|
+
declare class SheetProtectionDictWrapper {
|
|
978
|
+
private _protection;
|
|
979
|
+
constructor(sheetProtection: SheetProtection);
|
|
980
|
+
get(key: ProtectionKey, defaultValue?: unknown): unknown;
|
|
981
|
+
getItem(key: ProtectionKey): unknown;
|
|
982
|
+
setItem(key: ProtectionKey, value: unknown): void;
|
|
983
|
+
}
|
|
984
|
+
interface PageSetup {
|
|
985
|
+
orientation: string | null;
|
|
986
|
+
paperSize: number | null;
|
|
987
|
+
scale: number | null;
|
|
988
|
+
fitToWidth: number | null;
|
|
989
|
+
fitToHeight: number | null;
|
|
990
|
+
fitToPage: boolean;
|
|
991
|
+
}
|
|
992
|
+
interface PageMargins {
|
|
993
|
+
left: number;
|
|
994
|
+
right: number;
|
|
995
|
+
top: number;
|
|
996
|
+
bottom: number;
|
|
997
|
+
header: number;
|
|
998
|
+
footer: number;
|
|
999
|
+
}
|
|
1000
|
+
interface FreezePane {
|
|
1001
|
+
row: number;
|
|
1002
|
+
column: number;
|
|
1003
|
+
freezedRows: number;
|
|
1004
|
+
freezedColumns: number;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Represents a single worksheet in an Excel workbook.
|
|
1008
|
+
*/
|
|
1009
|
+
declare class Worksheet {
|
|
1010
|
+
private _name;
|
|
1011
|
+
private _cells;
|
|
1012
|
+
private _visible;
|
|
1013
|
+
private _tabColor;
|
|
1014
|
+
private _index;
|
|
1015
|
+
private _protection;
|
|
1016
|
+
private _pageSetup;
|
|
1017
|
+
private _pageMargins;
|
|
1018
|
+
private _freezePane;
|
|
1019
|
+
_mergedCells: string[];
|
|
1020
|
+
_rowHeights: Record<number, number>;
|
|
1021
|
+
_columnWidths: Record<number, number>;
|
|
1022
|
+
_hiddenRows: Set<number>;
|
|
1023
|
+
_hiddenColumns: Set<number>;
|
|
1024
|
+
private _printArea;
|
|
1025
|
+
_sourceXml: string | null;
|
|
1026
|
+
private _dataValidations;
|
|
1027
|
+
private _conditionalFormatting;
|
|
1028
|
+
private _hyperlinks;
|
|
1029
|
+
private _autoFilter;
|
|
1030
|
+
private _horizontalPageBreaks;
|
|
1031
|
+
private _verticalPageBreaks;
|
|
1032
|
+
_workbook: unknown;
|
|
1033
|
+
constructor(name?: string);
|
|
1034
|
+
get name(): string;
|
|
1035
|
+
set name(v: string);
|
|
1036
|
+
get cells(): Cells;
|
|
1037
|
+
get visible(): boolean | 'veryHidden';
|
|
1038
|
+
set visible(v: boolean | 'veryHidden');
|
|
1039
|
+
/** Alias for visible */
|
|
1040
|
+
get isVisible(): boolean;
|
|
1041
|
+
get is_visible(): boolean;
|
|
1042
|
+
get tabColor(): string | null;
|
|
1043
|
+
set tabColor(v: string | null);
|
|
1044
|
+
get tab_color(): string | null;
|
|
1045
|
+
set tab_color(v: string | null);
|
|
1046
|
+
get index(): number;
|
|
1047
|
+
set index(v: number);
|
|
1048
|
+
get protection(): SheetProtectionDictWrapper;
|
|
1049
|
+
get pageSetup(): PageSetup;
|
|
1050
|
+
get page_setup(): PageSetup;
|
|
1051
|
+
get pageMargins(): PageMargins;
|
|
1052
|
+
get page_margins(): PageMargins;
|
|
1053
|
+
get printArea(): string | null;
|
|
1054
|
+
set printArea(v: string | null);
|
|
1055
|
+
get print_area(): string | null;
|
|
1056
|
+
set print_area(v: string | null);
|
|
1057
|
+
get mergedCells(): string[];
|
|
1058
|
+
get merged_cells(): string[];
|
|
1059
|
+
get freezePane(): FreezePane | null;
|
|
1060
|
+
get freeze_pane(): FreezePane | null;
|
|
1061
|
+
get dataValidations(): DataValidationCollection;
|
|
1062
|
+
get data_validations(): DataValidationCollection;
|
|
1063
|
+
get conditionalFormatting(): ConditionalFormatCollection;
|
|
1064
|
+
get conditional_formatting(): ConditionalFormatCollection;
|
|
1065
|
+
get hyperlinks(): HyperlinkCollection;
|
|
1066
|
+
get autoFilter(): AutoFilter;
|
|
1067
|
+
get auto_filter_obj(): AutoFilter;
|
|
1068
|
+
get horizontalPageBreaks(): HorizontalPageBreakCollection;
|
|
1069
|
+
get horizontal_page_breaks(): HorizontalPageBreakCollection;
|
|
1070
|
+
get verticalPageBreaks(): VerticalPageBreakCollection;
|
|
1071
|
+
get vertical_page_breaks(): VerticalPageBreakCollection;
|
|
1072
|
+
rename(newName: string): void;
|
|
1073
|
+
setVisibility(value: boolean | 'veryHidden'): void;
|
|
1074
|
+
set_visibility(value: boolean | 'veryHidden'): void;
|
|
1075
|
+
getVisibility(): boolean | 'veryHidden';
|
|
1076
|
+
get_visibility(): boolean | 'veryHidden';
|
|
1077
|
+
setTabColor(color: string | null): void;
|
|
1078
|
+
set_tab_color(color: string | null): void;
|
|
1079
|
+
getTabColor(): string | null;
|
|
1080
|
+
get_tab_color(): string | null;
|
|
1081
|
+
clearTabColor(): void;
|
|
1082
|
+
clear_tab_color(): void;
|
|
1083
|
+
setPageOrientation(orientation: 'portrait' | 'landscape'): void;
|
|
1084
|
+
set_page_orientation(orientation: 'portrait' | 'landscape'): void;
|
|
1085
|
+
getPageOrientation(): string | null;
|
|
1086
|
+
get_page_orientation(): string | null;
|
|
1087
|
+
setPaperSize(paperSize: number): void;
|
|
1088
|
+
set_paper_size(paperSize: number): void;
|
|
1089
|
+
getPaperSize(): number | null;
|
|
1090
|
+
get_paper_size(): number | null;
|
|
1091
|
+
setPageMargins(options: Partial<PageMargins>): void;
|
|
1092
|
+
set_page_margins(options: Partial<PageMargins>): void;
|
|
1093
|
+
getPageMargins(): PageMargins;
|
|
1094
|
+
get_page_margins(): PageMargins;
|
|
1095
|
+
setFitToPages(width?: number, height?: number): void;
|
|
1096
|
+
set_fit_to_pages(width?: number, height?: number): void;
|
|
1097
|
+
setPrintScale(scale: number): void;
|
|
1098
|
+
set_print_scale(scale: number): void;
|
|
1099
|
+
setPrintArea(printArea: string): void;
|
|
1100
|
+
set_print_area(printArea: string): void;
|
|
1101
|
+
SetPrintArea(printArea: string): void;
|
|
1102
|
+
clearPrintArea(): void;
|
|
1103
|
+
clear_print_area(): void;
|
|
1104
|
+
ClearPrintArea(): void;
|
|
1105
|
+
private normalizePrintArea;
|
|
1106
|
+
setFreezePane(row: number, column: number, freezedRows?: number, freezedColumns?: number): void;
|
|
1107
|
+
set_freeze_pane(row: number, column: number, freezedRows?: number, freezedColumns?: number): void;
|
|
1108
|
+
clearFreezePane(): void;
|
|
1109
|
+
clear_freeze_pane(): void;
|
|
1110
|
+
isProtected(): boolean;
|
|
1111
|
+
is_protected(): boolean;
|
|
1112
|
+
protect(options?: {
|
|
1113
|
+
password?: string | null;
|
|
1114
|
+
formatCells?: boolean;
|
|
1115
|
+
formatColumns?: boolean;
|
|
1116
|
+
formatRows?: boolean;
|
|
1117
|
+
insertColumns?: boolean;
|
|
1118
|
+
insertRows?: boolean;
|
|
1119
|
+
deleteColumns?: boolean;
|
|
1120
|
+
deleteRows?: boolean;
|
|
1121
|
+
sort?: boolean;
|
|
1122
|
+
autoFilter?: boolean;
|
|
1123
|
+
insertHyperlinks?: boolean;
|
|
1124
|
+
pivotTables?: boolean;
|
|
1125
|
+
selectLockedCells?: boolean;
|
|
1126
|
+
selectUnlockedCells?: boolean;
|
|
1127
|
+
objects?: boolean;
|
|
1128
|
+
scenarios?: boolean;
|
|
1129
|
+
}): void;
|
|
1130
|
+
unprotect(_password?: string): void;
|
|
1131
|
+
copy(name?: string): Worksheet;
|
|
1132
|
+
/** Placeholder */
|
|
1133
|
+
delete(): void;
|
|
1134
|
+
/** Placeholder */
|
|
1135
|
+
move(_index: number): void;
|
|
1136
|
+
/** Placeholder */
|
|
1137
|
+
select(): void;
|
|
1138
|
+
/** Placeholder */
|
|
1139
|
+
activate(): void;
|
|
1140
|
+
/**
|
|
1141
|
+
* Evaluates every formula on this worksheet only.
|
|
1142
|
+
*
|
|
1143
|
+
* Delegates to the workbook-level FormulaEvaluator so that cross-sheet
|
|
1144
|
+
* references and defined names resolve correctly.
|
|
1145
|
+
*/
|
|
1146
|
+
calculateFormula(): void;
|
|
1147
|
+
/** snake_case alias */
|
|
1148
|
+
calculate_formula(): void;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Aspose.Cells for Node.js - Defined Name Module
|
|
1153
|
+
*
|
|
1154
|
+
* Represents defined names (named ranges) in the workbook.
|
|
1155
|
+
* Ported from Python `workbook_properties.py` DefinedName/DefinedNameCollection.
|
|
1156
|
+
*
|
|
1157
|
+
* ECMA-376 Section: 18.2.5
|
|
1158
|
+
*
|
|
1159
|
+
* @module features/DefinedName
|
|
1160
|
+
*/
|
|
1161
|
+
/**
|
|
1162
|
+
* Represents a defined name in the workbook.
|
|
1163
|
+
*/
|
|
1164
|
+
declare class DefinedName {
|
|
1165
|
+
private _name;
|
|
1166
|
+
private _refersTo;
|
|
1167
|
+
private _localSheetId;
|
|
1168
|
+
private _comment;
|
|
1169
|
+
private _description;
|
|
1170
|
+
private _hidden;
|
|
1171
|
+
constructor(name: string, refersTo: string, localSheetId?: number | null);
|
|
1172
|
+
/** Name of the defined name. */
|
|
1173
|
+
get name(): string;
|
|
1174
|
+
set name(v: string);
|
|
1175
|
+
/** Formula or range that the name refers to. */
|
|
1176
|
+
get refersTo(): string;
|
|
1177
|
+
set refersTo(v: string);
|
|
1178
|
+
/** Sheet index for sheet-local names (null for global names). */
|
|
1179
|
+
get localSheetId(): number | null;
|
|
1180
|
+
set localSheetId(v: number | null);
|
|
1181
|
+
/** Comment associated with the name. */
|
|
1182
|
+
get comment(): string | null;
|
|
1183
|
+
set comment(v: string | null);
|
|
1184
|
+
/** Description of the name. */
|
|
1185
|
+
get description(): string | null;
|
|
1186
|
+
set description(v: string | null);
|
|
1187
|
+
/** Whether the name is hidden. */
|
|
1188
|
+
get hidden(): boolean;
|
|
1189
|
+
set hidden(v: boolean);
|
|
1190
|
+
get refers_to(): string;
|
|
1191
|
+
set refers_to(v: string);
|
|
1192
|
+
get local_sheet_id(): number | null;
|
|
1193
|
+
set local_sheet_id(v: number | null);
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Collection of defined names in the workbook.
|
|
1197
|
+
*/
|
|
1198
|
+
declare class DefinedNameCollection {
|
|
1199
|
+
private _names;
|
|
1200
|
+
/**
|
|
1201
|
+
* Adds a defined name to the collection.
|
|
1202
|
+
*
|
|
1203
|
+
* @param nameOrDn Either a DefinedName object or a string name.
|
|
1204
|
+
* @param refersTo Formula or range (required if nameOrDn is a string).
|
|
1205
|
+
* @param localSheetId Sheet index for sheet-local names.
|
|
1206
|
+
* @returns The added DefinedName.
|
|
1207
|
+
*/
|
|
1208
|
+
add(nameOrDn: DefinedName | string, refersTo?: string, localSheetId?: number | null): DefinedName;
|
|
1209
|
+
/**
|
|
1210
|
+
* Removes a defined name by name string.
|
|
1211
|
+
* @returns The removed DefinedName or null if not found.
|
|
1212
|
+
*/
|
|
1213
|
+
remove(name: string): DefinedName | null;
|
|
1214
|
+
/**
|
|
1215
|
+
* Gets a defined name by index or name string.
|
|
1216
|
+
*/
|
|
1217
|
+
get(key: number | string): DefinedName;
|
|
1218
|
+
/** Number of defined names. */
|
|
1219
|
+
get count(): number;
|
|
1220
|
+
/** Returns internal array (for iteration). */
|
|
1221
|
+
toArray(): DefinedName[];
|
|
1222
|
+
[Symbol.iterator](): Iterator<DefinedName>;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Aspose.Cells for Node.js – Workbook Module
|
|
1227
|
+
*
|
|
1228
|
+
* Provides Workbook class representing an Excel workbook, along with
|
|
1229
|
+
* SaveFormat enum and WorkbookProtection helper.
|
|
1230
|
+
*
|
|
1231
|
+
* Phase 2: XLSX save via XmlSaver (JSZip). Load still stubbed (Phase 3).
|
|
1232
|
+
*/
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Specifies the format for saving a workbook.
|
|
1236
|
+
*
|
|
1237
|
+
* Compatible with Aspose.Cells for .NET SaveFormat enumeration.
|
|
1238
|
+
*/
|
|
1239
|
+
declare enum SaveFormat {
|
|
1240
|
+
AUTO = "auto",
|
|
1241
|
+
XLSX = "xlsx",
|
|
1242
|
+
CSV = "csv",
|
|
1243
|
+
TSV = "tsv",
|
|
1244
|
+
MARKDOWN = "markdown",
|
|
1245
|
+
JSON = "json"
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Determine the {@link SaveFormat} from a file path's extension.
|
|
1249
|
+
*
|
|
1250
|
+
* @throws {Error} If the extension is unsupported.
|
|
1251
|
+
*/
|
|
1252
|
+
declare function saveFormatFromExtension(filePath: string): SaveFormat;
|
|
1253
|
+
/** Alias for .NET naming convention */
|
|
1254
|
+
declare const save_format_from_extension: typeof saveFormatFromExtension;
|
|
1255
|
+
/**
|
|
1256
|
+
* Holds workbook-level protection settings (structure / windows lock).
|
|
1257
|
+
*/
|
|
1258
|
+
declare class WorkbookProtection {
|
|
1259
|
+
lockStructure: boolean;
|
|
1260
|
+
lockWindows: boolean;
|
|
1261
|
+
workbookPassword: string | null;
|
|
1262
|
+
get lock_structure(): boolean;
|
|
1263
|
+
set lock_structure(v: boolean);
|
|
1264
|
+
get lock_windows(): boolean;
|
|
1265
|
+
set lock_windows(v: boolean);
|
|
1266
|
+
get workbook_password(): string | null;
|
|
1267
|
+
set workbook_password(v: string | null);
|
|
1268
|
+
}
|
|
1269
|
+
interface WorkbookView {
|
|
1270
|
+
activeTab: number;
|
|
1271
|
+
active_tab: number;
|
|
1272
|
+
}
|
|
1273
|
+
declare class WorkbookProperties {
|
|
1274
|
+
/** Workbook protection settings */
|
|
1275
|
+
protection: WorkbookProtection;
|
|
1276
|
+
/** View settings (active tab, etc.) */
|
|
1277
|
+
private _view;
|
|
1278
|
+
/** Calculation mode */
|
|
1279
|
+
calcMode: string;
|
|
1280
|
+
/** Defined names collection */
|
|
1281
|
+
definedNames: DefinedNameCollection;
|
|
1282
|
+
constructor();
|
|
1283
|
+
get view(): WorkbookView;
|
|
1284
|
+
get calc_mode(): string;
|
|
1285
|
+
set calc_mode(v: string);
|
|
1286
|
+
get defined_names(): DefinedNameCollection;
|
|
1287
|
+
}
|
|
1288
|
+
declare class DocumentProperties {
|
|
1289
|
+
title: string;
|
|
1290
|
+
subject: string;
|
|
1291
|
+
creator: string;
|
|
1292
|
+
keywords: string;
|
|
1293
|
+
description: string;
|
|
1294
|
+
lastModifiedBy: string;
|
|
1295
|
+
category: string;
|
|
1296
|
+
revision: string;
|
|
1297
|
+
created: Date | string | null;
|
|
1298
|
+
modified: Date | string | null;
|
|
1299
|
+
/** Extended / App properties */
|
|
1300
|
+
application: string;
|
|
1301
|
+
appVersion: string;
|
|
1302
|
+
company: string;
|
|
1303
|
+
manager: string;
|
|
1304
|
+
/** Round-trip XML blobs */
|
|
1305
|
+
_coreXml: string | null;
|
|
1306
|
+
_appXml: string | null;
|
|
1307
|
+
get last_modified_by(): string;
|
|
1308
|
+
set last_modified_by(v: string);
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Represents an Excel workbook.
|
|
1312
|
+
*
|
|
1313
|
+
* Provides worksheet management, protection helpers, and (in later phases)
|
|
1314
|
+
* file I/O for XLSX, CSV, Markdown, and JSON.
|
|
1315
|
+
*
|
|
1316
|
+
* ```ts
|
|
1317
|
+
* const wb = new Workbook();
|
|
1318
|
+
* const ws = wb.worksheets[0];
|
|
1319
|
+
* ws.cells.get('A1').value = 'Hello';
|
|
1320
|
+
* ```
|
|
1321
|
+
*/
|
|
1322
|
+
declare class Workbook {
|
|
1323
|
+
private _worksheets;
|
|
1324
|
+
private _styles;
|
|
1325
|
+
private _sharedStrings;
|
|
1326
|
+
private _filePath;
|
|
1327
|
+
/** Workbook-level properties */
|
|
1328
|
+
private _properties;
|
|
1329
|
+
/** Document properties (lazily created) */
|
|
1330
|
+
private _documentProperties;
|
|
1331
|
+
/** @internal */ _fontStyles: Map<string, number>;
|
|
1332
|
+
/** @internal */ _fillStyles: Map<string, number>;
|
|
1333
|
+
/** @internal */ _borderStyles: Map<string, number>;
|
|
1334
|
+
/** @internal */ _alignmentStyles: Map<string, number>;
|
|
1335
|
+
/** @internal */ _protectionStyles: Map<string, number>;
|
|
1336
|
+
/** @internal */ _cellStyles: Map<string, number>;
|
|
1337
|
+
/** @internal */ _numFormats: Map<string, number>;
|
|
1338
|
+
/** Round-trip: raw workbook-level XML blobs */
|
|
1339
|
+
_sourceXml: Record<string, string>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Creates a new Workbook.
|
|
1342
|
+
*
|
|
1343
|
+
* @param filePath - Reserved for Phase 2/3: path to an existing .xlsx to load.
|
|
1344
|
+
* @param password - Reserved for Phase 2/3: password for encrypted files.
|
|
1345
|
+
*/
|
|
1346
|
+
constructor(filePath?: string | null, password?: string | null);
|
|
1347
|
+
/** Gets collection of worksheets in the workbook. */
|
|
1348
|
+
get worksheets(): Worksheet[];
|
|
1349
|
+
/** Gets the file path of the workbook (null if not loaded from file). */
|
|
1350
|
+
get filePath(): string | null;
|
|
1351
|
+
/** Gets workbook properties (protection, view, calc settings). */
|
|
1352
|
+
get properties(): WorkbookProperties;
|
|
1353
|
+
/** Gets document properties (title, author, etc.). Lazily created. */
|
|
1354
|
+
get documentProperties(): DocumentProperties;
|
|
1355
|
+
/** Gets the internal styles array. */
|
|
1356
|
+
get styles(): Style[];
|
|
1357
|
+
/** Gets the shared strings table. */
|
|
1358
|
+
get sharedStrings(): string[];
|
|
1359
|
+
get file_path(): string | null;
|
|
1360
|
+
get document_properties(): DocumentProperties;
|
|
1361
|
+
get shared_strings(): string[];
|
|
1362
|
+
/**
|
|
1363
|
+
* Adds a new worksheet to the workbook.
|
|
1364
|
+
*
|
|
1365
|
+
* @param name - Optional name. Auto-generated as "SheetN" if omitted.
|
|
1366
|
+
* @returns The newly created Worksheet.
|
|
1367
|
+
*/
|
|
1368
|
+
addWorksheet(name?: string): Worksheet;
|
|
1369
|
+
/** Alias for {@link addWorksheet}. */
|
|
1370
|
+
add_worksheet(name?: string): Worksheet;
|
|
1371
|
+
/** Alias for {@link addWorksheet}. */
|
|
1372
|
+
createWorksheet(name?: string): Worksheet;
|
|
1373
|
+
/** Alias for {@link addWorksheet}. */
|
|
1374
|
+
create_worksheet(name?: string): Worksheet;
|
|
1375
|
+
/**
|
|
1376
|
+
* Gets a worksheet by index (0-based) or by name.
|
|
1377
|
+
*
|
|
1378
|
+
* @throws {RangeError} If numeric index is out of range.
|
|
1379
|
+
* @throws {Error} If no worksheet with the given name exists.
|
|
1380
|
+
*/
|
|
1381
|
+
getWorksheet(indexOrName: number | string): Worksheet;
|
|
1382
|
+
/** Alias */
|
|
1383
|
+
get_worksheet(indexOrName: number | string): Worksheet;
|
|
1384
|
+
/**
|
|
1385
|
+
* Returns the worksheet with the given name, or `null` if not found.
|
|
1386
|
+
*/
|
|
1387
|
+
getWorksheetByName(name: string): Worksheet | null;
|
|
1388
|
+
/** Alias */
|
|
1389
|
+
get_worksheet_by_name(name: string): Worksheet | null;
|
|
1390
|
+
/**
|
|
1391
|
+
* Returns the worksheet at the given 0-based index, or `null` if out of range.
|
|
1392
|
+
*/
|
|
1393
|
+
getWorksheetByIndex(index: number): Worksheet | null;
|
|
1394
|
+
/** Alias */
|
|
1395
|
+
get_worksheet_by_index(index: number): Worksheet | null;
|
|
1396
|
+
/**
|
|
1397
|
+
* Removes a worksheet by index, name, or direct reference.
|
|
1398
|
+
*
|
|
1399
|
+
* @throws {RangeError} If numeric index is out of range.
|
|
1400
|
+
* @throws {Error} If string name is not found.
|
|
1401
|
+
* @throws {TypeError} If argument is none of the above.
|
|
1402
|
+
*/
|
|
1403
|
+
removeWorksheet(indexOrNameOrWs: number | string | Worksheet): void;
|
|
1404
|
+
/** Alias */
|
|
1405
|
+
remove_worksheet(indexOrNameOrWs: number | string | Worksheet): void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Returns the currently active worksheet.
|
|
1408
|
+
*/
|
|
1409
|
+
getActiveWorksheet(): Worksheet | null;
|
|
1410
|
+
/** Alias */
|
|
1411
|
+
get_active_worksheet(): Worksheet | null;
|
|
1412
|
+
/**
|
|
1413
|
+
* Sets the active worksheet by index, name, or Worksheet reference.
|
|
1414
|
+
*/
|
|
1415
|
+
setActiveWorksheet(indexOrNameOrWs: number | string | Worksheet): void;
|
|
1416
|
+
/** Alias */
|
|
1417
|
+
set_active_worksheet(indexOrNameOrWs: number | string | Worksheet): void;
|
|
1418
|
+
/**
|
|
1419
|
+
* Copies a worksheet and appends the copy to the workbook.
|
|
1420
|
+
*
|
|
1421
|
+
* @returns The new worksheet, or `null` if source could not be resolved.
|
|
1422
|
+
*/
|
|
1423
|
+
copyWorksheet(indexOrNameOrWs: number | string | Worksheet): Worksheet | null;
|
|
1424
|
+
/** Alias */
|
|
1425
|
+
copy_worksheet(indexOrNameOrWs: number | string | Worksheet): Worksheet | null;
|
|
1426
|
+
/**
|
|
1427
|
+
* Protects the workbook structure/windows with an optional password.
|
|
1428
|
+
*
|
|
1429
|
+
* @param password - Optional password string.
|
|
1430
|
+
* @param lockStructure - Prevent adding/removing sheets (default true).
|
|
1431
|
+
* @param lockWindows - Prevent resizing windows (default false).
|
|
1432
|
+
*/
|
|
1433
|
+
protect(password?: string | null, lockStructure?: boolean, lockWindows?: boolean): void;
|
|
1434
|
+
/**
|
|
1435
|
+
* Removes workbook structure/window protection.
|
|
1436
|
+
*/
|
|
1437
|
+
unprotect(_password?: string | null): void;
|
|
1438
|
+
/**
|
|
1439
|
+
* Returns `true` if the workbook has structure or window protection enabled.
|
|
1440
|
+
*/
|
|
1441
|
+
isProtected(): boolean;
|
|
1442
|
+
/** Alias */
|
|
1443
|
+
is_protected(): boolean;
|
|
1444
|
+
/**
|
|
1445
|
+
* Returns a snapshot of the current workbook protection settings.
|
|
1446
|
+
*/
|
|
1447
|
+
get protection(): {
|
|
1448
|
+
lockStructure: boolean;
|
|
1449
|
+
lockWindows: boolean;
|
|
1450
|
+
password: string | null;
|
|
1451
|
+
};
|
|
1452
|
+
/**
|
|
1453
|
+
* Evaluates every formula in every worksheet of this workbook.
|
|
1454
|
+
*
|
|
1455
|
+
* Uses a lazy `require` to avoid circular-dependency issues between
|
|
1456
|
+
* Workbook and FormulaEvaluator.
|
|
1457
|
+
*/
|
|
1458
|
+
calculateFormula(): void;
|
|
1459
|
+
/** snake_case alias */
|
|
1460
|
+
calculate_formula(): void;
|
|
1461
|
+
/**
|
|
1462
|
+
* Saves the workbook to a file.
|
|
1463
|
+
*
|
|
1464
|
+
* Currently supports XLSX format only (Phase 2). CSV, JSON, etc. will be
|
|
1465
|
+
* added in later phases.
|
|
1466
|
+
*
|
|
1467
|
+
* @param filePath Destination file path.
|
|
1468
|
+
* @param saveFormat Explicit format; defaults to AUTO (inferred from extension).
|
|
1469
|
+
* @param _options Reserved for future use (encryption options, etc.).
|
|
1470
|
+
* @param _password Reserved for future use (file-level password).
|
|
1471
|
+
*/
|
|
1472
|
+
save(filePath: string, saveFormat?: SaveFormat | null, _options?: unknown, _password?: string | null): Promise<void>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Saves the workbook to an in-memory Buffer (XLSX format).
|
|
1475
|
+
*
|
|
1476
|
+
* @param saveFormat Explicit format; defaults to XLSX.
|
|
1477
|
+
* @returns A Buffer containing the XLSX ZIP archive.
|
|
1478
|
+
*/
|
|
1479
|
+
saveToBuffer(saveFormat?: SaveFormat): Promise<Buffer>;
|
|
1480
|
+
/** snake_case alias */
|
|
1481
|
+
save_to_buffer(saveFormat?: SaveFormat): Promise<Buffer>;
|
|
1482
|
+
/**
|
|
1483
|
+
* Loads a workbook from a file path (async).
|
|
1484
|
+
*
|
|
1485
|
+
* @param filePath Path to the .xlsx file.
|
|
1486
|
+
* @param _password Reserved for future encrypted workbook support.
|
|
1487
|
+
* @returns A Promise resolving to the loaded Workbook.
|
|
1488
|
+
*/
|
|
1489
|
+
static load(filePath: string, _password?: string | null): Promise<Workbook>;
|
|
1490
|
+
/**
|
|
1491
|
+
* Loads a workbook from a Buffer (async).
|
|
1492
|
+
*
|
|
1493
|
+
* @param buffer Buffer containing XLSX data.
|
|
1494
|
+
* @returns A Promise resolving to the loaded Workbook.
|
|
1495
|
+
*/
|
|
1496
|
+
static loadFromBuffer(buffer: Buffer): Promise<Workbook>;
|
|
1497
|
+
toString(): string;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Aspose.Cells for Node.js – Formula Evaluator Module
|
|
1502
|
+
*
|
|
1503
|
+
* Provides formula evaluation functionality for cells that have formulas.
|
|
1504
|
+
* Ported from Python `formula_evaluator.py` with significant enhancements.
|
|
1505
|
+
*
|
|
1506
|
+
* Supports:
|
|
1507
|
+
* - String, numeric, and boolean literals
|
|
1508
|
+
* - Cell references (A1 style, absolute $A$1, sheet-qualified Sheet1!A1)
|
|
1509
|
+
* - Range references (A1:B5)
|
|
1510
|
+
* - Arithmetic operators: + - * / ^
|
|
1511
|
+
* - Comparison operators: = <> < > <= >=
|
|
1512
|
+
* - String concatenation: &
|
|
1513
|
+
* - Built-in functions (SUM, IF, VLOOKUP, etc.)
|
|
1514
|
+
* - Defined names
|
|
1515
|
+
* - Nested formulas with recursive evaluation
|
|
1516
|
+
* - Error handling (#VALUE!, #REF!, #NAME?, #DIV/0!, #N/A)
|
|
1517
|
+
*
|
|
1518
|
+
* @module features/FormulaEvaluator
|
|
1519
|
+
*/
|
|
1520
|
+
interface WorksheetLike {
|
|
1521
|
+
name: string;
|
|
1522
|
+
cells: CellsLike;
|
|
1523
|
+
}
|
|
1524
|
+
interface CellLike {
|
|
1525
|
+
value: any;
|
|
1526
|
+
formula: string | null;
|
|
1527
|
+
hasFormula(): boolean;
|
|
1528
|
+
}
|
|
1529
|
+
interface CellsLike {
|
|
1530
|
+
get(key: string): CellLike;
|
|
1531
|
+
_cells: Map<string, CellLike>;
|
|
1532
|
+
}
|
|
1533
|
+
interface DefinedNameLike {
|
|
1534
|
+
name: string;
|
|
1535
|
+
refersTo: string;
|
|
1536
|
+
}
|
|
1537
|
+
interface DefinedNameCollectionLike {
|
|
1538
|
+
toArray(): DefinedNameLike[];
|
|
1539
|
+
}
|
|
1540
|
+
interface WorkbookPropertiesLike {
|
|
1541
|
+
definedNames: DefinedNameCollectionLike;
|
|
1542
|
+
}
|
|
1543
|
+
interface WorkbookLike {
|
|
1544
|
+
worksheets: WorksheetLike[];
|
|
1545
|
+
properties: WorkbookPropertiesLike;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Evaluates Excel formulas within a workbook context.
|
|
1549
|
+
*
|
|
1550
|
+
* Supports arithmetic, comparisons, string concatenation, cell references,
|
|
1551
|
+
* range references, defined names, and a comprehensive set of built-in functions.
|
|
1552
|
+
*
|
|
1553
|
+
* @example
|
|
1554
|
+
* ```ts
|
|
1555
|
+
* const evaluator = new FormulaEvaluator(workbook);
|
|
1556
|
+
* const result = evaluator.evaluate('=SUM(A1:A5)', worksheet);
|
|
1557
|
+
* ```
|
|
1558
|
+
*/
|
|
1559
|
+
declare class FormulaEvaluator {
|
|
1560
|
+
private _workbook;
|
|
1561
|
+
private _definedNamesCache;
|
|
1562
|
+
private _evaluatingCells;
|
|
1563
|
+
private _maxDepth;
|
|
1564
|
+
constructor(workbook: WorkbookLike);
|
|
1565
|
+
/**
|
|
1566
|
+
* Evaluate a formula and return the result.
|
|
1567
|
+
*
|
|
1568
|
+
* @param formula - The formula string (with or without leading '=').
|
|
1569
|
+
* @param worksheet - The worksheet context for cell references.
|
|
1570
|
+
* @returns The evaluated value, or an error string on failure.
|
|
1571
|
+
*/
|
|
1572
|
+
evaluate(formula: string, worksheet?: WorksheetLike | null): any;
|
|
1573
|
+
/**
|
|
1574
|
+
* Evaluate all formulas in all worksheets of the workbook.
|
|
1575
|
+
* Sets each cell's value to the evaluated result.
|
|
1576
|
+
*/
|
|
1577
|
+
evaluateAll(singleSheet?: WorksheetLike): void;
|
|
1578
|
+
/** snake_case alias */
|
|
1579
|
+
evaluate_all(singleSheet?: WorksheetLike): void;
|
|
1580
|
+
private _evaluateTokens;
|
|
1581
|
+
/**
|
|
1582
|
+
* Parse an expression with operator precedence (Pratt parser style).
|
|
1583
|
+
* Returns { result, pos } where pos is the next token index.
|
|
1584
|
+
*/
|
|
1585
|
+
private _parseExpression;
|
|
1586
|
+
/**
|
|
1587
|
+
* Parse an atomic value (number, string, cell ref, function call, parenthesised expression, etc.)
|
|
1588
|
+
*/
|
|
1589
|
+
private _parseAtom;
|
|
1590
|
+
private _getDefinedNames;
|
|
1591
|
+
private _resolveDefinedName;
|
|
1592
|
+
private _resolveCellRef;
|
|
1593
|
+
private _resolveSheetRef;
|
|
1594
|
+
/**
|
|
1595
|
+
* Resolves a range reference into an array of cell values.
|
|
1596
|
+
*/
|
|
1597
|
+
private _resolveRange;
|
|
1598
|
+
/**
|
|
1599
|
+
* Resolves a range reference returning an array of arrays (rows x cols) for lookup functions.
|
|
1600
|
+
*/
|
|
1601
|
+
private _resolveRange2D;
|
|
1602
|
+
private _applyArithmetic;
|
|
1603
|
+
private _applyComparison;
|
|
1604
|
+
private _toNumber;
|
|
1605
|
+
private _toBool;
|
|
1606
|
+
private _flattenArgs;
|
|
1607
|
+
private _flattenNumeric;
|
|
1608
|
+
/** Functions that need 2D arrays for their table/range argument */
|
|
1609
|
+
private static readonly _2D_FUNCS;
|
|
1610
|
+
private _callFunctionWithTokens;
|
|
1611
|
+
private _callFunction;
|
|
1612
|
+
private _funcConcatenate;
|
|
1613
|
+
private _funcText;
|
|
1614
|
+
private _funcLen;
|
|
1615
|
+
private _funcTrim;
|
|
1616
|
+
private _funcUpper;
|
|
1617
|
+
private _funcLower;
|
|
1618
|
+
private _funcLeft;
|
|
1619
|
+
private _funcRight;
|
|
1620
|
+
private _funcMid;
|
|
1621
|
+
private _funcSubstitute;
|
|
1622
|
+
private _funcRept;
|
|
1623
|
+
private _funcIf;
|
|
1624
|
+
private _funcAnd;
|
|
1625
|
+
private _funcOr;
|
|
1626
|
+
private _funcNot;
|
|
1627
|
+
private _funcSum;
|
|
1628
|
+
private _funcAverage;
|
|
1629
|
+
private _funcMin;
|
|
1630
|
+
private _funcMax;
|
|
1631
|
+
private _funcCount;
|
|
1632
|
+
private _funcCountA;
|
|
1633
|
+
private _funcAbs;
|
|
1634
|
+
private _funcRound;
|
|
1635
|
+
private _funcRoundUp;
|
|
1636
|
+
private _funcRoundDown;
|
|
1637
|
+
private _funcInt;
|
|
1638
|
+
private _funcMod;
|
|
1639
|
+
private _funcPower;
|
|
1640
|
+
private _funcSqrt;
|
|
1641
|
+
private _funcCeiling;
|
|
1642
|
+
private _funcFloor;
|
|
1643
|
+
private _funcVlookup;
|
|
1644
|
+
private _funcHlookup;
|
|
1645
|
+
private _funcIndex;
|
|
1646
|
+
private _funcMatch;
|
|
1647
|
+
private _valuesEqual;
|
|
1648
|
+
private _funcToday;
|
|
1649
|
+
private _funcNow;
|
|
1650
|
+
private _funcDate;
|
|
1651
|
+
private _funcYear;
|
|
1652
|
+
private _funcMonth;
|
|
1653
|
+
private _funcDay;
|
|
1654
|
+
private _funcIsNumber;
|
|
1655
|
+
private _funcIsText;
|
|
1656
|
+
private _funcIsBlank;
|
|
1657
|
+
private _funcIsError;
|
|
1658
|
+
private _funcIsNa;
|
|
1659
|
+
private _funcValue;
|
|
1660
|
+
private _funcChoose;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* Comment XML Handler
|
|
1665
|
+
*
|
|
1666
|
+
* Reads and writes Excel comments (annotations) in XLSX format.
|
|
1667
|
+
* Comments are stored in xl/comments{n}.xml with VML drawings for positioning.
|
|
1668
|
+
*/
|
|
1669
|
+
|
|
1670
|
+
declare class CommentXmlWriter {
|
|
1671
|
+
/**
|
|
1672
|
+
* Check if worksheet has any comments
|
|
1673
|
+
*/
|
|
1674
|
+
static worksheetHasComments(worksheet: Worksheet): boolean;
|
|
1675
|
+
/**
|
|
1676
|
+
* Write comments XML to the ZIP archive
|
|
1677
|
+
*/
|
|
1678
|
+
writeCommentsXml(zip: JSZip, worksheet: Worksheet, sheetNum: number): void;
|
|
1679
|
+
/**
|
|
1680
|
+
* Write VML drawing XML for comment shapes
|
|
1681
|
+
*/
|
|
1682
|
+
writeVmlDrawingXml(zip: JSZip, worksheet: Worksheet, sheetNum: number): void;
|
|
1683
|
+
private _calculateAnchor;
|
|
1684
|
+
}
|
|
1685
|
+
declare class CommentXmlReader {
|
|
1686
|
+
loadComments(zip: JSZip, worksheet: Worksheet, sheetNum: number): void;
|
|
1687
|
+
/**
|
|
1688
|
+
* Parse comments XML and apply to worksheet
|
|
1689
|
+
*/
|
|
1690
|
+
parseAndApplyComments(commentsRoot: any, worksheet: Worksheet): void;
|
|
1691
|
+
/**
|
|
1692
|
+
* Parse VML drawing to get comment dimensions
|
|
1693
|
+
*/
|
|
1694
|
+
parseAndApplyVmlDrawing(vmlContent: string, worksheet: Worksheet): void;
|
|
1695
|
+
private _ensureArray;
|
|
1696
|
+
private _colToLetter;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* XML AutoFilter Loader
|
|
1701
|
+
*
|
|
1702
|
+
* Loads auto-filter settings from XLSX worksheet XML.
|
|
1703
|
+
*/
|
|
1704
|
+
|
|
1705
|
+
declare class AutoFilterXmlLoader {
|
|
1706
|
+
loadAutoFilter(wsRoot: any, autoFilter: AutoFilter): void;
|
|
1707
|
+
private _calculateSortColumnIndex;
|
|
1708
|
+
private _colFromRef;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* XML AutoFilter Saver
|
|
1713
|
+
*
|
|
1714
|
+
* Writes auto-filter settings to XLSX worksheet XML.
|
|
1715
|
+
*/
|
|
1716
|
+
|
|
1717
|
+
declare class AutoFilterXmlSaver {
|
|
1718
|
+
formatAutoFilterXml(autoFilter: AutoFilter): string;
|
|
1719
|
+
private _calculateSortRefs;
|
|
1720
|
+
private _colFromRef;
|
|
1721
|
+
private _rowFromRef;
|
|
1722
|
+
private _colToLetter;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* XML Conditional Format Loader
|
|
1727
|
+
*
|
|
1728
|
+
* Loads conditional formatting rules from XLSX worksheet XML.
|
|
1729
|
+
*/
|
|
1730
|
+
|
|
1731
|
+
declare class ConditionalFormatXmlLoader {
|
|
1732
|
+
private _dxfStyles;
|
|
1733
|
+
constructor(dxfStyles: any[]);
|
|
1734
|
+
loadConditionalFormatting(wsRoot: any, collection: ConditionalFormatCollection): void;
|
|
1735
|
+
private _loadCfRule;
|
|
1736
|
+
private _loadColorScale;
|
|
1737
|
+
private _loadDataBar;
|
|
1738
|
+
private _loadIconSet;
|
|
1739
|
+
private _applyDxfStyles;
|
|
1740
|
+
private _applyDxfData;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* XML Conditional Format Saver
|
|
1745
|
+
*
|
|
1746
|
+
* Writes conditional formatting rules to XLSX worksheet XML.
|
|
1747
|
+
*/
|
|
1748
|
+
|
|
1749
|
+
declare class ConditionalFormatXmlSaver {
|
|
1750
|
+
private _escapeXml;
|
|
1751
|
+
constructor(escapeXml: (text: string) => string);
|
|
1752
|
+
/**
|
|
1753
|
+
* Formats conditional formatting XML. Returns DXF entries that need to be
|
|
1754
|
+
* added to the styles.xml dxfs collection.
|
|
1755
|
+
*/
|
|
1756
|
+
formatConditionalFormattingXml(collection: ConditionalFormatCollection, startDxfId: number): {
|
|
1757
|
+
xml: string;
|
|
1758
|
+
dxfEntries: string[];
|
|
1759
|
+
};
|
|
1760
|
+
private _formatCfRuleXml;
|
|
1761
|
+
private _formatColorScaleXml;
|
|
1762
|
+
private _formatDataBarXml;
|
|
1763
|
+
private _formatIconSetXml;
|
|
1764
|
+
private _formatDxfEntry;
|
|
1765
|
+
private _getFirstCellFromRange;
|
|
1766
|
+
private _buildTextRuleFormula;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* XML Data Validation Loader
|
|
1771
|
+
*
|
|
1772
|
+
* Loads data validation settings from XLSX worksheet XML.
|
|
1773
|
+
*/
|
|
1774
|
+
|
|
1775
|
+
declare class DataValidationXmlLoader {
|
|
1776
|
+
loadDataValidations(wsRoot: any, collection: DataValidationCollection): void;
|
|
1777
|
+
private _loadDataValidation;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* XML Data Validation Saver
|
|
1782
|
+
*
|
|
1783
|
+
* Writes data validation settings to XLSX worksheet XML.
|
|
1784
|
+
*/
|
|
1785
|
+
|
|
1786
|
+
declare class DataValidationXmlSaver {
|
|
1787
|
+
private _escapeXml;
|
|
1788
|
+
constructor(escapeXml: (text: string) => string);
|
|
1789
|
+
formatDataValidationsXml(collection: DataValidationCollection): string;
|
|
1790
|
+
private _formatDataValidationXml;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/**
|
|
1794
|
+
* XML Hyperlink Handler
|
|
1795
|
+
*
|
|
1796
|
+
* Loads and saves hyperlinks from/to XLSX worksheet XML and .rels files.
|
|
1797
|
+
*/
|
|
1798
|
+
|
|
1799
|
+
declare class HyperlinkXmlLoader {
|
|
1800
|
+
loadHyperlinks(wsRoot: any, collection: HyperlinkCollection, relationships: Map<string, string>): void;
|
|
1801
|
+
loadRelationships(relsXml: any): Map<string, string>;
|
|
1802
|
+
private _loadHyperlink;
|
|
1803
|
+
}
|
|
1804
|
+
interface HyperlinkRelationship {
|
|
1805
|
+
rId: string;
|
|
1806
|
+
target: string;
|
|
1807
|
+
}
|
|
1808
|
+
declare class HyperlinkXmlSaver {
|
|
1809
|
+
private _relIdCounter;
|
|
1810
|
+
formatHyperlinksXml(collection: HyperlinkCollection): string;
|
|
1811
|
+
private _formatHyperlinkXml;
|
|
1812
|
+
getHyperlinkRelationships(collection: HyperlinkCollection): HyperlinkRelationship[];
|
|
1813
|
+
resetRelationshipCounter(startRelId?: number): void;
|
|
1814
|
+
}
|
|
1815
|
+
declare class HyperlinkRelationshipWriter {
|
|
1816
|
+
static formatRelationshipsXml(relationships: HyperlinkRelationship[], existingRels?: string[]): string;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* Shared String Table for XLSX files.
|
|
1821
|
+
*
|
|
1822
|
+
* Manages deduplicated string storage per ECMA-376 §18.4 (Shared String Table).
|
|
1823
|
+
* Each unique string is stored once; cells reference strings by index.
|
|
1824
|
+
*/
|
|
1825
|
+
declare class SharedStringTable {
|
|
1826
|
+
/** Ordered list of unique strings */
|
|
1827
|
+
private _strings;
|
|
1828
|
+
/** Reverse lookup: string → index */
|
|
1829
|
+
private _stringToIndex;
|
|
1830
|
+
/** Total reference count (including duplicates) */
|
|
1831
|
+
private _count;
|
|
1832
|
+
/** Number of unique strings. */
|
|
1833
|
+
get uniqueCount(): number;
|
|
1834
|
+
/** Total number of string references (≥ uniqueCount). */
|
|
1835
|
+
get count(): number;
|
|
1836
|
+
/** Direct access to the strings array (read-only copy). */
|
|
1837
|
+
get strings(): string[];
|
|
1838
|
+
/**
|
|
1839
|
+
* Adds a string to the shared string table.
|
|
1840
|
+
*
|
|
1841
|
+
* If the string already exists, returns the existing index.
|
|
1842
|
+
* Always increments the total reference count.
|
|
1843
|
+
*
|
|
1844
|
+
* @param text - The string to add.
|
|
1845
|
+
* @returns The index of the string in the table.
|
|
1846
|
+
*/
|
|
1847
|
+
addString(text: string): number;
|
|
1848
|
+
/**
|
|
1849
|
+
* Gets a string by its index.
|
|
1850
|
+
*
|
|
1851
|
+
* @param index - The 0-based index.
|
|
1852
|
+
* @returns The string at that index.
|
|
1853
|
+
* @throws {RangeError} If the index is out of range.
|
|
1854
|
+
*/
|
|
1855
|
+
getString(index: number): string;
|
|
1856
|
+
/**
|
|
1857
|
+
* Serializes the shared string table to OOXML.
|
|
1858
|
+
*
|
|
1859
|
+
* Produces the content of `xl/sharedStrings.xml`.
|
|
1860
|
+
*/
|
|
1861
|
+
toXml(): string;
|
|
1862
|
+
/**
|
|
1863
|
+
* Resets the table to empty state.
|
|
1864
|
+
*/
|
|
1865
|
+
clear(): void;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* Cell Value Handler for XLSX serialisation.
|
|
1870
|
+
*
|
|
1871
|
+
* Provides type detection and value formatting for writing cell values
|
|
1872
|
+
* to OOXML worksheet XML, matching ECMA-376 §18.18.11 (ST_CellType).
|
|
1873
|
+
*
|
|
1874
|
+
* Cell types:
|
|
1875
|
+
* - 's' → shared string index
|
|
1876
|
+
* - 'str' → inline formula string result
|
|
1877
|
+
* - 'n' → number (including dates as serial numbers)
|
|
1878
|
+
* - 'b' → boolean (0 / 1)
|
|
1879
|
+
* - 'e' → error value
|
|
1880
|
+
*/
|
|
1881
|
+
|
|
1882
|
+
/** Excel cell type constants matching ST_CellType */
|
|
1883
|
+
declare const CELL_TYPE_STRING = "s";
|
|
1884
|
+
declare const CELL_TYPE_NUMBER = "n";
|
|
1885
|
+
declare const CELL_TYPE_BOOLEAN = "b";
|
|
1886
|
+
declare const CELL_TYPE_ERROR = "e";
|
|
1887
|
+
declare class CellValueHandler {
|
|
1888
|
+
/**
|
|
1889
|
+
* Determines the OOXML cell type for a JavaScript value.
|
|
1890
|
+
*
|
|
1891
|
+
* @param value - A cell value (string, number, boolean, Date, null, etc.)
|
|
1892
|
+
* @returns The OOXML cell type string, or `null` for empty cells.
|
|
1893
|
+
*/
|
|
1894
|
+
static getCellType(value: CellValue): string | null;
|
|
1895
|
+
/**
|
|
1896
|
+
* Formats a cell value for writing into OOXML `<v>` element.
|
|
1897
|
+
*
|
|
1898
|
+
* @param value - The cell value.
|
|
1899
|
+
* @param cellType - Optional pre-determined cell type; auto-detected if omitted.
|
|
1900
|
+
* @returns A tuple of `[formattedString, cellType]`, or `[null, null]` for empty.
|
|
1901
|
+
*/
|
|
1902
|
+
static formatValueForXml(value: CellValue, cellType?: string | null): [string | null, string | null];
|
|
1903
|
+
/**
|
|
1904
|
+
* Parses an OOXML cell value string back into a JavaScript value.
|
|
1905
|
+
*
|
|
1906
|
+
* @param valueStr - The raw string from the `<v>` element.
|
|
1907
|
+
* @param cellType - The cell type attribute ('s', 'n', 'b', 'e', 'str').
|
|
1908
|
+
* @param sharedStrings - Optional shared string table for type 's'.
|
|
1909
|
+
* @returns The parsed JavaScript value.
|
|
1910
|
+
*/
|
|
1911
|
+
static parseValueFromXml(valueStr: string | null | undefined, cellType: string | null, sharedStrings?: string[]): CellValue;
|
|
1912
|
+
/**
|
|
1913
|
+
* Converts a JavaScript Date to an Excel serial date number.
|
|
1914
|
+
*
|
|
1915
|
+
* The serial number represents days since 1899-12-30 (Excel epoch).
|
|
1916
|
+
* Time-of-day is represented as the fractional part.
|
|
1917
|
+
*
|
|
1918
|
+
* @param dt - The Date to convert.
|
|
1919
|
+
* @returns The Excel serial date number.
|
|
1920
|
+
*/
|
|
1921
|
+
static dateToExcelSerial(dt: Date): number;
|
|
1922
|
+
/**
|
|
1923
|
+
* Converts an Excel serial date number to a JavaScript Date.
|
|
1924
|
+
*
|
|
1925
|
+
* @param serial - The Excel serial date number.
|
|
1926
|
+
* @returns A Date object.
|
|
1927
|
+
*/
|
|
1928
|
+
static excelSerialToDate(serial: number): Date;
|
|
1929
|
+
/**
|
|
1930
|
+
* Checks if a string value represents an Excel error.
|
|
1931
|
+
*/
|
|
1932
|
+
static isErrorValue(value: string): boolean;
|
|
1933
|
+
/**
|
|
1934
|
+
* Returns the normalized error string, or `null` if not an error.
|
|
1935
|
+
*/
|
|
1936
|
+
static getErrorType(value: string): string | null;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
/**
|
|
1940
|
+
* XLSX XML Saver – writes a Workbook to an OOXML ZIP (.xlsx) archive.
|
|
1941
|
+
*
|
|
1942
|
+
* Ported from Python `xml_saver.py`. Phase 2 scope:
|
|
1943
|
+
* ✔ Content types, relationships, workbook.xml
|
|
1944
|
+
* ✔ Worksheet XML (sheetData, dimension, cols, merged cells, freeze panes,
|
|
1945
|
+
* sheet protection, page setup, page margins)
|
|
1946
|
+
* ✔ Styles XML (fonts, fills, borders, alignments, protection, number formats, cellXfs)
|
|
1947
|
+
* ✔ Shared strings XML
|
|
1948
|
+
* ✔ Core & extended properties (docProps)
|
|
1949
|
+
* ✗ Charts, pictures, shapes, tables, sparklines, conditional formatting,
|
|
1950
|
+
* hyperlinks, data validations, comments, autofilter, calc chain (future phases)
|
|
1951
|
+
*
|
|
1952
|
+
* @module io/XmlSaver
|
|
1953
|
+
*/
|
|
1954
|
+
|
|
1955
|
+
declare class XmlSaver {
|
|
1956
|
+
private _workbook;
|
|
1957
|
+
private _sharedStringTable;
|
|
1958
|
+
private _fontStyles;
|
|
1959
|
+
private _fillStyles;
|
|
1960
|
+
private _borderStyles;
|
|
1961
|
+
private _alignmentStyles;
|
|
1962
|
+
private _protectionStyles;
|
|
1963
|
+
private _numFormats;
|
|
1964
|
+
private _cellStyles;
|
|
1965
|
+
private _dxfEntries;
|
|
1966
|
+
constructor(workbook: Workbook);
|
|
1967
|
+
/**
|
|
1968
|
+
* Saves the workbook as an XLSX buffer (in-memory ZIP).
|
|
1969
|
+
*
|
|
1970
|
+
* @returns A `Buffer` containing the XLSX data.
|
|
1971
|
+
*/
|
|
1972
|
+
saveToBuffer(): Promise<Buffer>;
|
|
1973
|
+
/**
|
|
1974
|
+
* Saves the workbook to a file path.
|
|
1975
|
+
*
|
|
1976
|
+
* @param filePath - Destination file path.
|
|
1977
|
+
*/
|
|
1978
|
+
saveToFile(filePath: string): Promise<void>;
|
|
1979
|
+
private _writeContentTypes;
|
|
1980
|
+
private _writeRootRelationships;
|
|
1981
|
+
private _writeWorkbookRelationships;
|
|
1982
|
+
private _writeWorkbookXml;
|
|
1983
|
+
private _writeWorksheetXml;
|
|
1984
|
+
/**
|
|
1985
|
+
* Computes the dimension reference string (e.g. "A1:C10") for a worksheet.
|
|
1986
|
+
*/
|
|
1987
|
+
private _computeDimensionRef;
|
|
1988
|
+
/**
|
|
1989
|
+
* Formats <cols> XML for column widths and hidden columns.
|
|
1990
|
+
*/
|
|
1991
|
+
private _formatColsXml;
|
|
1992
|
+
/**
|
|
1993
|
+
* Formats a single cell as XML.
|
|
1994
|
+
*/
|
|
1995
|
+
private _formatCellXml;
|
|
1996
|
+
private _writeStylesXml;
|
|
1997
|
+
private _formatFontXml;
|
|
1998
|
+
private _formatFillXml;
|
|
1999
|
+
private _formatBorderXml;
|
|
2000
|
+
private _formatAlignmentXml;
|
|
2001
|
+
private _formatProtectionXml;
|
|
2002
|
+
private _registerDefaultStyles;
|
|
2003
|
+
private _getOrCreateFontStyle;
|
|
2004
|
+
private _getOrCreateFillStyle;
|
|
2005
|
+
private _getOrCreateBorderStyle;
|
|
2006
|
+
private _getOrCreateAlignmentStyle;
|
|
2007
|
+
private _getOrCreateProtectionStyle;
|
|
2008
|
+
private _getOrCreateNumberFormatStyle;
|
|
2009
|
+
/**
|
|
2010
|
+
* Gets or creates a composite cellXfs style index for a cell.
|
|
2011
|
+
*/
|
|
2012
|
+
private _getOrCreateCellStyle;
|
|
2013
|
+
private _writeSharedStringsXml;
|
|
2014
|
+
private _writeThemeXml;
|
|
2015
|
+
private _writeCorePropertiesXml;
|
|
2016
|
+
private _writeAppPropertiesXml;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* tinyweb-cells – XML Loader Module (Phase 3)
|
|
2021
|
+
*
|
|
2022
|
+
* Reads OOXML (.xlsx) ZIP archives and populates Workbook objects.
|
|
2023
|
+
* Port of the Python `xml_loader.py`.
|
|
2024
|
+
*
|
|
2025
|
+
* ECMA-376 Compliant cell value import.
|
|
2026
|
+
*/
|
|
2027
|
+
|
|
2028
|
+
declare class XmlLoader {
|
|
2029
|
+
private _workbook;
|
|
2030
|
+
private _wb;
|
|
2031
|
+
private _parser;
|
|
2032
|
+
private _contentTypeOverrides;
|
|
2033
|
+
private _contentTypeDefaults;
|
|
2034
|
+
constructor(workbook: Workbook);
|
|
2035
|
+
/**
|
|
2036
|
+
* Loads workbook data from a JSZip instance.
|
|
2037
|
+
*/
|
|
2038
|
+
loadWorkbook(zip: JSZip): Promise<void>;
|
|
2039
|
+
/**
|
|
2040
|
+
* Loads a workbook from a Buffer.
|
|
2041
|
+
*/
|
|
2042
|
+
static loadFromBuffer(buffer: Buffer): Promise<Workbook>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Loads a workbook from a file path.
|
|
2045
|
+
*/
|
|
2046
|
+
static loadFromFile(filePath: string): Promise<Workbook>;
|
|
2047
|
+
private _loadContentTypeOverrides;
|
|
2048
|
+
private _loadTheme;
|
|
2049
|
+
private _loadWorkbookProperties;
|
|
2050
|
+
private _loadDefinedNames;
|
|
2051
|
+
private _loadWorksheetInfo;
|
|
2052
|
+
private _applyPrintAreasFromDefinedNames;
|
|
2053
|
+
private _extractPrintArea;
|
|
2054
|
+
private _loadSharedStrings;
|
|
2055
|
+
private _loadStyles;
|
|
2056
|
+
private _loadStylesXml;
|
|
2057
|
+
private _loadFonts;
|
|
2058
|
+
private _loadFills;
|
|
2059
|
+
private _extractColorAttrs;
|
|
2060
|
+
private _loadBorders;
|
|
2061
|
+
private _loadCellXfs;
|
|
2062
|
+
private _loadDxfStyles;
|
|
2063
|
+
private _loadExtraWorkbookRels;
|
|
2064
|
+
private _loadWorksheetsData;
|
|
2065
|
+
private _loadComments;
|
|
2066
|
+
private _loadExtraSheetRels;
|
|
2067
|
+
private _loadWorksheetData;
|
|
2068
|
+
private _loadMergedCells;
|
|
2069
|
+
private _loadColumnDimensions;
|
|
2070
|
+
private _loadRowHeights;
|
|
2071
|
+
private _loadFreezePane;
|
|
2072
|
+
/**
|
|
2073
|
+
* Loads manual page breaks from rowBreaks / colBreaks elements.
|
|
2074
|
+
* ECMA-376 Section 18.3.1.14 (colBreaks), 18.3.1.73 (rowBreaks).
|
|
2075
|
+
*/
|
|
2076
|
+
private _loadPageBreaks;
|
|
2077
|
+
private _applyCellStyle;
|
|
2078
|
+
private _loadDocumentProperties;
|
|
2079
|
+
private _loadCoreProperties;
|
|
2080
|
+
private _loadAppProperties;
|
|
2081
|
+
private _parseDatetime;
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
export { Alignment, AutoFilter, AutoFilterXmlLoader, AutoFilterXmlSaver, Border, BorderType, Borders, CELL_TYPE_BOOLEAN, CELL_TYPE_ERROR, CELL_TYPE_NUMBER, CELL_TYPE_STRING, Cell, type CellComment, type CellDataType, type CellValue, CellValueHandler, Cells, type ColorFilter, CommentXmlReader, CommentXmlWriter, ConditionalFormat, ConditionalFormatCollection, ConditionalFormatXmlLoader, ConditionalFormatXmlSaver, type CustomFilter, DataValidation, DataValidationAlertStyle, DataValidationCollection, DataValidationImeMode, DataValidationOperator, DataValidationType, DataValidationXmlLoader, DataValidationXmlSaver, DefinedName, DefinedNameCollection, DocumentProperties, type DynamicFilter, Fill, FilterColumn, Font, FormulaEvaluator, type FreezePane, HorizontalPageBreakCollection, Hyperlink, HyperlinkCollection, type HyperlinkRelationship, HyperlinkRelationshipWriter, type HyperlinkType, HyperlinkXmlLoader, HyperlinkXmlSaver, NumberFormat, type PageMargins, type PageSetup, Protection, SaveFormat, SharedStringTable, SheetProtection, SheetProtectionDictWrapper, type SortState, Style, type Top10Filter, VerticalPageBreakCollection, Workbook, WorkbookProperties, WorkbookProtection, type WorkbookView, Worksheet, type WorksheetLike$1 as WorksheetLike, XmlLoader, XmlSaver, saveFormatFromExtension, save_format_from_extension };
|