@agile-team/mach-report 1.2.2 → 2.1.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 +2 -4
- package/LICENSING.md +15 -0
- package/README.md +240 -92
- package/dist/ReportPreview-Dwdsyk9b.js +1558 -0
- package/dist/ReportPreview-VHAIfsz1.cjs +6 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +738 -14
- package/dist/index.d.ts +738 -14
- package/dist/index.js +858 -805
- package/dist/pdf.cjs +47 -47
- package/dist/pdf.d.cts +155 -6
- package/dist/pdf.d.ts +155 -6
- package/dist/pdf.js +3542 -3466
- package/dist/plugin-Bl00j_CP.cjs +1 -0
- package/dist/plugin-DVScnZ4C.js +25 -0
- package/dist/report-params-BB85g7mg.js +10 -0
- package/dist/report-params-D1NeY-eR.cjs +1 -0
- package/dist/sql.cjs +65 -64
- package/dist/sql.d.cts +109 -5
- package/dist/sql.d.ts +109 -5
- package/dist/sql.js +7947 -7922
- package/dist/style-CFZ-HE2s.cjs +3 -0
- package/dist/{style-6ihHKVCM.js → style-DnmtG7Gl.js} +69 -81
- package/dist/style.css +1 -1
- package/dist/vue/async.d.cts +769 -335
- package/dist/vue/async.d.ts +769 -335
- package/dist/vue/index.d.cts +1321 -14
- package/dist/vue/index.d.ts +1321 -14
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +11 -12
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +130 -50
- package/dist/xlsx.cjs +20 -20
- package/dist/xlsx.d.cts +2292 -5
- package/dist/xlsx.d.ts +2292 -5
- package/dist/xlsx.js +5452 -5443
- package/package.json +7 -13
- package/dist/ReportPreview-CJLvkTVn.cjs +0 -6
- package/dist/ReportPreview-mZiGtf0L.js +0 -1231
- package/dist/builder/template-builder.d.ts +0 -69
- package/dist/compat/jh4j-template.d.ts +0 -12
- package/dist/defaults.d.ts +0 -27
- package/dist/format.d.ts +0 -48
- package/dist/layout/paginate.d.ts +0 -97
- package/dist/layout/textwrap.d.ts +0 -36
- package/dist/manager/api.d.ts +0 -45
- package/dist/manager/index.d.ts +0 -2
- package/dist/manager/types.d.ts +0 -50
- package/dist/manager.cjs +0 -1
- package/dist/manager.d.cts +0 -5
- package/dist/manager.d.ts +0 -5
- package/dist/manager.js +0 -104
- package/dist/pdf/font-loader.d.ts +0 -6
- package/dist/pdf/index.d.ts +0 -2
- package/dist/pdf/render-pdf.d.ts +0 -25
- package/dist/plugin-C4qpbdMJ.cjs +0 -1
- package/dist/plugin-DcmAPK_K.js +0 -85
- package/dist/render/canvas.d.ts +0 -76
- package/dist/render/dom.d.ts +0 -10
- package/dist/render/grid-geometry.d.ts +0 -41
- package/dist/render/style.d.ts +0 -33
- package/dist/render/window.d.ts +0 -23
- package/dist/schema/render-plan.d.ts +0 -96
- package/dist/schema/validate.d.ts +0 -15
- package/dist/sql/ast-check.d.ts +0 -14
- package/dist/sql/compile.d.ts +0 -31
- package/dist/sql/expr.d.ts +0 -21
- package/dist/sql/index.d.ts +0 -4
- package/dist/sql/tokenizer.d.ts +0 -25
- package/dist/style-Xq08-IsV.cjs +0 -3
- package/dist/units.d.ts +0 -11
- package/dist/vue/ReportParamPanel.d.ts +0 -19
- package/dist/vue/ReportPreview.d.ts +0 -209
- package/dist/vue/ReportToolbar.d.ts +0 -42
- package/dist/vue/adapters.d.ts +0 -40
- package/dist/vue/composables/useHighlight.d.ts +0 -8
- package/dist/vue/composables/usePageWindow.d.ts +0 -25
- package/dist/vue/composables/usePrintExport.d.ts +0 -40
- package/dist/vue/composables/useReportSearch.d.ts +0 -73
- package/dist/vue/composables/useZoom.d.ts +0 -15
- package/dist/vue/config.d.ts +0 -108
- package/dist/vue/controller.d.ts +0 -29
- package/dist/vue/errors.d.ts +0 -16
- package/dist/vue/injection-keys.d.ts +0 -14
- package/dist/vue/local-adapter.d.ts +0 -12
- package/dist/vue/pdf-exporter.d.ts +0 -13
- package/dist/vue/plugin.d.ts +0 -354
- package/dist/xlsx/render-xlsx.d.ts +0 -20
package/dist/xlsx.d.cts
CHANGED
|
@@ -1,5 +1,2292 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { Stream } from 'stream';
|
|
4
|
+
|
|
5
|
+
declare interface AboveAverageRuleType extends ConditionalFormattingBaseRule {
|
|
6
|
+
type: 'aboveAverage';
|
|
7
|
+
aboveAverage: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare interface Address {
|
|
11
|
+
sheetName?: string;
|
|
12
|
+
address: string;
|
|
13
|
+
col: string;
|
|
14
|
+
row: string;
|
|
15
|
+
$col$row: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare interface AddWorksheetOptions {
|
|
19
|
+
properties: Partial<WorksheetProperties>;
|
|
20
|
+
pageSetup: Partial<PageSetup>;
|
|
21
|
+
headerFooter: Partial<HeaderFooter>;
|
|
22
|
+
views: Array<Partial<WorksheetView>>;
|
|
23
|
+
state: WorksheetState;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare interface Alignment {
|
|
27
|
+
horizontal: 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
|
|
28
|
+
vertical: 'top' | 'middle' | 'bottom' | 'distributed' | 'justify';
|
|
29
|
+
wrapText: boolean;
|
|
30
|
+
shrinkToFit: boolean;
|
|
31
|
+
indent: number;
|
|
32
|
+
readingOrder: 'rtl' | 'ltr';
|
|
33
|
+
textRotation: number | 'vertical';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class Anchor implements IAnchor {
|
|
37
|
+
col: number;
|
|
38
|
+
nativeCol: number;
|
|
39
|
+
nativeColOff: number;
|
|
40
|
+
nativeRow: number;
|
|
41
|
+
nativeRowOff: number;
|
|
42
|
+
row: number;
|
|
43
|
+
|
|
44
|
+
private readonly colWidth: number;
|
|
45
|
+
private readonly rowHeight: number;
|
|
46
|
+
worksheet: Worksheet;
|
|
47
|
+
|
|
48
|
+
constructor(model?: IAnchor | object);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare type AutoFilter = string | {
|
|
52
|
+
from: string | { row: number; column: number };
|
|
53
|
+
to: string | { row: number; column: number };
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
declare interface Border {
|
|
57
|
+
style: BorderStyle;
|
|
58
|
+
color: Partial<Color>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare interface BorderDiagonal extends Border {
|
|
62
|
+
up: boolean;
|
|
63
|
+
down: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare interface Borders {
|
|
67
|
+
top: Partial<Border>;
|
|
68
|
+
left: Partial<Border>;
|
|
69
|
+
bottom: Partial<Border>;
|
|
70
|
+
right: Partial<Border>;
|
|
71
|
+
diagonal: Partial<BorderDiagonal>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare type BorderStyle =
|
|
75
|
+
| 'thin' | 'dotted' | 'hair' | 'medium' | 'double' | 'thick' | 'dashed' | 'dashDot'
|
|
76
|
+
| 'dashDotDot' | 'slantDashDot' | 'mediumDashed' | 'mediumDashDotDot' | 'mediumDashDot';
|
|
77
|
+
|
|
78
|
+
declare interface Buffer_2 extends ArrayBuffer { }
|
|
79
|
+
|
|
80
|
+
declare interface CalculationProperties {
|
|
81
|
+
/**
|
|
82
|
+
* Whether the application shall perform a full recalculation when the workbook is opened
|
|
83
|
+
*/
|
|
84
|
+
fullCalcOnLoad: boolean
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare interface Cell extends Style, Address {
|
|
88
|
+
readonly worksheet: Worksheet;
|
|
89
|
+
readonly workbook: Workbook;
|
|
90
|
+
|
|
91
|
+
readonly effectiveType: ValueType;
|
|
92
|
+
readonly isMerged: boolean;
|
|
93
|
+
readonly master: Cell;
|
|
94
|
+
readonly isHyperlink: boolean;
|
|
95
|
+
readonly hyperlink: string; // todo
|
|
96
|
+
readonly text: string;
|
|
97
|
+
readonly fullAddress: {
|
|
98
|
+
sheetName: string;
|
|
99
|
+
address: string;
|
|
100
|
+
row: number;
|
|
101
|
+
col: number;
|
|
102
|
+
};
|
|
103
|
+
model: CellModel;
|
|
104
|
+
/**
|
|
105
|
+
* Assign (or get) a name for a cell (will overwrite any other names that cell had)
|
|
106
|
+
*/
|
|
107
|
+
name: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Assign (or get) an array of names for a cell (cells can have more than one name)
|
|
111
|
+
*/
|
|
112
|
+
names: string[];
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Cells can define what values are valid or not and provide
|
|
116
|
+
* prompting to the user to help guide them.
|
|
117
|
+
*/
|
|
118
|
+
dataValidation: DataValidation;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Value of the cell
|
|
122
|
+
*/
|
|
123
|
+
value: CellValue;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* comment of the cell
|
|
127
|
+
*/
|
|
128
|
+
note: string | Comment_2;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* convenience getter to access the formula
|
|
132
|
+
*/
|
|
133
|
+
readonly formula: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* convenience getter to access the formula result
|
|
137
|
+
*/
|
|
138
|
+
readonly result: number | string | Date;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The type of the cell's value
|
|
142
|
+
*/
|
|
143
|
+
readonly type: ValueType;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The type of the cell's formula
|
|
147
|
+
*/
|
|
148
|
+
readonly formulaType: FormulaType;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The styles of the cell
|
|
152
|
+
*/
|
|
153
|
+
style: Partial<Style>;
|
|
154
|
+
|
|
155
|
+
addName(name: string): void;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Remove a name from a cell
|
|
159
|
+
*/
|
|
160
|
+
removeName(name: string): void;
|
|
161
|
+
removeAllNames(): void;
|
|
162
|
+
|
|
163
|
+
destroy(): void;
|
|
164
|
+
toCsvString(): string;
|
|
165
|
+
release(): void;
|
|
166
|
+
addMergeRef(): void;
|
|
167
|
+
releaseMergeRef(): void;
|
|
168
|
+
merge(master: Cell, ignoreStyle?: boolean): void;
|
|
169
|
+
unmerge(): void;
|
|
170
|
+
isMergedTo(master: Cell): boolean;
|
|
171
|
+
toString(): string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
declare interface CellErrorValue {
|
|
175
|
+
error: '#N/A' | '#REF!' | '#NAME?' | '#DIV/0!' | '#NULL!' | '#VALUE!' | '#NUM!';
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare interface CellFormulaValue {
|
|
179
|
+
formula: string;
|
|
180
|
+
result?: number | string | boolean | Date | CellErrorValue;
|
|
181
|
+
date1904?: boolean;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
declare interface CellHyperlinkValue {
|
|
185
|
+
text: string;
|
|
186
|
+
hyperlink: string;
|
|
187
|
+
tooltip?: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare type CellIsOperators = 'equal' | 'greaterThan' | 'lessThan' | 'between';
|
|
191
|
+
|
|
192
|
+
declare interface CellIsRuleType extends ConditionalFormattingBaseRule {
|
|
193
|
+
type: 'cellIs';
|
|
194
|
+
formulae?: any[];
|
|
195
|
+
operator?: CellIsOperators;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare interface CellMatrix {
|
|
199
|
+
addCell(addressStr: string): void;
|
|
200
|
+
getCell(addressStr: string): Cell;
|
|
201
|
+
findCell(addressStr: string): Cell | undefined;
|
|
202
|
+
findCellAt(sheetName: string, rowNumber: number, colNumber: number): Cell | undefined;
|
|
203
|
+
addCellEx(address: string | Location_2): void;
|
|
204
|
+
getCellEx(address: string | Location_2): Cell;
|
|
205
|
+
findCellEx(address: string | Location_2, create: boolean): Cell | undefined;
|
|
206
|
+
getCellAt(sheetName: string, rowNumber: number, colNumber: number): Cell;
|
|
207
|
+
removeCellEx(address: string | Location_2): void;
|
|
208
|
+
forEach(callback: (cell: Cell) => void): void;
|
|
209
|
+
map<T>(callback: (cell: Cell) => T): T[];
|
|
210
|
+
findSheet(address: string | Location_2, create: boolean): Cell[] | undefined;
|
|
211
|
+
findSheetRow(sheet: Cell[][], address: string | Location_2, create: boolean): Row | undefined;
|
|
212
|
+
findRowCell(row: any[], address: Address, create: boolean): Cell | undefined;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare interface CellModel {
|
|
216
|
+
address: Address;
|
|
217
|
+
style: Style;
|
|
218
|
+
type: ValueType;
|
|
219
|
+
text?: string;
|
|
220
|
+
hyperlink?: string;
|
|
221
|
+
value?: CellValue;
|
|
222
|
+
master: string;
|
|
223
|
+
formula?: string;
|
|
224
|
+
sharedFormula?: string;
|
|
225
|
+
result?: string | number | any;
|
|
226
|
+
comment: Comment_2;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare interface CellRichTextValue {
|
|
230
|
+
richText: RichText[];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
declare interface CellSharedFormulaValue {
|
|
234
|
+
sharedFormula: string;
|
|
235
|
+
readonly formula?: string;
|
|
236
|
+
result?: number | string | boolean | Date | CellErrorValue;
|
|
237
|
+
date1904?: boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare type CellValue =
|
|
241
|
+
| null | number | string | boolean | Date | undefined
|
|
242
|
+
| CellErrorValue
|
|
243
|
+
| CellRichTextValue | CellHyperlinkValue
|
|
244
|
+
| CellFormulaValue | CellSharedFormulaValue;
|
|
245
|
+
|
|
246
|
+
declare type CfvoTypes = 'percentile' | 'percent' | 'num' | 'min' | 'max' | 'formula' | 'autoMin' | 'autoMax';
|
|
247
|
+
|
|
248
|
+
declare interface Color {
|
|
249
|
+
/**
|
|
250
|
+
* Hex string for alpha-red-green-blue e.g. FF00FF00
|
|
251
|
+
*/
|
|
252
|
+
argb: string;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Choose a theme by index
|
|
256
|
+
*/
|
|
257
|
+
theme: number;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare interface ColorScaleRuleType extends ConditionalFormattingBaseRule {
|
|
261
|
+
type: 'colorScale';
|
|
262
|
+
cfvo?: Cvfo[];
|
|
263
|
+
color?: Partial<Color>[];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
declare interface Column {
|
|
267
|
+
/**
|
|
268
|
+
* Can be a string to set one row high header or an array to set multi-row high header
|
|
269
|
+
*/
|
|
270
|
+
header?: string | string[];
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The name of the properties associated with this column in each row
|
|
274
|
+
*/
|
|
275
|
+
key?: string;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* The width of the column
|
|
279
|
+
*/
|
|
280
|
+
width?: number;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Set an outline level for columns
|
|
284
|
+
*/
|
|
285
|
+
outlineLevel: number;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Hides the column
|
|
289
|
+
*/
|
|
290
|
+
hidden: boolean;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Styles applied to the column
|
|
294
|
+
*/
|
|
295
|
+
style: Partial<Style>;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* The cell values in the column
|
|
299
|
+
*/
|
|
300
|
+
values: ReadonlyArray<CellValue>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Column letter key
|
|
304
|
+
*/
|
|
305
|
+
readonly letter: string;
|
|
306
|
+
readonly number: number;
|
|
307
|
+
readonly worksheet: Worksheet;
|
|
308
|
+
readonly isCustomWidth: boolean;
|
|
309
|
+
readonly headers: string[];
|
|
310
|
+
readonly isDefault: boolean;
|
|
311
|
+
readonly headerCount: number;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Below properties read from style
|
|
315
|
+
*/
|
|
316
|
+
border?: Partial<Borders>;
|
|
317
|
+
fill?: Fill;
|
|
318
|
+
numFmt?: string;
|
|
319
|
+
font?: Partial<Font>;
|
|
320
|
+
alignment?: Partial<Alignment>;
|
|
321
|
+
protection?: Partial<Protection>;
|
|
322
|
+
|
|
323
|
+
toString(): string
|
|
324
|
+
equivalentTo(other: Column): boolean
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* indicate the collapsed state based on outlineLevel
|
|
328
|
+
*/
|
|
329
|
+
readonly collapsed: boolean;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Iterate over all current cells in this column
|
|
333
|
+
*/
|
|
334
|
+
eachCell(callback: (cell: Cell, rowNumber: number) => void): void;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Iterate over all current cells in this column including empty cells
|
|
338
|
+
*/
|
|
339
|
+
eachCell(opt: { includeEmpty: boolean }, callback: (cell: Cell, rowNumber: number) => void): void;
|
|
340
|
+
|
|
341
|
+
defn: any; //todo
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare interface Comment_2 {
|
|
345
|
+
texts?: RichText[];
|
|
346
|
+
margins?: Partial<CommentMargins>;
|
|
347
|
+
protection?: Partial<CommentProtection>;
|
|
348
|
+
editAs?: CommentEditAs;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
declare type CommentEditAs = 'twoCells' | 'oneCells' | 'absolute';
|
|
352
|
+
|
|
353
|
+
declare interface CommentMargins {
|
|
354
|
+
insetmode: 'auto' | 'custom';
|
|
355
|
+
inset: Number[];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
declare interface CommentProtection {
|
|
359
|
+
locked: 'True' | 'False';
|
|
360
|
+
lockText: 'True' | 'False';
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
declare type ComponentKind = "text" | "image" | "barcode" | "qrcode" | "chart" | "line" | "rect" | "ellipse";
|
|
364
|
+
|
|
365
|
+
declare interface ComponentStyle {
|
|
366
|
+
fontSizePx?: number;
|
|
367
|
+
fontSize?: number;
|
|
368
|
+
fontFamily?: string;
|
|
369
|
+
bold?: boolean;
|
|
370
|
+
italic?: boolean;
|
|
371
|
+
underline?: boolean;
|
|
372
|
+
color?: string;
|
|
373
|
+
backgroundColor?: string;
|
|
374
|
+
align?: "left" | "center" | "right" | "justify";
|
|
375
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
376
|
+
lineColor?: string;
|
|
377
|
+
borderColor?: string;
|
|
378
|
+
lineWidthPt?: number;
|
|
379
|
+
borderTop?: boolean;
|
|
380
|
+
borderRight?: boolean;
|
|
381
|
+
borderBottom?: boolean;
|
|
382
|
+
borderLeft?: boolean;
|
|
383
|
+
lineHeight?: number;
|
|
384
|
+
letterSpacing?: number;
|
|
385
|
+
opacity?: number;
|
|
386
|
+
rotateDeg?: number;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare interface ConditionalFormattingBaseRule {
|
|
390
|
+
priority: number;
|
|
391
|
+
style?: Partial<Style>;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
declare interface ConditionalFormattingOptions {
|
|
395
|
+
ref: string;
|
|
396
|
+
rules: ConditionalFormattingRule[];
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
declare type ConditionalFormattingRule = ExpressionRuleType | CellIsRuleType | Top10RuleType | AboveAverageRuleType | ColorScaleRuleType | IconSetRuleType
|
|
400
|
+
| ContainsTextRuleType | TimePeriodRuleType | DataBarRuleType;
|
|
401
|
+
|
|
402
|
+
declare namespace config {
|
|
403
|
+
function setValue(key: 'promise', promise: any): void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
declare type ContainsTextOperators = 'containsText' | 'containsBlanks' | 'notContainsBlanks' | 'containsErrors' | 'notContainsErrors';
|
|
407
|
+
|
|
408
|
+
declare interface ContainsTextRuleType extends ConditionalFormattingBaseRule {
|
|
409
|
+
type: 'containsText';
|
|
410
|
+
operator?: ContainsTextOperators;
|
|
411
|
+
text?: string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
declare interface Csv {
|
|
415
|
+
/**
|
|
416
|
+
* read from a file
|
|
417
|
+
*/
|
|
418
|
+
readFile(path: string, options?: Partial<CsvReadOptions>): Promise<Worksheet>;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* read from a stream
|
|
422
|
+
*/
|
|
423
|
+
read(stream: Stream, options?: Partial<CsvReadOptions>): Promise<Worksheet>;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Create input stream for reading
|
|
427
|
+
*/
|
|
428
|
+
createInputStream(options?: Partial<CsvReadOptions>): EventEmitter;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* write to a buffer
|
|
432
|
+
*/
|
|
433
|
+
writeBuffer(options?: Partial<CsvWriteOptions>): Promise<Buffer_2>;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* write to a file
|
|
437
|
+
*/
|
|
438
|
+
writeFile(path: string, options?: Partial<CsvWriteOptions>): Promise<void>;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* write to a stream
|
|
442
|
+
*/
|
|
443
|
+
write(stream: Stream, options?: Partial<CsvWriteOptions>): Promise<void>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
declare interface CsvReadOptions {
|
|
447
|
+
dateFormats: string[];
|
|
448
|
+
map(value: any, index: number): any;
|
|
449
|
+
sheetName: string;
|
|
450
|
+
parserOptions: Partial<FastCsvParserOptionsArgs>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
declare interface CsvWriteOptions {
|
|
454
|
+
dateFormat: string;
|
|
455
|
+
dateUTC: boolean;
|
|
456
|
+
sheetName: string;
|
|
457
|
+
sheetId: number;
|
|
458
|
+
encoding: string;
|
|
459
|
+
map(value: any, index: number): any;
|
|
460
|
+
includeEmptyRows: boolean;
|
|
461
|
+
formatterOptions: Partial<FastCsvFormatterOptionsArgs>;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
declare interface Cvfo {
|
|
465
|
+
type: CfvoTypes;
|
|
466
|
+
value?: number;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
declare interface DataBarRuleType extends ConditionalFormattingBaseRule {
|
|
470
|
+
type: 'dataBar';
|
|
471
|
+
gradient?: boolean;
|
|
472
|
+
minLength?: number;
|
|
473
|
+
maxLength?: number;
|
|
474
|
+
showValue?: boolean;
|
|
475
|
+
border?: boolean;
|
|
476
|
+
negativeBarColorSameAsPositive?: boolean;
|
|
477
|
+
negativeBarBorderColorSameAsPositive?: boolean;
|
|
478
|
+
axisPosition?: 'auto' | 'middle' | 'none';
|
|
479
|
+
direction?: 'context' | 'leftToRight' | 'rightToLeft';
|
|
480
|
+
cfvo?: Cvfo[];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
declare interface DataValidation {
|
|
484
|
+
type: 'list' | 'whole' | 'decimal' | 'date' | 'textLength' | 'custom';
|
|
485
|
+
formulae: any[];
|
|
486
|
+
allowBlank?: boolean;
|
|
487
|
+
operator?: DataValidationOperator;
|
|
488
|
+
error?: string;
|
|
489
|
+
errorTitle?: string;
|
|
490
|
+
errorStyle?: string;
|
|
491
|
+
prompt?: string;
|
|
492
|
+
promptTitle?: string;
|
|
493
|
+
showErrorMessage?: boolean;
|
|
494
|
+
showInputMessage?: boolean;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
declare type DataValidationOperator =
|
|
498
|
+
| 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan'
|
|
499
|
+
| 'greaterThanOrEqual' | 'lessThanOrEqual';
|
|
500
|
+
|
|
501
|
+
declare interface DefinedNames {
|
|
502
|
+
getMatrix(name: string): CellMatrix;
|
|
503
|
+
// add a name to a cell. locStr in the form SheetName!$col$row or SheetName!$c1$r1:$c2:$r2
|
|
504
|
+
add(locStr: string, name?: string): void;
|
|
505
|
+
addEx(location: string | Location_2, name: string): Cell;
|
|
506
|
+
|
|
507
|
+
remove(locStr: string | Location_2, name: string): void;
|
|
508
|
+
removeEx(location: string | Location_2, name: string): void;
|
|
509
|
+
removeAllNames(location: string | Location_2): void;
|
|
510
|
+
|
|
511
|
+
forEach(callback: (name: string, cell: Cell) => void): void;
|
|
512
|
+
|
|
513
|
+
// get all the names of a cell
|
|
514
|
+
getNames(addressStr: string): string[];
|
|
515
|
+
getNamesEx(address: string): string[];
|
|
516
|
+
|
|
517
|
+
getRanges(name: string, matrix?: CellMatrix): DefinedNamesRanges;
|
|
518
|
+
|
|
519
|
+
model: DefinedNamesModel;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
declare type DefinedNamesModel = DefinedNamesRanges[];
|
|
523
|
+
|
|
524
|
+
declare interface DefinedNamesRanges {
|
|
525
|
+
name: string;
|
|
526
|
+
ranges: string[];
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
declare enum DocumentType_2 {
|
|
530
|
+
Xlsx = 1
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
declare enum ErrorValue {
|
|
534
|
+
NotApplicable = '#N/A',
|
|
535
|
+
Ref = '#REF!',
|
|
536
|
+
Name = '#NAME?',
|
|
537
|
+
DivZero = '#DIV/0!',
|
|
538
|
+
Null = '#NULL!',
|
|
539
|
+
Value = '#VALUE!',
|
|
540
|
+
Num = '#NUM!',
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
declare namespace ExcelJS {
|
|
544
|
+
export {
|
|
545
|
+
Buffer_2 as Buffer,
|
|
546
|
+
RelationshipType,
|
|
547
|
+
DocumentType_2 as DocumentType,
|
|
548
|
+
PaperSize,
|
|
549
|
+
WorksheetViewCommon,
|
|
550
|
+
WorksheetViewNormal,
|
|
551
|
+
WorksheetViewFrozen,
|
|
552
|
+
WorksheetViewSplit,
|
|
553
|
+
WorksheetView,
|
|
554
|
+
WorkbookView,
|
|
555
|
+
FillPatterns,
|
|
556
|
+
FillPattern,
|
|
557
|
+
GradientStop,
|
|
558
|
+
FillGradientAngle,
|
|
559
|
+
FillGradientPath,
|
|
560
|
+
Fill,
|
|
561
|
+
Font,
|
|
562
|
+
BorderStyle,
|
|
563
|
+
Color,
|
|
564
|
+
Border,
|
|
565
|
+
BorderDiagonal,
|
|
566
|
+
Borders,
|
|
567
|
+
Margins,
|
|
568
|
+
ReadingOrder,
|
|
569
|
+
Alignment,
|
|
570
|
+
Protection,
|
|
571
|
+
Style,
|
|
572
|
+
DataValidationOperator,
|
|
573
|
+
DataValidation,
|
|
574
|
+
ErrorValue,
|
|
575
|
+
CellErrorValue,
|
|
576
|
+
RichText,
|
|
577
|
+
CellRichTextValue,
|
|
578
|
+
CellHyperlinkValue,
|
|
579
|
+
CellFormulaValue,
|
|
580
|
+
CellSharedFormulaValue,
|
|
581
|
+
ValueType,
|
|
582
|
+
FormulaType,
|
|
583
|
+
CellValue,
|
|
584
|
+
CommentMargins,
|
|
585
|
+
CommentProtection,
|
|
586
|
+
CommentEditAs,
|
|
587
|
+
Comment_2 as Comment,
|
|
588
|
+
CellModel,
|
|
589
|
+
Cell,
|
|
590
|
+
RowModel,
|
|
591
|
+
Row,
|
|
592
|
+
Column,
|
|
593
|
+
PageSetup,
|
|
594
|
+
HeaderFooter,
|
|
595
|
+
AutoFilter,
|
|
596
|
+
WorksheetProtection,
|
|
597
|
+
Image_2 as Image,
|
|
598
|
+
IAnchor,
|
|
599
|
+
Anchor,
|
|
600
|
+
ImageRange,
|
|
601
|
+
ImagePosition,
|
|
602
|
+
ImageHyperlinkValue,
|
|
603
|
+
Range_2 as Range,
|
|
604
|
+
RowBreak,
|
|
605
|
+
WorksheetModel,
|
|
606
|
+
WorksheetState,
|
|
607
|
+
CellIsOperators,
|
|
608
|
+
ContainsTextOperators,
|
|
609
|
+
TimePeriodTypes,
|
|
610
|
+
IconSetTypes,
|
|
611
|
+
CfvoTypes,
|
|
612
|
+
Cvfo,
|
|
613
|
+
ConditionalFormattingBaseRule,
|
|
614
|
+
ExpressionRuleType,
|
|
615
|
+
CellIsRuleType,
|
|
616
|
+
Top10RuleType,
|
|
617
|
+
AboveAverageRuleType,
|
|
618
|
+
ColorScaleRuleType,
|
|
619
|
+
IconSetRuleType,
|
|
620
|
+
ContainsTextRuleType,
|
|
621
|
+
TimePeriodRuleType,
|
|
622
|
+
DataBarRuleType,
|
|
623
|
+
ConditionalFormattingRule,
|
|
624
|
+
RowValues,
|
|
625
|
+
ConditionalFormattingOptions,
|
|
626
|
+
Worksheet,
|
|
627
|
+
CalculationProperties,
|
|
628
|
+
WorksheetProperties,
|
|
629
|
+
AddWorksheetOptions,
|
|
630
|
+
WorkbookProperties,
|
|
631
|
+
JSZipGeneratorOptions,
|
|
632
|
+
XlsxReadOptions,
|
|
633
|
+
XlsxWriteOptions,
|
|
634
|
+
Xlsx,
|
|
635
|
+
HeaderArray,
|
|
636
|
+
HeaderTransformFunction,
|
|
637
|
+
FastCsvParserOptionsArgs,
|
|
638
|
+
QuoteColumnMap,
|
|
639
|
+
QuoteColumns,
|
|
640
|
+
RowMap,
|
|
641
|
+
RowHashArray,
|
|
642
|
+
RowArray,
|
|
643
|
+
Rows,
|
|
644
|
+
RowTransformCallback,
|
|
645
|
+
RowTransformFunction,
|
|
646
|
+
FastCsvFormatterOptionsArgs,
|
|
647
|
+
CsvReadOptions,
|
|
648
|
+
CsvWriteOptions,
|
|
649
|
+
Csv,
|
|
650
|
+
Media,
|
|
651
|
+
Address,
|
|
652
|
+
Location_2 as Location,
|
|
653
|
+
CellMatrix,
|
|
654
|
+
DefinedNamesRanges,
|
|
655
|
+
DefinedNamesModel,
|
|
656
|
+
DefinedNames,
|
|
657
|
+
WorkbookModel,
|
|
658
|
+
Workbook,
|
|
659
|
+
TableStyleProperties,
|
|
660
|
+
TableColumnProperties,
|
|
661
|
+
TableProperties,
|
|
662
|
+
TableColumn,
|
|
663
|
+
Table,
|
|
664
|
+
config,
|
|
665
|
+
stream
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
declare interface ExpressionRuleType extends ConditionalFormattingBaseRule {
|
|
670
|
+
type: 'expression';
|
|
671
|
+
formulae?: any[];
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
declare interface FastCsvFormatterOptionsArgs {
|
|
675
|
+
objectMode: boolean;
|
|
676
|
+
delimiter: string;
|
|
677
|
+
rowDelimiter: string;
|
|
678
|
+
quote: string | boolean;
|
|
679
|
+
escape: string;
|
|
680
|
+
quoteColumns: QuoteColumns;
|
|
681
|
+
quoteHeaders: QuoteColumns;
|
|
682
|
+
headers: null | boolean | string[];
|
|
683
|
+
includeEndRowDelimiter: boolean;
|
|
684
|
+
writeBOM: boolean;
|
|
685
|
+
transform: RowTransformFunction;
|
|
686
|
+
alwaysWriteHeaders: boolean;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
declare interface FastCsvParserOptionsArgs {
|
|
690
|
+
objectMode: boolean;
|
|
691
|
+
delimiter: string;
|
|
692
|
+
quote: string | null;
|
|
693
|
+
escape: string;
|
|
694
|
+
headers: boolean | HeaderTransformFunction | HeaderArray;
|
|
695
|
+
renameHeaders: boolean;
|
|
696
|
+
ignoreEmpty: boolean;
|
|
697
|
+
comment: string;
|
|
698
|
+
strictColumnHandling: boolean;
|
|
699
|
+
discardUnmappedColumns: boolean;
|
|
700
|
+
trim: boolean;
|
|
701
|
+
ltrim: boolean;
|
|
702
|
+
rtrim: boolean;
|
|
703
|
+
encoding: string;
|
|
704
|
+
maxRows: number;
|
|
705
|
+
skipLines: number;
|
|
706
|
+
skipRows: number;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
declare type Fill = FillPattern | FillGradientAngle | FillGradientPath;
|
|
710
|
+
|
|
711
|
+
declare interface FillGradientAngle {
|
|
712
|
+
type: 'gradient';
|
|
713
|
+
gradient: 'angle';
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* For 'angle' gradient, specifies the direction of the gradient. 0 is from the left to the right.
|
|
717
|
+
* Values from 1 - 359 rotates the direction clockwise
|
|
718
|
+
*/
|
|
719
|
+
degree: number;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Specifies the gradient colour sequence. Is an array of objects containing position and
|
|
723
|
+
* color starting with position 0 and ending with position 1.
|
|
724
|
+
* Intermediary positions may be used to specify other colours on the path.
|
|
725
|
+
*/
|
|
726
|
+
stops: GradientStop[];
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
declare interface FillGradientPath {
|
|
730
|
+
type: 'gradient';
|
|
731
|
+
gradient: 'path';
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* For 'path' gradient. Specifies the relative coordinates for the start of the path.
|
|
735
|
+
* 'left' and 'top' values range from 0 to 1
|
|
736
|
+
*/
|
|
737
|
+
center: { left: number; top: number };
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Specifies the gradient colour sequence. Is an array of objects containing position and
|
|
741
|
+
* color starting with position 0 and ending with position 1.
|
|
742
|
+
* Intermediary positions may be used to specify other colours on the path.
|
|
743
|
+
*/
|
|
744
|
+
stops: GradientStop[];
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
declare interface FillPattern {
|
|
748
|
+
type: 'pattern';
|
|
749
|
+
pattern: FillPatterns;
|
|
750
|
+
fgColor?: Partial<Color>;
|
|
751
|
+
bgColor?: Partial<Color>;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
declare type FillPatterns =
|
|
755
|
+
| 'none' | 'solid'
|
|
756
|
+
| 'darkVertical' | 'darkHorizontal' | 'darkGrid' | 'darkTrellis' | 'darkDown' | 'darkUp'
|
|
757
|
+
| 'lightVertical' | 'lightHorizontal' | 'lightGrid' | 'lightTrellis' | 'lightDown' | 'lightUp'
|
|
758
|
+
| 'darkGray' | 'mediumGray' | 'lightGray' | 'gray125' | 'gray0625';
|
|
759
|
+
|
|
760
|
+
declare interface Font {
|
|
761
|
+
name: string;
|
|
762
|
+
size: number;
|
|
763
|
+
family: number;
|
|
764
|
+
scheme: 'minor' | 'major' | 'none';
|
|
765
|
+
charset: number;
|
|
766
|
+
color: Partial<Color>;
|
|
767
|
+
bold: boolean;
|
|
768
|
+
italic: boolean;
|
|
769
|
+
underline: boolean | 'none' | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
|
|
770
|
+
vertAlign: 'superscript' | 'subscript';
|
|
771
|
+
strike: boolean;
|
|
772
|
+
outline: boolean;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
declare enum FormulaType {
|
|
776
|
+
None = 0,
|
|
777
|
+
Master = 1,
|
|
778
|
+
Shared = 2
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
declare interface GradientStop {
|
|
782
|
+
position: number;
|
|
783
|
+
color: Partial<Color>;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
declare interface GridCell {
|
|
787
|
+
text?: string;
|
|
788
|
+
rawText?: string;
|
|
789
|
+
children?: PlanComponent[];
|
|
790
|
+
colSpan?: number;
|
|
791
|
+
rowSpan?: number;
|
|
792
|
+
style?: ComponentStyle;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
declare type HeaderArray = (string | undefined | null)[];
|
|
796
|
+
|
|
797
|
+
declare interface HeaderFooter {
|
|
798
|
+
/**
|
|
799
|
+
* Set the value of differentFirst as true, which indicates that headers/footers for first page are different from the other pages, `false` by default
|
|
800
|
+
*/
|
|
801
|
+
differentFirst: boolean,
|
|
802
|
+
/**
|
|
803
|
+
* Set the value of differentOddEven as true, which indicates that headers/footers for odd and even pages are different, `false` by default
|
|
804
|
+
*/
|
|
805
|
+
differentOddEven: boolean,
|
|
806
|
+
/**
|
|
807
|
+
* Set header string for odd pages, could format the string and `null` by default
|
|
808
|
+
*/
|
|
809
|
+
oddHeader: string,
|
|
810
|
+
/**
|
|
811
|
+
* Set footer string for odd pages, could format the string and `null` by default
|
|
812
|
+
*/
|
|
813
|
+
oddFooter: string,
|
|
814
|
+
/**
|
|
815
|
+
* Set header string for even pages, could format the string and `null` by default
|
|
816
|
+
*/
|
|
817
|
+
evenHeader: string,
|
|
818
|
+
/**
|
|
819
|
+
* Set footer string for even pages, could format the string and `null` by default
|
|
820
|
+
*/
|
|
821
|
+
evenFooter: string,
|
|
822
|
+
/**
|
|
823
|
+
* Set header string for the first page, could format the string and `null` by default
|
|
824
|
+
*/
|
|
825
|
+
firstHeader: string,
|
|
826
|
+
/**
|
|
827
|
+
* Set footer string for the first page, could format the string and `null` by default
|
|
828
|
+
*/
|
|
829
|
+
firstFooter: string
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
declare type HeaderTransformFunction = (headers: HeaderArray) => HeaderArray;
|
|
833
|
+
|
|
834
|
+
declare interface IAnchor {
|
|
835
|
+
col: number;
|
|
836
|
+
row: number;
|
|
837
|
+
nativeCol: number;
|
|
838
|
+
nativeRow: number;
|
|
839
|
+
nativeColOff: number;
|
|
840
|
+
nativeRowOff: number;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
declare interface IconSetRuleType extends ConditionalFormattingBaseRule {
|
|
844
|
+
type: 'iconSet';
|
|
845
|
+
showValue?: boolean;
|
|
846
|
+
reverse?: boolean;
|
|
847
|
+
custom?: boolean;
|
|
848
|
+
iconSet?: IconSetTypes;
|
|
849
|
+
cfvo?: Cvfo[];
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
declare type IconSetTypes = '5Arrows' | '5ArrowsGray' | '5Boxes' | '5Quarters' | '5Rating' | '4Arrows' | '4ArrowsGray'
|
|
853
|
+
| '4Rating' | '4RedToBlack' | '4TrafficLights' | 'NoIcons' | '3Arrows' | '3ArrowsGray' | '3Flags' | '3Signs'
|
|
854
|
+
| '3Stars' | '3Symbols' | '3Symbols2' | '3TrafficLights1' | '3TrafficLights2' | '3Triangles';
|
|
855
|
+
|
|
856
|
+
declare interface Image_2 {
|
|
857
|
+
extension: 'jpeg' | 'png' | 'gif';
|
|
858
|
+
base64?: string;
|
|
859
|
+
filename?: string;
|
|
860
|
+
buffer?: Buffer_2;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
declare interface ImageHyperlinkValue {
|
|
864
|
+
hyperlink: string;
|
|
865
|
+
tooltip?: string;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
declare interface ImagePosition {
|
|
869
|
+
tl: { col: number; row: number };
|
|
870
|
+
ext: { width: number; height: number };
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
declare interface ImageRange {
|
|
874
|
+
tl: Anchor;
|
|
875
|
+
br: Anchor;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
declare interface JSZipGeneratorOptions {
|
|
879
|
+
/**
|
|
880
|
+
* @default DEFLATE
|
|
881
|
+
*/
|
|
882
|
+
compression: 'STORE' | 'DEFLATE';
|
|
883
|
+
compressionOptions: null | {
|
|
884
|
+
/**
|
|
885
|
+
* @default 6
|
|
886
|
+
*/
|
|
887
|
+
level: number;
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
declare interface Location_2 {
|
|
892
|
+
top: number;
|
|
893
|
+
left: number;
|
|
894
|
+
bottom: number;
|
|
895
|
+
right: number;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
declare interface Margins {
|
|
899
|
+
top: number;
|
|
900
|
+
left: number;
|
|
901
|
+
bottom: number;
|
|
902
|
+
right: number;
|
|
903
|
+
header: number;
|
|
904
|
+
footer: number;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
declare interface Media {
|
|
908
|
+
type: string; // image,background
|
|
909
|
+
name: string;
|
|
910
|
+
extension: string;
|
|
911
|
+
buffer: Buffer_2;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
declare interface PageSetup {
|
|
915
|
+
/**
|
|
916
|
+
* Whitespace on the borders of the page. Units are inches.
|
|
917
|
+
*/
|
|
918
|
+
margins: Margins;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Orientation of the page - i.e. taller (`'portrait'`) or wider (`'landscape'`).
|
|
922
|
+
*
|
|
923
|
+
* `'portrait'` by default
|
|
924
|
+
*/
|
|
925
|
+
orientation: 'portrait' | 'landscape';
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Horizontal Dots per Inch. Default value is 4294967295
|
|
929
|
+
*/
|
|
930
|
+
horizontalDpi: number;
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Vertical Dots per Inch. Default value is 4294967295
|
|
934
|
+
*/
|
|
935
|
+
verticalDpi: number;
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Whether to use fitToWidth and fitToHeight or scale settings.
|
|
939
|
+
*
|
|
940
|
+
* Default is based on presence of these settings in the pageSetup object - if both are present,
|
|
941
|
+
* scale wins (i.e. default will be false)
|
|
942
|
+
*/
|
|
943
|
+
fitToPage: boolean;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* How many pages wide the sheet should print on to. Active when fitToPage is true
|
|
947
|
+
*
|
|
948
|
+
* Default is 1
|
|
949
|
+
*/
|
|
950
|
+
fitToWidth: number;
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* How many pages high the sheet should print on to. Active when fitToPage is true
|
|
954
|
+
*
|
|
955
|
+
* Default is 1
|
|
956
|
+
*/
|
|
957
|
+
fitToHeight: number;
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Percentage value to increase or reduce the size of the print. Active when fitToPage is false
|
|
961
|
+
*
|
|
962
|
+
* Default is 100
|
|
963
|
+
*/
|
|
964
|
+
scale: number;
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Which order to print the pages.
|
|
968
|
+
*
|
|
969
|
+
* Default is `downThenOver`
|
|
970
|
+
*/
|
|
971
|
+
pageOrder: 'downThenOver' | 'overThenDown';
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Print without colour
|
|
975
|
+
*
|
|
976
|
+
* false by default
|
|
977
|
+
*/
|
|
978
|
+
blackAndWhite: boolean;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Print with less quality (and ink)
|
|
982
|
+
*
|
|
983
|
+
* false by default
|
|
984
|
+
*/
|
|
985
|
+
draft: boolean;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Where to place comments
|
|
989
|
+
*
|
|
990
|
+
* Default is `None`
|
|
991
|
+
*/
|
|
992
|
+
cellComments: 'atEnd' | 'asDisplayed' | 'None';
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Where to show errors
|
|
996
|
+
*
|
|
997
|
+
* Default is `displayed`
|
|
998
|
+
*/
|
|
999
|
+
errors: 'dash' | 'blank' | 'NA' | 'displayed';
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* What paper size to use (see below)
|
|
1003
|
+
*
|
|
1004
|
+
* | Name | Value |
|
|
1005
|
+
* | ----------------------------- | --------- |
|
|
1006
|
+
* | Letter | `undefined` |
|
|
1007
|
+
* | Legal | `5` |
|
|
1008
|
+
* | Executive | `7` |
|
|
1009
|
+
* | A4 | `9` |
|
|
1010
|
+
* | A5 | `11` |
|
|
1011
|
+
* | B5 (JIS) | `13` |
|
|
1012
|
+
* | Envelope #10 | `20` |
|
|
1013
|
+
* | Envelope DL | `27` |
|
|
1014
|
+
* | Envelope C5 | `28` |
|
|
1015
|
+
* | Envelope B5 | `34` |
|
|
1016
|
+
* | Envelope Monarch | `37` |
|
|
1017
|
+
* | Double Japan Postcard Rotated | `82` |
|
|
1018
|
+
* | 16K 197x273 mm | `119` |
|
|
1019
|
+
*/
|
|
1020
|
+
paperSize: PaperSize;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Whether to show the row numbers and column letters, `false` by default
|
|
1024
|
+
*/
|
|
1025
|
+
showRowColHeaders: boolean;
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Whether to show grid lines, `false` by default
|
|
1029
|
+
*/
|
|
1030
|
+
showGridLines: boolean;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Which number to use for the first page
|
|
1034
|
+
*/
|
|
1035
|
+
firstPageNumber: number;
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Whether to center the sheet data horizontally, `false` by default
|
|
1039
|
+
*/
|
|
1040
|
+
horizontalCentered: boolean;
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Whether to center the sheet data vertically, `false` by default
|
|
1044
|
+
*/
|
|
1045
|
+
verticalCentered: boolean;
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Set Print Area for a sheet, e.g. `'A1:G20'`
|
|
1049
|
+
*/
|
|
1050
|
+
printArea: string;
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Repeat specific rows on every printed page, e.g. `'1:3'`
|
|
1054
|
+
*/
|
|
1055
|
+
printTitlesRow: string;
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Repeat specific columns on every printed page, e.g. `'A:C'`
|
|
1059
|
+
*/
|
|
1060
|
+
printTitlesColumn: string;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
declare const enum PaperSize {
|
|
1064
|
+
Legal = 5,
|
|
1065
|
+
Executive = 7,
|
|
1066
|
+
A4 = 9,
|
|
1067
|
+
A5 = 11,
|
|
1068
|
+
B5 = 13,
|
|
1069
|
+
Envelope_10 = 20,
|
|
1070
|
+
Envelope_DL = 27,
|
|
1071
|
+
Envelope_C5 = 28,
|
|
1072
|
+
Envelope_B5 = 34,
|
|
1073
|
+
Envelope_Monarch = 37,
|
|
1074
|
+
Double_Japan_Postcard_Rotated = 82,
|
|
1075
|
+
K16_197x273_mm = 119,
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
declare interface PlanComponent {
|
|
1079
|
+
kind: ComponentKind;
|
|
1080
|
+
leftMm: number;
|
|
1081
|
+
topMm: number;
|
|
1082
|
+
widthMm: number;
|
|
1083
|
+
heightMm: number;
|
|
1084
|
+
nid?: string;
|
|
1085
|
+
rkey?: string;
|
|
1086
|
+
text?: string;
|
|
1087
|
+
rawText?: string;
|
|
1088
|
+
lines?: string[];
|
|
1089
|
+
richParagraphs?: RichParagraph[];
|
|
1090
|
+
imageData?: string;
|
|
1091
|
+
grid?: PlanGrid;
|
|
1092
|
+
style?: ComponentStyle;
|
|
1093
|
+
meta?: Record<string, unknown>;
|
|
1094
|
+
/** MachReport 扩展字段:未知 kind 的兜底渲染标记 */
|
|
1095
|
+
fallbackText?: string;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
declare interface PlanGrid {
|
|
1099
|
+
/** 行内允许 null 空位;渲染器按空单元格处理 */
|
|
1100
|
+
cells: (GridCell | null)[][];
|
|
1101
|
+
colWidthsMm?: number[];
|
|
1102
|
+
rowHeightsMm?: number[];
|
|
1103
|
+
gapMm?: number;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
declare interface PlanPage {
|
|
1107
|
+
pageWidthMm: number;
|
|
1108
|
+
pageHeightMm: number;
|
|
1109
|
+
marginTopMm?: number;
|
|
1110
|
+
marginBottomMm?: number;
|
|
1111
|
+
marginLeftMm?: number;
|
|
1112
|
+
marginRightMm?: number;
|
|
1113
|
+
components: PlanComponent[];
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
declare interface Protection {
|
|
1117
|
+
locked: boolean;
|
|
1118
|
+
hidden: boolean;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
declare interface QuoteColumnMap {
|
|
1122
|
+
[s: string]: boolean;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
declare type QuoteColumns = boolean | boolean[] | QuoteColumnMap;
|
|
1126
|
+
|
|
1127
|
+
declare interface Range_2 extends Location_2 {
|
|
1128
|
+
sheetName: string;
|
|
1129
|
+
|
|
1130
|
+
tl: string;
|
|
1131
|
+
$t$l: string;
|
|
1132
|
+
|
|
1133
|
+
br: string;
|
|
1134
|
+
$b$r: string;
|
|
1135
|
+
|
|
1136
|
+
range: string;
|
|
1137
|
+
$range: string;
|
|
1138
|
+
|
|
1139
|
+
shortRange: string;
|
|
1140
|
+
$shortRange: string;
|
|
1141
|
+
|
|
1142
|
+
count: number;
|
|
1143
|
+
|
|
1144
|
+
decode(): void;
|
|
1145
|
+
decode(v: Range_2): void;
|
|
1146
|
+
decode(v: string): void;
|
|
1147
|
+
decode(v: Location_2): void;
|
|
1148
|
+
decode(top: number, left: number, bottom: number, right: number, sheetName?: string): void;
|
|
1149
|
+
decode(tl: string, br: string, sheetName?: string): void;
|
|
1150
|
+
decode(v: [string, string]): void;
|
|
1151
|
+
decode(v: [string, string, string]): void;
|
|
1152
|
+
decode(v: [number, number, number, number]): void;
|
|
1153
|
+
decode(v: [number, number, number, number, string]): void;
|
|
1154
|
+
|
|
1155
|
+
expand(top: number, left: number, bottom: number, right: number): void;
|
|
1156
|
+
|
|
1157
|
+
expandRow(row: Row): void;
|
|
1158
|
+
|
|
1159
|
+
expandToAddress(addressStr: string): void;
|
|
1160
|
+
|
|
1161
|
+
toString(): string;
|
|
1162
|
+
|
|
1163
|
+
intersects(other: Range_2): boolean;
|
|
1164
|
+
|
|
1165
|
+
contains(addressStr: string): boolean;
|
|
1166
|
+
|
|
1167
|
+
containsEx(address: Partial<{
|
|
1168
|
+
sheetName: string;
|
|
1169
|
+
row: number;
|
|
1170
|
+
col: number;
|
|
1171
|
+
}>): boolean;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
declare enum ReadingOrder {
|
|
1175
|
+
LeftToRight = 1,
|
|
1176
|
+
RightToLeft = 2,
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
declare enum RelationshipType {
|
|
1180
|
+
None = 0,
|
|
1181
|
+
OfficeDocument = 1,
|
|
1182
|
+
Worksheet = 2,
|
|
1183
|
+
CalcChain = 3,
|
|
1184
|
+
SharedStrings = 4,
|
|
1185
|
+
Styles = 5,
|
|
1186
|
+
Theme = 6,
|
|
1187
|
+
Hyperlink = 7
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
declare interface RenderPlan {
|
|
1191
|
+
schemaVersion: string;
|
|
1192
|
+
pages: PlanPage[];
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
export declare function renderPlanToXlsx(plan: RenderPlan, options?: XlsxRenderOptions): Promise<XlsxRenderResult>;
|
|
1196
|
+
|
|
1197
|
+
declare interface RichParagraph {
|
|
1198
|
+
segments: RichSegment[];
|
|
1199
|
+
align?: ComponentStyle["align"];
|
|
1200
|
+
lineHeight?: number;
|
|
1201
|
+
spaceBeforeMm?: number;
|
|
1202
|
+
spaceAfterMm?: number;
|
|
1203
|
+
indentMm?: number;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
declare interface RichSegment {
|
|
1207
|
+
kind?: "text" | "field";
|
|
1208
|
+
text?: string;
|
|
1209
|
+
field?: string;
|
|
1210
|
+
style?: ComponentStyle;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
declare interface RichText {
|
|
1214
|
+
text: string;
|
|
1215
|
+
font?: Partial<Font>;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
declare interface Row extends Style {
|
|
1219
|
+
readonly worksheet: Worksheet;
|
|
1220
|
+
readonly hasValues: boolean;
|
|
1221
|
+
readonly dimensions: number;
|
|
1222
|
+
model: Partial<RowModel> | null;
|
|
1223
|
+
/**
|
|
1224
|
+
* Set a specific row height
|
|
1225
|
+
*/
|
|
1226
|
+
height: number;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Make row hidden
|
|
1230
|
+
*/
|
|
1231
|
+
hidden: boolean;
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Get a row as a sparse array
|
|
1235
|
+
*/
|
|
1236
|
+
// readonly values: CellValue[];
|
|
1237
|
+
values: CellValue[] | { [key: string]: CellValue };
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Set an outline level for rows
|
|
1241
|
+
*/
|
|
1242
|
+
outlineLevel?: number;
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* The row number
|
|
1246
|
+
*/
|
|
1247
|
+
readonly number: number;
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* Indicate the collapsed state based on outlineLevel
|
|
1251
|
+
*/
|
|
1252
|
+
readonly collapsed: boolean;
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Number of cells including empty ones
|
|
1256
|
+
*/
|
|
1257
|
+
readonly cellCount: number;
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Number of non-empty cells
|
|
1261
|
+
*/
|
|
1262
|
+
readonly actualCellCount: number;
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Get cell by number, column letter or column key
|
|
1266
|
+
*/
|
|
1267
|
+
getCell(indexOrKey: number | string): Cell;
|
|
1268
|
+
|
|
1269
|
+
findCell(colNumber: number): Cell | undefined;
|
|
1270
|
+
|
|
1271
|
+
getCellEx(address: Address): Cell;
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Iterate over all non-null cells in a row
|
|
1275
|
+
*/
|
|
1276
|
+
eachCell(callback: (cell: Cell, colNumber: number) => void): void;
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Iterate over all cells in a row (including empty cells)
|
|
1280
|
+
*/
|
|
1281
|
+
eachCell(opt: { includeEmpty: boolean }, callback: (cell: Cell, colNumber: number) => void): void;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Cut one or more cells (cells to the right are shifted left)
|
|
1285
|
+
*
|
|
1286
|
+
* Note: this operation will not affect other rows
|
|
1287
|
+
*/
|
|
1288
|
+
splice(start: number, count: number, ...insert: any[]): void;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Commit a completed row to stream
|
|
1292
|
+
*/
|
|
1293
|
+
commit(): void;
|
|
1294
|
+
destroy(): void;
|
|
1295
|
+
addPageBreak(lft?: number, rght?: number): void;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
declare type RowArray = string[];
|
|
1299
|
+
|
|
1300
|
+
declare interface RowBreak {
|
|
1301
|
+
id: number;
|
|
1302
|
+
max: number;
|
|
1303
|
+
min: number;
|
|
1304
|
+
man: number;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
declare type RowHashArray = [string, any][];
|
|
1308
|
+
|
|
1309
|
+
declare interface RowMap {
|
|
1310
|
+
[key: string]: any;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
declare interface RowModel {
|
|
1314
|
+
cells: CellModel[];
|
|
1315
|
+
number: number;
|
|
1316
|
+
min: number;
|
|
1317
|
+
max: number;
|
|
1318
|
+
height: number;
|
|
1319
|
+
style: Partial<Style>;
|
|
1320
|
+
hidden: boolean;
|
|
1321
|
+
outlineLevel: number;
|
|
1322
|
+
collapsed: boolean;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
declare type Rows = RowArray | RowMap | RowHashArray;
|
|
1326
|
+
|
|
1327
|
+
declare type RowTransformCallback = (error?: Error | null, row?: Rows) => void;
|
|
1328
|
+
|
|
1329
|
+
declare interface RowTransformFunction {
|
|
1330
|
+
(row: Rows, callback: RowTransformCallback): void;
|
|
1331
|
+
(row: Rows): Rows;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
declare type RowValues = CellValue[] | { [key: string]: CellValue } | undefined | null;
|
|
1335
|
+
|
|
1336
|
+
declare namespace stream {
|
|
1337
|
+
namespace xlsx {
|
|
1338
|
+
interface WorkbookWriterOptions {
|
|
1339
|
+
/**
|
|
1340
|
+
* Specifies a writable stream to write the XLSX workbook to.
|
|
1341
|
+
*/
|
|
1342
|
+
stream: Stream;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* If stream not specified, this field specifies the path to a file to write the XLSX workbook to.
|
|
1346
|
+
*/
|
|
1347
|
+
filename: string;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Specifies whether to use shared strings in the workbook. Default is false
|
|
1351
|
+
*/
|
|
1352
|
+
useSharedStrings: boolean;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Specifies whether to add style information to the workbook.
|
|
1356
|
+
* Styles can add some performance overhead. Default is false
|
|
1357
|
+
*/
|
|
1358
|
+
useStyles: boolean;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
interface ArchiverZipOptions {
|
|
1362
|
+
comment: string;
|
|
1363
|
+
forceLocalTime: boolean;
|
|
1364
|
+
forceZip64: boolean;
|
|
1365
|
+
store: boolean;
|
|
1366
|
+
zlib: Partial<ZlibOptions>;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
interface ZlibOptions {
|
|
1370
|
+
/**
|
|
1371
|
+
* @default constants.Z_NO_FLUSH
|
|
1372
|
+
*/
|
|
1373
|
+
flush: number;
|
|
1374
|
+
/**
|
|
1375
|
+
* @default constants.Z_FINISH
|
|
1376
|
+
*/
|
|
1377
|
+
finishFlush: number;
|
|
1378
|
+
/**
|
|
1379
|
+
* @default 16*1024
|
|
1380
|
+
*/
|
|
1381
|
+
chunkSize: number;
|
|
1382
|
+
windowBits: number;
|
|
1383
|
+
level: number; // compression only
|
|
1384
|
+
memLevel: number; // compression only
|
|
1385
|
+
strategy: number; // compression only
|
|
1386
|
+
dictionary: Buffer_2 | NodeJS.TypedArray | DataView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
interface WorkbookStreamWriterOptions extends WorkbookWriterOptions {
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Specifies whether to add style information to the workbook.
|
|
1393
|
+
* Styles can add some performance overhead. Default is false
|
|
1394
|
+
*/
|
|
1395
|
+
zip: Partial<ArchiverZipOptions>;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
class WorkbookWriter extends Workbook {
|
|
1399
|
+
constructor(options: Partial<WorkbookStreamWriterOptions>);
|
|
1400
|
+
// commit all worksheets, then add suplimentary files
|
|
1401
|
+
commit(): Promise<void>;
|
|
1402
|
+
addStyles(): Promise<void>;
|
|
1403
|
+
addThemes(): Promise<void>;
|
|
1404
|
+
addOfficeRels(): Promise<void>;
|
|
1405
|
+
addContentTypes(): Promise<void>;
|
|
1406
|
+
addApp(): Promise<void>;
|
|
1407
|
+
addCore(): Promise<void>;
|
|
1408
|
+
addSharedStrings(): Promise<void>;
|
|
1409
|
+
addWorkbookRels(): Promise<void>;
|
|
1410
|
+
addWorkbook(): Promise<void>;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
interface WorkbookStreamReaderOptions {
|
|
1415
|
+
/**
|
|
1416
|
+
* @default 'emit'
|
|
1417
|
+
*/
|
|
1418
|
+
worksheets?: 'emit' | 'ignore';
|
|
1419
|
+
/**
|
|
1420
|
+
* @default 'cache'
|
|
1421
|
+
*/
|
|
1422
|
+
sharedStrings?: 'cache' | 'emit' | 'ignore';
|
|
1423
|
+
/**
|
|
1424
|
+
* @default 'ignore'
|
|
1425
|
+
*/
|
|
1426
|
+
hyperlinks?: 'cache' | 'emit' | 'ignore';
|
|
1427
|
+
/**
|
|
1428
|
+
* @default 'ignore'
|
|
1429
|
+
*/
|
|
1430
|
+
styles?: 'cache' | 'ignore';
|
|
1431
|
+
/**
|
|
1432
|
+
* @default 'ignore'
|
|
1433
|
+
*/
|
|
1434
|
+
entries?: 'emit' | 'ignore';
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
class WorkbookReader extends Workbook {
|
|
1438
|
+
constructor(input: string | Stream, options: Partial<WorkbookStreamReaderOptions>);
|
|
1439
|
+
read(): Promise<void>;
|
|
1440
|
+
[Symbol.asyncIterator](): AsyncGenerator<WorksheetReader>;
|
|
1441
|
+
parse(): AsyncIterator<any>;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
interface WorksheetReaderOptions {
|
|
1445
|
+
workbook: Workbook;
|
|
1446
|
+
id: number;
|
|
1447
|
+
entry: Stream;
|
|
1448
|
+
options: WorkbookStreamReaderOptions;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
class WorksheetReader {
|
|
1452
|
+
constructor(options: WorksheetReaderOptions);
|
|
1453
|
+
read(): Promise<void>;
|
|
1454
|
+
[Symbol.asyncIterator](): AsyncGenerator<Row>;
|
|
1455
|
+
parse(): AsyncIterator<Array<any>>;
|
|
1456
|
+
dimensions(): number;
|
|
1457
|
+
columns(): number;
|
|
1458
|
+
getColumn(c: number): Column;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
declare interface Style {
|
|
1464
|
+
numFmt: string;
|
|
1465
|
+
font: Partial<Font>;
|
|
1466
|
+
alignment: Partial<Alignment>;
|
|
1467
|
+
protection: Partial<Protection>;
|
|
1468
|
+
border: Partial<Borders>;
|
|
1469
|
+
fill: Fill;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
declare interface Table extends Required<TableProperties> {
|
|
1473
|
+
/**
|
|
1474
|
+
* Commit changes
|
|
1475
|
+
*/
|
|
1476
|
+
commit: () => void
|
|
1477
|
+
/**
|
|
1478
|
+
* Remove a rows of data
|
|
1479
|
+
*/
|
|
1480
|
+
removeRows: (rowIndex: number, count: number) => void
|
|
1481
|
+
/**
|
|
1482
|
+
* Add a row of data, either insert at rowNumber or append
|
|
1483
|
+
*/
|
|
1484
|
+
addRow: (values: any[], rowNumber?: number) => void
|
|
1485
|
+
/**
|
|
1486
|
+
* Get column
|
|
1487
|
+
*/
|
|
1488
|
+
getColumn: (colIndex: number) => TableColumn
|
|
1489
|
+
/**
|
|
1490
|
+
* Add a new column, including column defn and values
|
|
1491
|
+
* inserts at colNumber or adds to the right
|
|
1492
|
+
*/
|
|
1493
|
+
addColumn: (column: TableColumnProperties, values: any[], colIndex: number) => void
|
|
1494
|
+
/**
|
|
1495
|
+
* Remove a column with data
|
|
1496
|
+
*/
|
|
1497
|
+
removeColumns: (colIndex: number, count: number) => void
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
declare type TableColumn = Required<TableColumnProperties>
|
|
1501
|
+
|
|
1502
|
+
declare interface TableColumnProperties {
|
|
1503
|
+
/**
|
|
1504
|
+
* The name of the column, also used in the header
|
|
1505
|
+
*/
|
|
1506
|
+
name: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* Switches the filter control in the header
|
|
1509
|
+
* @default false
|
|
1510
|
+
*/
|
|
1511
|
+
filterButton?: boolean;
|
|
1512
|
+
/**
|
|
1513
|
+
* Label to describe the totals row (first column)
|
|
1514
|
+
* @default 'Total'
|
|
1515
|
+
*/
|
|
1516
|
+
totalsRowLabel?: string;
|
|
1517
|
+
/**
|
|
1518
|
+
* Name of the totals function
|
|
1519
|
+
* @default 'none'
|
|
1520
|
+
*/
|
|
1521
|
+
totalsRowFunction?: 'none' | 'average' | 'countNums' | 'count' | 'max' | 'min' | 'stdDev' | 'var' | 'sum' | 'custom';
|
|
1522
|
+
/**
|
|
1523
|
+
* Optional formula for custom functions
|
|
1524
|
+
*/
|
|
1525
|
+
totalsRowFormula?: string;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
declare interface TableProperties {
|
|
1529
|
+
/**
|
|
1530
|
+
* The name of the table
|
|
1531
|
+
*/
|
|
1532
|
+
name: string;
|
|
1533
|
+
/**
|
|
1534
|
+
* The display name of the table
|
|
1535
|
+
*/
|
|
1536
|
+
displayName?: string;
|
|
1537
|
+
/**
|
|
1538
|
+
* Top left cell of the table
|
|
1539
|
+
*/
|
|
1540
|
+
ref: string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Show headers at top of table
|
|
1543
|
+
* @default true
|
|
1544
|
+
*/
|
|
1545
|
+
headerRow?: boolean;
|
|
1546
|
+
/**
|
|
1547
|
+
* Show totals at bottom of table
|
|
1548
|
+
* @default false
|
|
1549
|
+
*/
|
|
1550
|
+
totalsRow?: boolean;
|
|
1551
|
+
/**
|
|
1552
|
+
* Extra style properties
|
|
1553
|
+
* @default {}
|
|
1554
|
+
*/
|
|
1555
|
+
style?: TableStyleProperties;
|
|
1556
|
+
/**
|
|
1557
|
+
* Column definitions
|
|
1558
|
+
*/
|
|
1559
|
+
columns: TableColumnProperties[]
|
|
1560
|
+
/**
|
|
1561
|
+
* Rows of data
|
|
1562
|
+
*/
|
|
1563
|
+
rows: any[][]
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
declare interface TableStyleProperties {
|
|
1567
|
+
/**
|
|
1568
|
+
* The colour theme of the table
|
|
1569
|
+
* @default 'TableStyleMedium2'
|
|
1570
|
+
*/
|
|
1571
|
+
theme?: 'TableStyleDark1' | 'TableStyleDark10' | 'TableStyleDark11' | 'TableStyleDark2' | 'TableStyleDark3' | 'TableStyleDark4' | 'TableStyleDark5' | 'TableStyleDark6' | 'TableStyleDark7' | 'TableStyleDark8' | 'TableStyleDark9' | 'TableStyleLight1' | 'TableStyleLight10' | 'TableStyleLight11' | 'TableStyleLight12' | 'TableStyleLight13' | 'TableStyleLight14' | 'TableStyleLight15' | 'TableStyleLight16' | 'TableStyleLight17' | 'TableStyleLight18' | 'TableStyleLight19' | 'TableStyleLight2' | 'TableStyleLight20' | 'TableStyleLight21' | 'TableStyleLight3' | 'TableStyleLight4' | 'TableStyleLight5' | 'TableStyleLight6' | 'TableStyleLight7' | 'TableStyleLight8' | 'TableStyleLight9' | 'TableStyleMedium1' | 'TableStyleMedium10' | 'TableStyleMedium11' | 'TableStyleMedium12' | 'TableStyleMedium13' | 'TableStyleMedium14' | 'TableStyleMedium15' | 'TableStyleMedium16' | 'TableStyleMedium17' | 'TableStyleMedium18' | 'TableStyleMedium19' | 'TableStyleMedium2' | 'TableStyleMedium20' | 'TableStyleMedium21' | 'TableStyleMedium22' | 'TableStyleMedium23' | 'TableStyleMedium24' | 'TableStyleMedium25' | 'TableStyleMedium26' | 'TableStyleMedium27' | 'TableStyleMedium28' | 'TableStyleMedium3' | 'TableStyleMedium4' | 'TableStyleMedium5' | 'TableStyleMedium6' | 'TableStyleMedium7' | 'TableStyleMedium8' | 'TableStyleMedium9';
|
|
1572
|
+
/**
|
|
1573
|
+
* Highlight the first column (bold)
|
|
1574
|
+
* @default false
|
|
1575
|
+
*/
|
|
1576
|
+
showFirstColumn?: boolean;
|
|
1577
|
+
/**
|
|
1578
|
+
* Highlight the last column (bold)
|
|
1579
|
+
* @default false
|
|
1580
|
+
*/
|
|
1581
|
+
showLastColumn?: boolean;
|
|
1582
|
+
/**
|
|
1583
|
+
* Alternate rows shown with background colour
|
|
1584
|
+
* @default false
|
|
1585
|
+
*/
|
|
1586
|
+
showRowStripes?: boolean;
|
|
1587
|
+
/**
|
|
1588
|
+
* Alternate rows shown with background colour
|
|
1589
|
+
* @default false
|
|
1590
|
+
*/
|
|
1591
|
+
showColumnStripes?: boolean;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
declare interface TimePeriodRuleType extends ConditionalFormattingBaseRule {
|
|
1595
|
+
type: 'timePeriod';
|
|
1596
|
+
timePeriod?: TimePeriodTypes;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
declare type TimePeriodTypes = 'lastWeek' | 'thisWeek' | 'nextWeek' | 'yesterday' | 'today' | 'tomorrow' | 'last7Days' | 'lastMonth'
|
|
1600
|
+
| 'thisMonth' | 'nextMonth';
|
|
1601
|
+
|
|
1602
|
+
declare interface Top10RuleType extends ConditionalFormattingBaseRule {
|
|
1603
|
+
type: 'top10';
|
|
1604
|
+
rank: number;
|
|
1605
|
+
percent: boolean;
|
|
1606
|
+
bottom: boolean;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
declare enum ValueType {
|
|
1610
|
+
Null = 0,
|
|
1611
|
+
Merge = 1,
|
|
1612
|
+
Number = 2,
|
|
1613
|
+
String = 3,
|
|
1614
|
+
Date = 4,
|
|
1615
|
+
Hyperlink = 5,
|
|
1616
|
+
Formula = 6,
|
|
1617
|
+
SharedString = 7,
|
|
1618
|
+
RichText = 8,
|
|
1619
|
+
Boolean = 9,
|
|
1620
|
+
Error = 10
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
declare class Workbook {
|
|
1624
|
+
category: string;
|
|
1625
|
+
company: string;
|
|
1626
|
+
creator: string;
|
|
1627
|
+
description: string;
|
|
1628
|
+
keywords: string;
|
|
1629
|
+
lastModifiedBy: string;
|
|
1630
|
+
created: Date;
|
|
1631
|
+
manager: string;
|
|
1632
|
+
modified: Date;
|
|
1633
|
+
lastPrinted: Date;
|
|
1634
|
+
properties: WorkbookProperties;
|
|
1635
|
+
subject: string;
|
|
1636
|
+
title: string;
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* Workbook calculation Properties
|
|
1640
|
+
*/
|
|
1641
|
+
calcProperties: CalculationProperties;
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* xlsx file format operations
|
|
1645
|
+
*/
|
|
1646
|
+
readonly xlsx: Xlsx;
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* csv file format operations
|
|
1650
|
+
*/
|
|
1651
|
+
readonly csv: Csv;
|
|
1652
|
+
|
|
1653
|
+
readonly nextId: number;
|
|
1654
|
+
|
|
1655
|
+
readonly definedNames: DefinedNames;
|
|
1656
|
+
|
|
1657
|
+
model: WorkbookModel;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* The Workbook views controls how many separate windows Excel will open when viewing the workbook.
|
|
1661
|
+
*/
|
|
1662
|
+
views: WorkbookView[];
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* return a clone of worksheets in order
|
|
1666
|
+
*/
|
|
1667
|
+
worksheets: Worksheet[];
|
|
1668
|
+
|
|
1669
|
+
/**
|
|
1670
|
+
* Add a new worksheet and return a reference to it
|
|
1671
|
+
*/
|
|
1672
|
+
addWorksheet(name?: string, options?: Partial<AddWorksheetOptions>): Worksheet;
|
|
1673
|
+
|
|
1674
|
+
removeWorksheetEx(worksheet: Worksheet): void;
|
|
1675
|
+
removeWorksheet(indexOrName: number | string): void;
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* fetch sheet by name or id
|
|
1679
|
+
*/
|
|
1680
|
+
getWorksheet(indexOrName?: number | string): Worksheet | undefined;
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* Iterate over all sheets.
|
|
1684
|
+
*
|
|
1685
|
+
* Note: `workbook.worksheets.forEach` will still work but this is better.
|
|
1686
|
+
*/
|
|
1687
|
+
eachSheet(callback: (worksheet: Worksheet, id: number) => void): void;
|
|
1688
|
+
|
|
1689
|
+
clearThemes(): void;
|
|
1690
|
+
|
|
1691
|
+
/**
|
|
1692
|
+
* Add Image to Workbook and return the id
|
|
1693
|
+
*/
|
|
1694
|
+
addImage(img: Image_2): number;
|
|
1695
|
+
|
|
1696
|
+
getImage(id: number): Image_2;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
declare interface WorkbookModel {
|
|
1700
|
+
creator: string;
|
|
1701
|
+
lastModifiedBy: string;
|
|
1702
|
+
lastPrinted: Date;
|
|
1703
|
+
created: Date;
|
|
1704
|
+
modified: Date;
|
|
1705
|
+
properties: WorkbookProperties;
|
|
1706
|
+
worksheets: Worksheet[];
|
|
1707
|
+
sheets: WorksheetModel[];
|
|
1708
|
+
definedNames: DefinedNamesModel;
|
|
1709
|
+
views: WorkbookView[];
|
|
1710
|
+
company: string;
|
|
1711
|
+
manager: string;
|
|
1712
|
+
title: string;
|
|
1713
|
+
subject: string;
|
|
1714
|
+
keywords: string;
|
|
1715
|
+
category: string;
|
|
1716
|
+
description: string;
|
|
1717
|
+
language: string;
|
|
1718
|
+
revision: Date;
|
|
1719
|
+
contentStatus: string;
|
|
1720
|
+
themes: string[];
|
|
1721
|
+
media: Media[];
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
declare interface WorkbookProperties {
|
|
1725
|
+
/**
|
|
1726
|
+
* Set workbook dates to 1904 date system
|
|
1727
|
+
*/
|
|
1728
|
+
date1904: boolean;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
declare interface WorkbookView {
|
|
1732
|
+
x: number;
|
|
1733
|
+
y: number;
|
|
1734
|
+
width: number;
|
|
1735
|
+
height: number;
|
|
1736
|
+
firstSheet: number;
|
|
1737
|
+
activeTab: number;
|
|
1738
|
+
visibility: string;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
declare interface Worksheet {
|
|
1742
|
+
readonly id: number;
|
|
1743
|
+
name: string;
|
|
1744
|
+
readonly workbook: Workbook;
|
|
1745
|
+
readonly hasMerges: boolean;
|
|
1746
|
+
|
|
1747
|
+
readonly dimensions: Range_2;
|
|
1748
|
+
/**
|
|
1749
|
+
* Contains information related to how a worksheet is printed
|
|
1750
|
+
*/
|
|
1751
|
+
pageSetup: Partial<PageSetup>;
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* Worksheet Header and Footer
|
|
1755
|
+
*/
|
|
1756
|
+
headerFooter: Partial<HeaderFooter>;
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
* Worksheet State
|
|
1760
|
+
*/
|
|
1761
|
+
state: WorksheetState;
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* Worksheet Properties
|
|
1765
|
+
*/
|
|
1766
|
+
properties: WorksheetProperties;
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Open panes representing the sheet
|
|
1770
|
+
*/
|
|
1771
|
+
views: Array<Partial<WorksheetView>>;
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* Apply an auto filter to your worksheet.
|
|
1775
|
+
*/
|
|
1776
|
+
autoFilter?: AutoFilter;
|
|
1777
|
+
|
|
1778
|
+
destroy(): void;
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* A count of the number of rows that have values. If a mid-document row is empty, it will not be included in the count.
|
|
1782
|
+
*/
|
|
1783
|
+
readonly actualRowCount: number;
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* The total column size of the document. Equal to the maximum cell count from all of the rows
|
|
1787
|
+
*/
|
|
1788
|
+
readonly columnCount: number;
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* Get the last column in a worksheet
|
|
1792
|
+
*/
|
|
1793
|
+
readonly lastColumn: Column | undefined;
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* A count of the number of columns that have values.
|
|
1797
|
+
*/
|
|
1798
|
+
readonly actualColumnCount: number;
|
|
1799
|
+
|
|
1800
|
+
getColumnKey(key: string): Column;
|
|
1801
|
+
|
|
1802
|
+
setColumnKey(key: string, value: Column): void;
|
|
1803
|
+
|
|
1804
|
+
deleteColumnKey(key: string): void;
|
|
1805
|
+
|
|
1806
|
+
eachColumnKey(callback: (col: Column, index: number) => void): void;
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
* Access an individual columns by key, letter and 1-based column number
|
|
1810
|
+
*/
|
|
1811
|
+
getColumn(indexOrKey: number | string): Column;
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* Cut one or more columns (columns to the right are shifted left)
|
|
1815
|
+
* and optionally insert more
|
|
1816
|
+
*
|
|
1817
|
+
* If column properties have been definde, they will be cut or moved accordingly
|
|
1818
|
+
*
|
|
1819
|
+
* Known Issue: If a splice causes any merged cells to move, the results may be unpredictable
|
|
1820
|
+
*
|
|
1821
|
+
* Also: If the worksheet has more rows than values in the colulmn inserts,
|
|
1822
|
+
* the rows will still be shifted as if the values existed
|
|
1823
|
+
*/
|
|
1824
|
+
spliceColumns(start: number, count: number, ...insert: any[][]): void;
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Add column headers and define column keys and widths.
|
|
1828
|
+
*
|
|
1829
|
+
* Note: these column structures are a workbook-building convenience only,
|
|
1830
|
+
* apart from the column width, they will not be fully persisted.
|
|
1831
|
+
*/
|
|
1832
|
+
columns: Array<Partial<Column>>;
|
|
1833
|
+
|
|
1834
|
+
/**
|
|
1835
|
+
* The total row size of the document. Equal to the row number of the last row that has values.
|
|
1836
|
+
*/
|
|
1837
|
+
readonly rowCount: number;
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Get the last editable row in a worksheet (or undefined if there are none)
|
|
1841
|
+
*/
|
|
1842
|
+
readonly lastRow: Row | undefined;
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* Tries to find and return row for row no, else undefined
|
|
1846
|
+
*
|
|
1847
|
+
* @param row The 1-index row number
|
|
1848
|
+
*/
|
|
1849
|
+
findRow(row: number): Row | undefined;
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Tries to find and return rows for row no start and length, else undefined
|
|
1853
|
+
*
|
|
1854
|
+
* @param start The 1-index starting row number
|
|
1855
|
+
* @param length The length of the expected array
|
|
1856
|
+
*/
|
|
1857
|
+
findRows(start: number, length: number): Row[] | undefined;
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* Cut one or more rows (rows below are shifted up)
|
|
1861
|
+
* and optionally insert more
|
|
1862
|
+
*
|
|
1863
|
+
* Known Issue: If a splice causes any merged cells to move, the results may be unpredictable
|
|
1864
|
+
*/
|
|
1865
|
+
spliceRows(start: number, count: number, ...insert: any[][]): void;
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* Add a couple of Rows by key-value, after the last current row, using the column keys,
|
|
1869
|
+
* or add a row by contiguous Array (assign to columns A, B & C)
|
|
1870
|
+
*/
|
|
1871
|
+
addRow(data: any[] | any, style?: string): Row;
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Add multiple rows by providing an array of arrays or key-value pairs
|
|
1875
|
+
*/
|
|
1876
|
+
addRows(rows: any[], style?: string): Row[];
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Insert a Row by key-value, at the position (shifiting down all rows from position),
|
|
1880
|
+
* using the column keys, or add a row by contiguous Array (assign to columns A, B & C)
|
|
1881
|
+
*/
|
|
1882
|
+
insertRow(pos: number, value: any[] | any, style?: string): Row;
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* Insert multiple rows at position (shifiting down all rows from position)
|
|
1886
|
+
* by providing an array of arrays or key-value pairs
|
|
1887
|
+
*/
|
|
1888
|
+
insertRows(pos: number, values: any[], style?: string): Row[];
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* Duplicate rows and insert new rows
|
|
1892
|
+
*/
|
|
1893
|
+
duplicateRow(rowNum: number, count: number, insert: boolean): void;
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Get or create row by 1-based index
|
|
1897
|
+
*/
|
|
1898
|
+
getRow(index: number): Row;
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* Get or create rows by 1-based index
|
|
1902
|
+
*/
|
|
1903
|
+
getRows(start: number, length: number): Row[] | undefined;
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Iterate over all rows that have values in a worksheet
|
|
1907
|
+
*/
|
|
1908
|
+
eachRow(callback: (row: Row, rowNumber: number) => void): void;
|
|
1909
|
+
|
|
1910
|
+
/**
|
|
1911
|
+
* Iterate over all rows (including empty rows) in a worksheet
|
|
1912
|
+
*/
|
|
1913
|
+
eachRow(opt: { includeEmpty: boolean }, callback: (row: Row, rowNumber: number) => void): void;
|
|
1914
|
+
|
|
1915
|
+
/**
|
|
1916
|
+
* return all rows as sparse array
|
|
1917
|
+
*/
|
|
1918
|
+
getSheetValues(): RowValues[];
|
|
1919
|
+
|
|
1920
|
+
/**
|
|
1921
|
+
* returns the cell at [r,c] or address given by r. If not found, return undefined
|
|
1922
|
+
*/
|
|
1923
|
+
findCell(r: number | string, c: number | string): Cell | undefined;
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* Get or create cell
|
|
1927
|
+
*/
|
|
1928
|
+
getCell(r: number | string, c?: number | string): Cell;
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* Merge cells, either:
|
|
1932
|
+
*
|
|
1933
|
+
* tlbr string, e.g. `'A4:B5'`
|
|
1934
|
+
*
|
|
1935
|
+
* tl string, br string, e.g. `'G10', 'H11'`
|
|
1936
|
+
*
|
|
1937
|
+
* t, l, b, r numbers, e.g. `10,11,12,13`
|
|
1938
|
+
*/
|
|
1939
|
+
mergeCells(): void;
|
|
1940
|
+
mergeCells(v: Range_2): void;
|
|
1941
|
+
mergeCells(v: string): void;
|
|
1942
|
+
mergeCells(v: Location_2): void;
|
|
1943
|
+
mergeCells(top: number, left: number, bottom: number, right: number, sheetName?: string): void;
|
|
1944
|
+
mergeCells(tl: string, br: string, sheetName?: string): void;
|
|
1945
|
+
mergeCells(v: [string, string]): void;
|
|
1946
|
+
mergeCells(v: [string, string, string]): void;
|
|
1947
|
+
mergeCells(v: [number, number, number, number]): void;
|
|
1948
|
+
mergeCells(v: [number, number, number, number, string]): void;
|
|
1949
|
+
mergeCellsWithoutStyle(): void;
|
|
1950
|
+
mergeCellsWithoutStyle(v: Range_2): void;
|
|
1951
|
+
mergeCellsWithoutStyle(v: string): void;
|
|
1952
|
+
mergeCellsWithoutStyle(v: Location_2): void;
|
|
1953
|
+
mergeCellsWithoutStyle(top: number, left: number, bottom: number, right: number, sheetName?: string): void;
|
|
1954
|
+
mergeCellsWithoutStyle(tl: string, br: string, sheetName?: string): void;
|
|
1955
|
+
mergeCellsWithoutStyle(v: [string, string]): void;
|
|
1956
|
+
mergeCellsWithoutStyle(v: [string, string, string]): void;
|
|
1957
|
+
mergeCellsWithoutStyle(v: [number, number, number, number]): void;
|
|
1958
|
+
mergeCellsWithoutStyle(v: [number, number, number, number, string]): void;
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* unmerging the cells breaks the style links
|
|
1962
|
+
*/
|
|
1963
|
+
unMergeCells(): void;
|
|
1964
|
+
unMergeCells(v: Range_2): void;
|
|
1965
|
+
unMergeCells(v: string): void;
|
|
1966
|
+
unMergeCells(v: Location_2): void;
|
|
1967
|
+
unMergeCells(top: number, left: number, bottom: number, right: number, sheetName?: string): void;
|
|
1968
|
+
unMergeCells(tl: string, br: string, sheetName?: string): void;
|
|
1969
|
+
unMergeCells(v: [string, string]): void;
|
|
1970
|
+
unMergeCells(v: [string, string, string]): void;
|
|
1971
|
+
unMergeCells(v: [number, number, number, number]): void;
|
|
1972
|
+
unMergeCells(v: [number, number, number, number, string]): void;
|
|
1973
|
+
|
|
1974
|
+
fillFormula(range: Range_2 | string | Location_2, formula: string, results?: ((r: number, c: number) => string | number) | number[] | number[][]): void;
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Using the image id from `Workbook.addImage`, set the background to the worksheet
|
|
1978
|
+
*/
|
|
1979
|
+
addBackgroundImage(imageId: number): void;
|
|
1980
|
+
|
|
1981
|
+
getBackgroundImageId(): string;
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* Using the image id from `Workbook.addImage`,
|
|
1985
|
+
* embed an image within the worksheet to cover a range
|
|
1986
|
+
*/
|
|
1987
|
+
addImage(imageId: number, range: string | { editAs?: string; } & ImageRange & { hyperlinks?: ImageHyperlinkValue } | { editAs?: string; } & ImagePosition & { hyperlinks?: ImageHyperlinkValue }): void;
|
|
1988
|
+
|
|
1989
|
+
getImages(): Array<{
|
|
1990
|
+
type: 'image',
|
|
1991
|
+
imageId: string;
|
|
1992
|
+
range: ImageRange;
|
|
1993
|
+
}>;
|
|
1994
|
+
|
|
1995
|
+
commit(): void;
|
|
1996
|
+
|
|
1997
|
+
model: WorksheetModel;
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* Worksheet protection
|
|
2001
|
+
*/
|
|
2002
|
+
protect(password: string, options: Partial<WorksheetProtection>): Promise<void>;
|
|
2003
|
+
unprotect(): void;
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Add a new table and return a reference to it
|
|
2007
|
+
*/
|
|
2008
|
+
addTable(tableProperties: TableProperties): Table;
|
|
2009
|
+
/**
|
|
2010
|
+
* fetch table by name or id
|
|
2011
|
+
*/
|
|
2012
|
+
getTable(name: string): Table;
|
|
2013
|
+
/**
|
|
2014
|
+
* delete table by name or id
|
|
2015
|
+
*/
|
|
2016
|
+
removeTable(name: string): void;
|
|
2017
|
+
/**
|
|
2018
|
+
* fetch table
|
|
2019
|
+
*/
|
|
2020
|
+
getTables(): [Table, void][];
|
|
2021
|
+
/**
|
|
2022
|
+
* add conditionalFormattingOptions
|
|
2023
|
+
*/
|
|
2024
|
+
addConditionalFormatting(cf: ConditionalFormattingOptions): void;
|
|
2025
|
+
|
|
2026
|
+
/**
|
|
2027
|
+
* delete conditionalFormattingOptions
|
|
2028
|
+
*/
|
|
2029
|
+
removeConditionalFormatting(filter: any): void;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
declare interface WorksheetModel {
|
|
2033
|
+
id: number;
|
|
2034
|
+
name: string;
|
|
2035
|
+
// dataValidations: this.dataValidations.model,
|
|
2036
|
+
properties: WorksheetProperties;
|
|
2037
|
+
pageSetup: Partial<PageSetup>;
|
|
2038
|
+
headerFooter: Partial<HeaderFooter>;
|
|
2039
|
+
rowBreaks: RowBreak[];
|
|
2040
|
+
views: WorksheetView[];
|
|
2041
|
+
autoFilter: AutoFilter;
|
|
2042
|
+
media: Media[];
|
|
2043
|
+
merges: Range_2['range'][];
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
declare interface WorksheetProperties {
|
|
2047
|
+
/**
|
|
2048
|
+
* Color of the tab
|
|
2049
|
+
*/
|
|
2050
|
+
tabColor: Partial<Color>;
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* The worksheet column outline level (default: 0)
|
|
2054
|
+
*/
|
|
2055
|
+
outlineLevelCol: number;
|
|
2056
|
+
|
|
2057
|
+
/**
|
|
2058
|
+
* The worksheet row outline level (default: 0)
|
|
2059
|
+
*/
|
|
2060
|
+
outlineLevelRow: number;
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* The outline properties which controls how it will summarize rows and columns
|
|
2064
|
+
*/
|
|
2065
|
+
outlineProperties: {
|
|
2066
|
+
summaryBelow: boolean,
|
|
2067
|
+
summaryRight: boolean,
|
|
2068
|
+
};
|
|
2069
|
+
/**
|
|
2070
|
+
* Default row height (default: 15)
|
|
2071
|
+
*/
|
|
2072
|
+
defaultRowHeight: number;
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Default column width (optional)
|
|
2076
|
+
*/
|
|
2077
|
+
defaultColWidth?: number;
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* default: 55
|
|
2081
|
+
*/
|
|
2082
|
+
dyDescent: number;
|
|
2083
|
+
showGridLines: boolean;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
declare interface WorksheetProtection {
|
|
2087
|
+
objects: boolean;
|
|
2088
|
+
scenarios: boolean;
|
|
2089
|
+
selectLockedCells: boolean;
|
|
2090
|
+
selectUnlockedCells: boolean;
|
|
2091
|
+
formatCells: boolean;
|
|
2092
|
+
formatColumns: boolean;
|
|
2093
|
+
formatRows: boolean;
|
|
2094
|
+
insertColumns: boolean;
|
|
2095
|
+
insertRows: boolean;
|
|
2096
|
+
insertHyperlinks: boolean;
|
|
2097
|
+
deleteColumns: boolean;
|
|
2098
|
+
deleteRows: boolean;
|
|
2099
|
+
sort: boolean;
|
|
2100
|
+
autoFilter: boolean;
|
|
2101
|
+
pivotTables: boolean;
|
|
2102
|
+
spinCount: number;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
declare type WorksheetState = 'visible' | 'hidden' | 'veryHidden';
|
|
2106
|
+
|
|
2107
|
+
declare type WorksheetView =
|
|
2108
|
+
& WorksheetViewCommon
|
|
2109
|
+
& (WorksheetViewNormal | WorksheetViewFrozen | WorksheetViewSplit);
|
|
2110
|
+
|
|
2111
|
+
declare interface WorksheetViewCommon {
|
|
2112
|
+
/**
|
|
2113
|
+
* Sets the worksheet view's orientation to right-to-left, `false` by default
|
|
2114
|
+
*/
|
|
2115
|
+
rightToLeft: boolean;
|
|
2116
|
+
|
|
2117
|
+
/**
|
|
2118
|
+
* The currently selected cell
|
|
2119
|
+
*/
|
|
2120
|
+
activeCell: string;
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* Shows or hides the ruler in Page Layout, `true` by default
|
|
2124
|
+
*/
|
|
2125
|
+
showRuler: boolean;
|
|
2126
|
+
|
|
2127
|
+
/**
|
|
2128
|
+
* Shows or hides the row and column headers (e.g. A1, B1 at the top and 1,2,3 on the left,
|
|
2129
|
+
* `true` by default
|
|
2130
|
+
*/
|
|
2131
|
+
showRowColHeaders: boolean;
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* Shows or hides the gridlines (shown for cells where borders have not been defined),
|
|
2135
|
+
* `true` by default
|
|
2136
|
+
*/
|
|
2137
|
+
showGridLines: boolean;
|
|
2138
|
+
|
|
2139
|
+
/**
|
|
2140
|
+
* Percentage zoom to use for the view, `100` by default
|
|
2141
|
+
*/
|
|
2142
|
+
zoomScale: number;
|
|
2143
|
+
|
|
2144
|
+
/**
|
|
2145
|
+
* Normal zoom for the view, `100` by default
|
|
2146
|
+
*/
|
|
2147
|
+
zoomScaleNormal: number;
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
declare interface WorksheetViewFrozen {
|
|
2151
|
+
/**
|
|
2152
|
+
* Where a number of rows and columns to the top and left are frozen in place.
|
|
2153
|
+
* Only the bottom left section will scroll
|
|
2154
|
+
*/
|
|
2155
|
+
state: 'frozen';
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* Presentation style
|
|
2159
|
+
*/
|
|
2160
|
+
style?: 'pageBreakPreview';
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* How many columns to freeze. To freeze rows only, set this to 0 or undefined
|
|
2164
|
+
*/
|
|
2165
|
+
xSplit?: number;
|
|
2166
|
+
|
|
2167
|
+
/**
|
|
2168
|
+
* How many rows to freeze. To freeze columns only, set this to 0 or undefined
|
|
2169
|
+
*/
|
|
2170
|
+
ySplit?: number;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* Which cell will be top-left in the bottom-right pane. Note: cannot be a frozen cell.
|
|
2174
|
+
* Defaults to first unfrozen cell
|
|
2175
|
+
*/
|
|
2176
|
+
topLeftCell?: string;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
declare interface WorksheetViewNormal {
|
|
2180
|
+
/**
|
|
2181
|
+
* Controls the view state
|
|
2182
|
+
*/
|
|
2183
|
+
state: 'normal';
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Presentation style
|
|
2187
|
+
*/
|
|
2188
|
+
style: 'pageBreakPreview' | 'pageLayout';
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
declare interface WorksheetViewSplit {
|
|
2192
|
+
/**
|
|
2193
|
+
* Where the view is split into 4 sections, each semi-independently scrollable.
|
|
2194
|
+
*/
|
|
2195
|
+
state: 'split';
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* Presentation style
|
|
2199
|
+
*/
|
|
2200
|
+
style?: 'pageBreakPreview' | 'pageLayout';
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* How many points from the left to place the splitter.
|
|
2204
|
+
* To split vertically, set this to 0 or undefined
|
|
2205
|
+
*/
|
|
2206
|
+
xSplit?: number;
|
|
2207
|
+
|
|
2208
|
+
/**
|
|
2209
|
+
* How many points from the top to place the splitter.
|
|
2210
|
+
* To split horizontally, set this to 0 or undefined
|
|
2211
|
+
*/
|
|
2212
|
+
ySplit?: number;
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Which cell will be top-left in the bottom-right pane
|
|
2216
|
+
*/
|
|
2217
|
+
topLeftCell?: string;
|
|
2218
|
+
|
|
2219
|
+
/**
|
|
2220
|
+
* Which pane will be active
|
|
2221
|
+
*/
|
|
2222
|
+
activePane?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
declare interface Xlsx {
|
|
2226
|
+
/**
|
|
2227
|
+
* read from a file
|
|
2228
|
+
*/
|
|
2229
|
+
readFile(path: string, options?: Partial<XlsxReadOptions>): Promise<Workbook>;
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* read from a stream
|
|
2233
|
+
* @param stream
|
|
2234
|
+
*/
|
|
2235
|
+
read(stream: Stream, options?: Partial<XlsxReadOptions>): Promise<Workbook>;
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* load from an array buffer
|
|
2239
|
+
* @param buffer
|
|
2240
|
+
*/
|
|
2241
|
+
load(buffer: Buffer_2, options?: Partial<XlsxReadOptions>): Promise<Workbook>;
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
* write to a buffer
|
|
2245
|
+
*/
|
|
2246
|
+
writeBuffer(options?: Partial<XlsxWriteOptions>): Promise<Buffer_2>;
|
|
2247
|
+
|
|
2248
|
+
/**
|
|
2249
|
+
* write to a file
|
|
2250
|
+
*/
|
|
2251
|
+
writeFile(path: string, options?: Partial<XlsxWriteOptions>): Promise<void>;
|
|
2252
|
+
|
|
2253
|
+
/**
|
|
2254
|
+
* write to a stream
|
|
2255
|
+
*/
|
|
2256
|
+
write(stream: Stream, options?: Partial<XlsxWriteOptions>): Promise<void>;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
declare interface XlsxReadOptions {
|
|
2260
|
+
/**
|
|
2261
|
+
* The list of XML node names to ignore while parsing an XLSX file
|
|
2262
|
+
*/
|
|
2263
|
+
ignoreNodes: string[];
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* RenderPlan → xlsx 导出(B 端第二出口,对齐家族 @agile-team/mach-table-xlsx 路线):
|
|
2268
|
+
* - 网格组件 → 真表格:列宽(mm→Excel 宽度)、行高(mm→pt)、colSpan/rowSpan 合并、
|
|
2269
|
+
* 加粗/对齐/底色/字号直译(resolveGridLayout 复用单真相源几何)
|
|
2270
|
+
* - 文本组件 → 合并标题行(顺序流式输出,保字号/加粗/对齐;非像素级定位,
|
|
2271
|
+
* 目标是"财务能直接用的对账表"而非复刻版面)
|
|
2272
|
+
* - 未支持组件、富文本专有内容与单元格嵌套组件跳过并计入 warnings
|
|
2273
|
+
*/
|
|
2274
|
+
export declare interface XlsxRenderOptions {
|
|
2275
|
+
/** 工作表命名(默认 "Sheet1" 起序) */
|
|
2276
|
+
sheetName?: (pageIndex: number) => string;
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
export declare interface XlsxRenderResult {
|
|
2280
|
+
workbook: ExcelJS.Workbook;
|
|
2281
|
+
buffer: ExcelJS.Buffer;
|
|
2282
|
+
warnings: string[];
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
declare interface XlsxWriteOptions extends stream.xlsx.WorkbookWriterOptions {
|
|
2286
|
+
/**
|
|
2287
|
+
* The option passed to JsZip#generateAsync(options)
|
|
2288
|
+
*/
|
|
2289
|
+
zip: Partial<JSZipGeneratorOptions>;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
export { }
|