@office-open/xlsx 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -0
- package/dist/index.d.ts +349 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1628 -0
- package/dist/index.js.map +1 -0
- package/package.json +13 -6
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @office-open/xlsx
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
> Generate and parse .xlsx files with JS/TS with a declarative API.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 📗 **Workbook Generation** — Create spreadsheets with multiple worksheets
|
|
12
|
+
- 📊 **Cell Data** — Strings, numbers, booleans, dates, and inline strings
|
|
13
|
+
- 🎨 **Styles** — Fonts, fills, borders, alignment, and number formats via index-based style system
|
|
14
|
+
- 🔀 **Merged Cells** — Merge cell ranges across rows and columns
|
|
15
|
+
- 📏 **Column Width & Row Height** — Custom column widths and row heights with hiding support
|
|
16
|
+
- ❄️ **Freeze Panes** — Freeze rows and/or columns for scrollable headers
|
|
17
|
+
- 🔽 **Auto Filter** — Add auto-filter dropdowns to column headers
|
|
18
|
+
- 🖼️ **Images** — Embed PNG and JPEG images anchored to cells
|
|
19
|
+
- 📈 **Charts** — Bar, line, pie, area, and scatter charts with customization
|
|
20
|
+
- ✅ **Data Validation** — List, whole number, decimal, date, and custom validations
|
|
21
|
+
- 🎯 **Conditional Formatting** — Cell value-based rules with formatting
|
|
22
|
+
- 📖 **Parsing** — Parse existing .xlsx files with `parseWorkbook` for round-trip workflows
|
|
23
|
+
- 🔧 **Template Patching** — Patch existing XLSX templates via placeholder replacement
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Install with npm
|
|
29
|
+
$ npm install @office-open/xlsx
|
|
30
|
+
|
|
31
|
+
# Install with pnpm
|
|
32
|
+
$ pnpm add @office-open/xlsx
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Workbook, Packer } from "@office-open/xlsx";
|
|
39
|
+
import { writeFileSync } from "node:fs";
|
|
40
|
+
|
|
41
|
+
const wb = new Workbook({
|
|
42
|
+
worksheets: [
|
|
43
|
+
{
|
|
44
|
+
name: "Sheet1",
|
|
45
|
+
children: [
|
|
46
|
+
{ cells: [{ value: "Name" }, { value: "Score" }] },
|
|
47
|
+
{ cells: [{ value: "Alice" }, { value: 95 }] },
|
|
48
|
+
{ cells: [{ value: "Bob" }, { value: 87 }] },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const buffer = await Packer.toBuffer(wb);
|
|
55
|
+
writeFileSync("workbook.xlsx", buffer);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
Check the [demo folder](./demo) for working examples covering every feature.
|
|
61
|
+
|
|
62
|
+
## Benchmark
|
|
63
|
+
|
|
64
|
+
Performance comparison against [hucre](https://github.com/nicolo-ribaudo/hucre) (0.6.0) (higher ops/s is better, Windows 11 / Node 24).
|
|
65
|
+
|
|
66
|
+
DEFLATE = compressed (default), STORE = no compression.
|
|
67
|
+
|
|
68
|
+
**Create + toBuffer (end-to-end)**
|
|
69
|
+
|
|
70
|
+
| Scenario | DEFLATE sync | STORE sync | DEFLATE async | STORE async | hucre |
|
|
71
|
+
| ---------------- | -----------: | -----------: | ------------: | -----------: | ---------: |
|
|
72
|
+
| Simple (3 rows) | 547 ops/s | 13,823 ops/s | 558 ops/s | 14,536 ops/s | 926 ops/s |
|
|
73
|
+
| Styled rows (20) | 645 ops/s | 11,275 ops/s | 644 ops/s | 11,576 ops/s | 960 ops/s |
|
|
74
|
+
| Table (10×5) | 707 ops/s | 12,369 ops/s | 734 ops/s | 11,447 ops/s | 1045 ops/s |
|
|
75
|
+
|
|
76
|
+
**Large Files — Create + toBuffer**
|
|
77
|
+
|
|
78
|
+
| Scenario | DEFLATE sync | STORE sync | DEFLATE async | STORE async | hucre |
|
|
79
|
+
| -------------------- | -----------: | ----------: | ------------: | ----------: | ----------: |
|
|
80
|
+
| 2000 rows | 50.2 ops/s | 211.1 ops/s | 20.6 ops/s | 207.5 ops/s | 85.0 ops/s |
|
|
81
|
+
| 200×10 table | 167.4 ops/s | 623.0 ops/s | 190.7 ops/s | 772.3 ops/s | 253.2 ops/s |
|
|
82
|
+
| 20 sheets × 100 rows | 87.2 ops/s | 196.4 ops/s | 93.7 ops/s | 248.6 ops/s | 87.7 ops/s |
|
|
83
|
+
|
|
84
|
+
**Large Data — 100,000 rows × 20 columns (2M cells)**
|
|
85
|
+
|
|
86
|
+
| Method | Speed | Speedup |
|
|
87
|
+
| ------------- | ----------: | --------: |
|
|
88
|
+
| DEFLATE sync | 0.274 ops/s | 0.73x |
|
|
89
|
+
| STORE sync | 0.558 ops/s | **1.48x** |
|
|
90
|
+
| DEFLATE async | 0.281 ops/s | 0.75x |
|
|
91
|
+
| STORE async | 0.694 ops/s | **1.85x** |
|
|
92
|
+
| hucre | 0.376 ops/s | |
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
- [MIT](LICENSE) © [Demo Macro](https://imst.xyz/)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import * as _$_office_open_core0 from "@office-open/core";
|
|
2
|
+
import { AppProperties, BaseXmlComponent, ChartCollection, ChartSpaceOptions, Context, IXmlableObject, IgnoreIfEmptyXmlComponent, OutputByType, OutputByType as OutputByType$1, OutputType, OutputType as OutputType$1, ParsedArchive, Relationships } from "@office-open/core";
|
|
3
|
+
import { Element } from "@office-open/xml";
|
|
4
|
+
import { DataType } from "undio";
|
|
5
|
+
import { Buffer } from "\u0000polyfill-node.buffer";
|
|
6
|
+
|
|
7
|
+
//#region src/file/content-types.d.ts
|
|
8
|
+
declare class ContentTypes extends BaseXmlComponent {
|
|
9
|
+
private readonly dynamicEntries;
|
|
10
|
+
constructor();
|
|
11
|
+
addWorksheet(index: number): void;
|
|
12
|
+
addStyles(): void;
|
|
13
|
+
addSharedStrings(): void;
|
|
14
|
+
addTheme(index?: number): void;
|
|
15
|
+
addChart(index: number): void;
|
|
16
|
+
addDrawing(index: number): void;
|
|
17
|
+
prepForXml(_context: Context): IXmlableObject;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/file/core-properties.d.ts
|
|
21
|
+
interface CorePropertiesOptions {
|
|
22
|
+
readonly title?: string;
|
|
23
|
+
readonly subject?: string;
|
|
24
|
+
readonly creator?: string;
|
|
25
|
+
readonly keywords?: string;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly lastModifiedBy?: string;
|
|
28
|
+
readonly revision?: number;
|
|
29
|
+
}
|
|
30
|
+
declare class CoreProperties extends BaseXmlComponent {
|
|
31
|
+
private readonly options;
|
|
32
|
+
constructor(options: CorePropertiesOptions);
|
|
33
|
+
prepForXml(_context: Context): IXmlableObject;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/file/media/media.d.ts
|
|
37
|
+
interface MediaData {
|
|
38
|
+
readonly fileName: string;
|
|
39
|
+
readonly type: string;
|
|
40
|
+
readonly data: Uint8Array;
|
|
41
|
+
readonly width: number;
|
|
42
|
+
readonly height: number;
|
|
43
|
+
}
|
|
44
|
+
declare class Media {
|
|
45
|
+
private readonly map;
|
|
46
|
+
addImage(key: string, data: MediaData): void;
|
|
47
|
+
get array(): readonly MediaData[];
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/file/shared-strings.d.ts
|
|
51
|
+
declare class SharedStrings extends BaseXmlComponent {
|
|
52
|
+
private readonly strings;
|
|
53
|
+
private readonly indexMap;
|
|
54
|
+
constructor();
|
|
55
|
+
register(s: string): number;
|
|
56
|
+
get count(): number;
|
|
57
|
+
toXml(_context: Context): string;
|
|
58
|
+
prepForXml(_context: Context): IXmlableObject;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/file/styles.d.ts
|
|
62
|
+
interface FontOptions {
|
|
63
|
+
readonly bold?: boolean;
|
|
64
|
+
readonly italic?: boolean;
|
|
65
|
+
readonly underline?: boolean;
|
|
66
|
+
readonly strike?: boolean;
|
|
67
|
+
readonly size?: number;
|
|
68
|
+
readonly color?: string;
|
|
69
|
+
readonly fontName?: string;
|
|
70
|
+
}
|
|
71
|
+
interface FillOptions {
|
|
72
|
+
readonly type?: "solid" | "pattern";
|
|
73
|
+
readonly color?: string;
|
|
74
|
+
readonly patternType?: string;
|
|
75
|
+
}
|
|
76
|
+
interface BorderOptions {
|
|
77
|
+
readonly style?: "thin" | "medium" | "thick" | "dotted" | "dashed" | "hair" | "none";
|
|
78
|
+
readonly color?: string;
|
|
79
|
+
}
|
|
80
|
+
interface BorderSideOptions {
|
|
81
|
+
readonly top?: BorderOptions;
|
|
82
|
+
readonly bottom?: BorderOptions;
|
|
83
|
+
readonly left?: BorderOptions;
|
|
84
|
+
readonly right?: BorderOptions;
|
|
85
|
+
readonly diagonal?: BorderOptions;
|
|
86
|
+
}
|
|
87
|
+
interface AlignmentOptions {
|
|
88
|
+
readonly horizontal?: "left" | "center" | "right" | "fill" | "justify";
|
|
89
|
+
readonly vertical?: "top" | "center" | "bottom";
|
|
90
|
+
readonly wrapText?: boolean;
|
|
91
|
+
readonly textRotation?: number;
|
|
92
|
+
readonly indent?: number;
|
|
93
|
+
}
|
|
94
|
+
interface StyleOptions {
|
|
95
|
+
readonly font?: FontOptions;
|
|
96
|
+
readonly fill?: FillOptions;
|
|
97
|
+
readonly border?: BorderSideOptions;
|
|
98
|
+
readonly numFmt?: string;
|
|
99
|
+
readonly alignment?: AlignmentOptions;
|
|
100
|
+
}
|
|
101
|
+
declare class Styles extends BaseXmlComponent {
|
|
102
|
+
private readonly fonts;
|
|
103
|
+
private readonly fontKeys;
|
|
104
|
+
private readonly fills;
|
|
105
|
+
private readonly fillKeys;
|
|
106
|
+
private readonly borders;
|
|
107
|
+
private readonly borderKeys;
|
|
108
|
+
private readonly customNumFmts;
|
|
109
|
+
private nextCustomNumFmtId;
|
|
110
|
+
private readonly cellXfs;
|
|
111
|
+
private readonly cellXfKeys;
|
|
112
|
+
constructor();
|
|
113
|
+
register(opts: StyleOptions): number;
|
|
114
|
+
private registerFont;
|
|
115
|
+
private registerFill;
|
|
116
|
+
private registerBorder;
|
|
117
|
+
private registerNumFmt;
|
|
118
|
+
private cellXfKey;
|
|
119
|
+
toXml(_context: Context): string;
|
|
120
|
+
private fontXmlStr;
|
|
121
|
+
private borderXmlStr;
|
|
122
|
+
private alignmentXmlStr;
|
|
123
|
+
prepForXml(_context: Context): IXmlableObject;
|
|
124
|
+
private buildFonts;
|
|
125
|
+
private fontXml;
|
|
126
|
+
private buildFills;
|
|
127
|
+
private buildBorders;
|
|
128
|
+
private borderXml;
|
|
129
|
+
private buildCellXfs;
|
|
130
|
+
private alignmentXml;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/file/theme.d.ts
|
|
134
|
+
declare class DefaultTheme extends BaseXmlComponent {
|
|
135
|
+
constructor();
|
|
136
|
+
toXml(_context: Context): string;
|
|
137
|
+
prepForXml(_context: Context): IXmlableObject;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/file/workbook.d.ts
|
|
141
|
+
interface SheetDefinition {
|
|
142
|
+
readonly name: string;
|
|
143
|
+
readonly sheetId: number;
|
|
144
|
+
readonly rId: string;
|
|
145
|
+
readonly state?: "visible" | "hidden" | "veryHidden";
|
|
146
|
+
}
|
|
147
|
+
declare class WorkbookXml extends BaseXmlComponent {
|
|
148
|
+
private readonly sheets;
|
|
149
|
+
constructor(sheets: readonly SheetDefinition[]);
|
|
150
|
+
prepForXml(_context: Context): IXmlableObject;
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/file/worksheet.d.ts
|
|
154
|
+
interface ColumnOptions {
|
|
155
|
+
readonly min: number;
|
|
156
|
+
readonly max: number;
|
|
157
|
+
readonly width?: number;
|
|
158
|
+
readonly hidden?: boolean;
|
|
159
|
+
readonly customWidth?: boolean;
|
|
160
|
+
}
|
|
161
|
+
interface RowOptions {
|
|
162
|
+
readonly cells?: readonly CellOptions[];
|
|
163
|
+
readonly height?: number;
|
|
164
|
+
readonly hidden?: boolean;
|
|
165
|
+
readonly rowNumber?: number;
|
|
166
|
+
}
|
|
167
|
+
interface CellOptions {
|
|
168
|
+
readonly value?: string | number | boolean | Date | null;
|
|
169
|
+
readonly reference?: string;
|
|
170
|
+
readonly styleIndex?: number;
|
|
171
|
+
readonly style?: StyleOptions;
|
|
172
|
+
}
|
|
173
|
+
interface MergeCellOptions {
|
|
174
|
+
readonly from: {
|
|
175
|
+
readonly row: number;
|
|
176
|
+
readonly col: number;
|
|
177
|
+
};
|
|
178
|
+
readonly to: {
|
|
179
|
+
readonly row: number;
|
|
180
|
+
readonly col: number;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
interface FreezePaneOptions {
|
|
184
|
+
readonly row?: number;
|
|
185
|
+
readonly col?: number;
|
|
186
|
+
}
|
|
187
|
+
interface WorksheetImageOptions {
|
|
188
|
+
readonly data: Uint8Array;
|
|
189
|
+
readonly type: "png" | "jpeg" | "jpg";
|
|
190
|
+
readonly col: number;
|
|
191
|
+
readonly row: number;
|
|
192
|
+
}
|
|
193
|
+
interface WorksheetChartOptions extends ChartSpaceOptions {
|
|
194
|
+
readonly col: number;
|
|
195
|
+
readonly row: number;
|
|
196
|
+
}
|
|
197
|
+
type DataValidationType = "none" | "whole" | "decimal" | "list" | "date" | "time" | "textLength" | "custom";
|
|
198
|
+
type DataValidationOperator = "between" | "notBetween" | "equal" | "notEqual" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
199
|
+
interface DataValidationOptions {
|
|
200
|
+
readonly sqref: string;
|
|
201
|
+
readonly type?: DataValidationType;
|
|
202
|
+
readonly operator?: DataValidationOperator;
|
|
203
|
+
readonly formula1?: string;
|
|
204
|
+
readonly formula2?: string;
|
|
205
|
+
readonly allowBlank?: boolean;
|
|
206
|
+
readonly showErrorMessage?: boolean;
|
|
207
|
+
readonly errorTitle?: string;
|
|
208
|
+
readonly error?: string;
|
|
209
|
+
readonly showInputMessage?: boolean;
|
|
210
|
+
readonly promptTitle?: string;
|
|
211
|
+
readonly prompt?: string;
|
|
212
|
+
}
|
|
213
|
+
type ConditionalFormatType = "cellIs" | "containsText" | "expression" | "top10" | "aboveAverage";
|
|
214
|
+
type ConditionalFormatOperator = "lessThan" | "lessThanOrEqual" | "equal" | "notEqual" | "greaterThanOrEqual" | "greaterThan" | "between" | "notBetween" | "containsText" | "notContains" | "beginsWith" | "endsWith";
|
|
215
|
+
interface ConditionalFormatRule {
|
|
216
|
+
readonly type: ConditionalFormatType;
|
|
217
|
+
readonly operator?: ConditionalFormatOperator;
|
|
218
|
+
readonly formulas?: readonly string[];
|
|
219
|
+
readonly priority?: number;
|
|
220
|
+
readonly dxfId?: number;
|
|
221
|
+
}
|
|
222
|
+
interface ConditionalFormatOptions {
|
|
223
|
+
readonly sqref: string;
|
|
224
|
+
readonly rules: readonly ConditionalFormatRule[];
|
|
225
|
+
}
|
|
226
|
+
interface WorksheetOptions {
|
|
227
|
+
readonly name?: string;
|
|
228
|
+
readonly children?: readonly RowOptions[];
|
|
229
|
+
readonly columns?: readonly ColumnOptions[];
|
|
230
|
+
readonly mergeCells?: readonly MergeCellOptions[];
|
|
231
|
+
readonly freezePanes?: FreezePaneOptions;
|
|
232
|
+
readonly autoFilter?: string;
|
|
233
|
+
readonly images?: readonly WorksheetImageOptions[];
|
|
234
|
+
readonly charts?: readonly WorksheetChartOptions[];
|
|
235
|
+
readonly dataValidations?: readonly DataValidationOptions[];
|
|
236
|
+
readonly conditionalFormats?: readonly ConditionalFormatOptions[];
|
|
237
|
+
}
|
|
238
|
+
declare class Worksheet extends IgnoreIfEmptyXmlComponent {
|
|
239
|
+
private readonly rows;
|
|
240
|
+
private readonly columns;
|
|
241
|
+
private readonly mergeCells;
|
|
242
|
+
private readonly freezePanes?;
|
|
243
|
+
private readonly autoFilter?;
|
|
244
|
+
private readonly images;
|
|
245
|
+
private readonly chartOptions;
|
|
246
|
+
private readonly dataValidations;
|
|
247
|
+
private readonly conditionalFormats;
|
|
248
|
+
constructor(options: WorksheetOptions);
|
|
249
|
+
get imageOptions(): readonly WorksheetImageOptions[];
|
|
250
|
+
get charts(): readonly WorksheetChartOptions[];
|
|
251
|
+
prepForXml(context: Context): IXmlableObject | undefined;
|
|
252
|
+
toXml(context: Context): string;
|
|
253
|
+
private buildCellString;
|
|
254
|
+
private defaultCellRef;
|
|
255
|
+
private columnToLetter;
|
|
256
|
+
private buildCell;
|
|
257
|
+
private dateToSerialNumber;
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/file/file.d.ts
|
|
261
|
+
interface WorkbookOptions extends CorePropertiesOptions {
|
|
262
|
+
readonly worksheets?: readonly WorksheetOptions[];
|
|
263
|
+
}
|
|
264
|
+
declare class File {
|
|
265
|
+
private readonly worksheetOptions;
|
|
266
|
+
private readonly corePropsOptions;
|
|
267
|
+
private _coreProperties?;
|
|
268
|
+
private _appProperties?;
|
|
269
|
+
private _contentTypes?;
|
|
270
|
+
private _styles?;
|
|
271
|
+
private _theme?;
|
|
272
|
+
private _workbookXml?;
|
|
273
|
+
private _worksheets?;
|
|
274
|
+
private _sharedStrings?;
|
|
275
|
+
private _media?;
|
|
276
|
+
private _fileRels?;
|
|
277
|
+
private _workbookRels?;
|
|
278
|
+
private _charts?;
|
|
279
|
+
constructor(options: WorkbookOptions);
|
|
280
|
+
get coreProperties(): CoreProperties;
|
|
281
|
+
get appProperties(): AppProperties;
|
|
282
|
+
get contentTypes(): ContentTypes;
|
|
283
|
+
get styles(): Styles;
|
|
284
|
+
get theme(): DefaultTheme;
|
|
285
|
+
get workbookXml(): WorkbookXml;
|
|
286
|
+
get sharedStrings(): SharedStrings;
|
|
287
|
+
get media(): Media;
|
|
288
|
+
get charts(): ChartCollection;
|
|
289
|
+
get worksheets(): readonly Worksheet[];
|
|
290
|
+
get fileRelationships(): Relationships;
|
|
291
|
+
get workbookRelationships(): Relationships;
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/export/packer/packer.d.ts
|
|
295
|
+
declare const Packer: _$_office_open_core0.Packer<File>;
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/util/index.d.ts
|
|
298
|
+
declare function columnToLetter(col: number): string;
|
|
299
|
+
declare function letterToColumn(s: string): number;
|
|
300
|
+
declare function dateToSerialNumber(date: Date): number;
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/parse.d.ts
|
|
303
|
+
interface XlsxPartRefs {
|
|
304
|
+
worksheets: string[];
|
|
305
|
+
charts: string[];
|
|
306
|
+
media: string[];
|
|
307
|
+
drawings: string[];
|
|
308
|
+
}
|
|
309
|
+
interface XlsxDocument {
|
|
310
|
+
doc: ParsedArchive;
|
|
311
|
+
workbook?: Element;
|
|
312
|
+
worksheets: string[];
|
|
313
|
+
styles?: Element;
|
|
314
|
+
sharedStrings?: Element;
|
|
315
|
+
partRefs: XlsxPartRefs;
|
|
316
|
+
coreProps?: string;
|
|
317
|
+
appProps?: string;
|
|
318
|
+
}
|
|
319
|
+
declare function parseXlsx(data: DataType): XlsxDocument;
|
|
320
|
+
declare function parseWorkbook(data: DataType): WorkbookOptions;
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/patcher.d.ts
|
|
323
|
+
type InputDataType = Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob;
|
|
324
|
+
type PatchDocumentOutputType = OutputType$1;
|
|
325
|
+
declare const PatchType: {
|
|
326
|
+
readonly CELL: "cell";
|
|
327
|
+
};
|
|
328
|
+
interface CellPatch {
|
|
329
|
+
readonly value: string | number | boolean | Date;
|
|
330
|
+
}
|
|
331
|
+
type IPatch = CellPatch;
|
|
332
|
+
interface PatchWorkbookOptions<T extends PatchDocumentOutputType = PatchDocumentOutputType> {
|
|
333
|
+
readonly outputType: T;
|
|
334
|
+
readonly data: InputDataType;
|
|
335
|
+
readonly patches: Readonly<Record<string, IPatch>>;
|
|
336
|
+
readonly placeholderDelimiters?: Readonly<{
|
|
337
|
+
readonly start: string;
|
|
338
|
+
readonly end: string;
|
|
339
|
+
}>;
|
|
340
|
+
}
|
|
341
|
+
declare const patchWorkbook: <T extends PatchDocumentOutputType = PatchDocumentOutputType>({
|
|
342
|
+
outputType,
|
|
343
|
+
data,
|
|
344
|
+
patches,
|
|
345
|
+
placeholderDelimiters
|
|
346
|
+
}: PatchWorkbookOptions<T>) => Promise<OutputByType$1[T]>;
|
|
347
|
+
//#endregion
|
|
348
|
+
export { type AlignmentOptions, type BorderOptions, type BorderSideOptions, type CellOptions, type CellPatch, type ColumnOptions, type ConditionalFormatOptions, type CorePropertiesOptions, type DataValidationOptions, File, File as Workbook, type FillOptions, type FontOptions, type FreezePaneOptions, type IPatch, type InputDataType, type MergeCellOptions, type OutputByType, type OutputType, Packer, type PatchDocumentOutputType, PatchType, type PatchWorkbookOptions, type RowOptions, SharedStrings, type StyleOptions, Styles, type WorkbookOptions, type WorksheetChartOptions, type WorksheetOptions, type XlsxDocument, type XlsxPartRefs, columnToLetter, dateToSerialNumber, letterToColumn, parseWorkbook, parseXlsx, patchWorkbook };
|
|
349
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/file/content-types.ts","../src/file/core-properties.ts","../src/file/media/media.ts","../src/file/shared-strings.ts","../src/file/styles.ts","../src/file/theme.ts","../src/file/workbook.ts","../src/file/worksheet.ts","../src/file/file.ts","../src/export/packer/packer.ts","../src/util/index.ts","../src/parse.ts","../src/patcher.ts"],"mappings":";;;;;;;cAwDa,YAAA,SAAqB,gBAAA;EAAA,iBACf,cAAA;;EAMV,YAAA,CAAa,KAAA;EAQb,SAAA,CAAA;EAQA,gBAAA,CAAA;EAQA,QAAA,CAAS,KAAA;EAQT,QAAA,CAAS,KAAA;EAQT,UAAA,CAAW,KAAA;EAQF,UAAA,CAAW,QAAA,EAAU,OAAA,GAAU,cAAA;AAAA;;;UCtGhC,qBAAA;EAAA,SACN,KAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACA,WAAA;EAAA,SACA,cAAA;EAAA,SACA,QAAA;AAAA;AAAA,cAGE,cAAA,SAAuB,gBAAA;EAAA,iBACjB,OAAA;cAEE,OAAA,EAAS,qBAAA;EAKZ,UAAA,CAAW,QAAA,EAAU,OAAA,GAAU,cAAA;AAAA;;;UCrBhC,SAAA;EAAA,SACN,QAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA,EAAM,UAAA;EAAA,SACN,KAAA;EAAA,SACA,MAAA;AAAA;AAAA,cAGE,KAAA;EAAA,iBACM,GAAA;EAEV,QAAA,CAAS,GAAA,UAAa,IAAA,EAAM,SAAA;EAAA,IAIxB,KAAA,CAAA,YAAkB,SAAA;AAAA;;;cCTlB,aAAA,SAAsB,gBAAA;EAAA,iBAChB,OAAA;EAAA,iBACA,QAAA;;EAUV,QAAA,CAAS,CAAA;EAAA,IAUL,KAAA,CAAA;EAQK,KAAA,CAAM,QAAA,EAAU,OAAA;EAYhB,UAAA,CAAW,QAAA,EAAU,OAAA,GAAU,cAAA;AAAA;;;UCxChC,WAAA;EAAA,SACN,IAAA;EAAA,SACA,MAAA;EAAA,SACA,SAAA;EAAA,SACA,MAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,QAAA;AAAA;AAAA,UAGM,WA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