@simplysm/excel 13.0.100 → 14.0.4
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 +66 -78
- package/dist/excel-cell.d.ts +28 -28
- package/dist/excel-cell.d.ts.map +1 -1
- package/dist/excel-cell.js +273 -264
- package/dist/excel-cell.js.map +1 -6
- package/dist/excel-col.d.ts +4 -4
- package/dist/excel-col.d.ts.map +1 -1
- package/dist/excel-col.js +33 -35
- package/dist/excel-col.js.map +1 -6
- package/dist/excel-row.d.ts +3 -3
- package/dist/excel-row.d.ts.map +1 -1
- package/dist/excel-row.js +28 -30
- package/dist/excel-row.js.map +1 -6
- package/dist/excel-workbook.d.ts +23 -23
- package/dist/excel-workbook.d.ts.map +1 -1
- package/dist/excel-workbook.js +151 -125
- package/dist/excel-workbook.js.map +1 -6
- package/dist/excel-worksheet.d.ts +32 -32
- package/dist/excel-worksheet.d.ts.map +1 -1
- package/dist/excel-worksheet.js +281 -253
- package/dist/excel-worksheet.js.map +1 -6
- package/dist/excel-wrapper.d.ts +7 -7
- package/dist/excel-wrapper.d.ts.map +1 -1
- package/dist/excel-wrapper.js +190 -226
- package/dist/excel-wrapper.js.map +1 -6
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -6
- package/dist/types.d.ts +13 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -6
- package/dist/utils/excel-utils.d.ts +23 -23
- package/dist/utils/excel-utils.d.ts.map +1 -1
- package/dist/utils/excel-utils.js +183 -151
- package/dist/utils/excel-utils.js.map +1 -6
- package/dist/utils/zip-cache.d.ts +6 -6
- package/dist/utils/zip-cache.js +78 -60
- package/dist/utils/zip-cache.js.map +1 -6
- package/dist/xml/excel-xml-content-type.d.ts +2 -2
- package/dist/xml/excel-xml-content-type.js +55 -53
- package/dist/xml/excel-xml-content-type.js.map +1 -6
- package/dist/xml/excel-xml-drawing.d.ts +2 -2
- package/dist/xml/excel-xml-drawing.js +74 -73
- package/dist/xml/excel-xml-drawing.js.map +1 -6
- package/dist/xml/excel-xml-relationship.d.ts +2 -2
- package/dist/xml/excel-xml-relationship.js +67 -67
- package/dist/xml/excel-xml-relationship.js.map +1 -6
- package/dist/xml/excel-xml-shared-string.d.ts +2 -2
- package/dist/xml/excel-xml-shared-string.js +57 -55
- package/dist/xml/excel-xml-shared-string.js.map +1 -6
- package/dist/xml/excel-xml-style.d.ts +2 -2
- package/dist/xml/excel-xml-style.js +311 -295
- package/dist/xml/excel-xml-style.js.map +1 -6
- package/dist/xml/excel-xml-unknown.d.ts +2 -2
- package/dist/xml/excel-xml-unknown.js +11 -10
- package/dist/xml/excel-xml-unknown.js.map +1 -6
- package/dist/xml/excel-xml-workbook.d.ts +3 -2
- package/dist/xml/excel-xml-workbook.d.ts.map +1 -1
- package/dist/xml/excel-xml-workbook.js +95 -90
- package/dist/xml/excel-xml-workbook.js.map +1 -6
- package/dist/xml/excel-xml-worksheet.d.ts +6 -6
- package/dist/xml/excel-xml-worksheet.js +450 -393
- package/dist/xml/excel-xml-worksheet.js.map +1 -6
- package/docs/core.md +147 -0
- package/docs/types.md +201 -212
- package/docs/wrapper.md +32 -62
- package/package.json +8 -6
- package/src/excel-cell.ts +36 -36
- package/src/excel-col.ts +4 -4
- package/src/excel-row.ts +3 -3
- package/src/excel-workbook.ts +38 -38
- package/src/excel-worksheet.ts +69 -51
- package/src/excel-wrapper.ts +55 -50
- package/src/index.ts +3 -3
- package/src/types.ts +17 -17
- package/src/utils/excel-utils.ts +47 -41
- package/src/utils/zip-cache.ts +6 -6
- package/src/xml/excel-xml-content-type.ts +3 -3
- package/src/xml/excel-xml-drawing.ts +2 -2
- package/src/xml/excel-xml-relationship.ts +3 -3
- package/src/xml/excel-xml-shared-string.ts +2 -2
- package/src/xml/excel-xml-style.ts +13 -13
- package/src/xml/excel-xml-unknown.ts +2 -2
- package/src/xml/excel-xml-workbook.ts +14 -6
- package/src/xml/excel-xml-worksheet.ts +43 -43
- package/docs/core-classes.md +0 -541
- package/docs/utilities.md +0 -128
- package/tests/excel-cell.spec.ts +0 -393
- package/tests/excel-col.spec.ts +0 -81
- package/tests/excel-row.spec.ts +0 -61
- package/tests/excel-workbook.spec.ts +0 -205
- package/tests/excel-worksheet.spec.ts +0 -469
- package/tests/excel-wrapper.spec.ts +0 -273
- package/tests/fixtures/logo.png +0 -0
- package/tests/fixtures//354/264/210/352/270/260/355/231/224.xlsx +0 -0
- package/tests/image-insert.spec.ts +0 -190
- package/tests/utils/excel-utils.spec.ts +0 -198
package/docs/core-classes.md
DELETED
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
# Core Classes
|
|
2
|
-
|
|
3
|
-
## ExcelWorkbook
|
|
4
|
-
|
|
5
|
-
Excel workbook processing class. Internally manages ZIP resources.
|
|
6
|
-
|
|
7
|
-
Adopts a Lazy Loading architecture for memory efficiency with large Excel files: XML inside the ZIP is read and parsed only at the point of access.
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
import { ExcelWorkbook } from "@simplysm/excel";
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### Constructor
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
constructor(arg?: Blob | Bytes)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
- `arg` -- Existing Excel file data (Blob or Uint8Array). Creates a new workbook if omitted.
|
|
20
|
-
|
|
21
|
-
### Methods
|
|
22
|
-
|
|
23
|
-
#### `getWorksheetNames`
|
|
24
|
-
|
|
25
|
-
Return all worksheet names in the workbook.
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
async getWorksheetNames(): Promise<string[]>;
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
#### `addWorksheet`
|
|
32
|
-
|
|
33
|
-
Create and return a new worksheet.
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
async addWorksheet(name: string): Promise<ExcelWorksheet>;
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
#### `getWorksheet`
|
|
40
|
-
|
|
41
|
-
Look up a worksheet by name or index (0-based).
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
async getWorksheet(nameOrIndex: string | number): Promise<ExcelWorksheet>;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
#### `toBytes`
|
|
48
|
-
|
|
49
|
-
Export workbook as byte array.
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
async toBytes(): Promise<Bytes>;
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
#### `toBlob`
|
|
56
|
-
|
|
57
|
-
Export workbook as Blob.
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
async toBlob(): Promise<Blob>;
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
#### `close`
|
|
64
|
-
|
|
65
|
-
Release workbook resources. Safe to call on an already closed workbook (no-op). The workbook instance cannot be used after this call.
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
async close(): Promise<void>;
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Implements `Symbol.asyncDispose` for use with `await using`.
|
|
72
|
-
|
|
73
|
-
### Example
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
// Using await using (recommended)
|
|
77
|
-
await using wb = new ExcelWorkbook(bytes);
|
|
78
|
-
const ws = await wb.getWorksheet(0);
|
|
79
|
-
// Resources automatically released at scope exit
|
|
80
|
-
|
|
81
|
-
// Or using try-finally
|
|
82
|
-
const wb = new ExcelWorkbook(bytes);
|
|
83
|
-
try {
|
|
84
|
-
const ws = await wb.getWorksheet(0);
|
|
85
|
-
} finally {
|
|
86
|
-
await wb.close();
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## ExcelWorksheet
|
|
93
|
-
|
|
94
|
-
Class representing an Excel worksheet. Provides cell access, row/column copying, data table processing, and image insertion.
|
|
95
|
-
|
|
96
|
-
### Cell Access
|
|
97
|
-
|
|
98
|
-
#### `row`
|
|
99
|
-
|
|
100
|
-
Return row object (0-based).
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
row(r: number): ExcelRow;
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### `cell`
|
|
107
|
-
|
|
108
|
-
Return cell object (0-based row/column).
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
cell(r: number, c: number): ExcelCell;
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
#### `col`
|
|
115
|
-
|
|
116
|
-
Return column object (0-based).
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
col(c: number): ExcelCol;
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Name Methods
|
|
123
|
-
|
|
124
|
-
#### `getName`
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
async getName(): Promise<string>;
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
#### `setName`
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
async setName(newName: string): Promise<void>;
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Copy Methods
|
|
137
|
-
|
|
138
|
-
#### `copyRowStyle`
|
|
139
|
-
|
|
140
|
-
Copy style from source row to target row.
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
async copyRowStyle(srcR: number, targetR: number): Promise<void>;
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
#### `copyCellStyle`
|
|
147
|
-
|
|
148
|
-
Copy style from source cell to target cell.
|
|
149
|
-
|
|
150
|
-
```typescript
|
|
151
|
-
async copyCellStyle(srcAddr: ExcelAddressPoint, targetAddr: ExcelAddressPoint): Promise<void>;
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
#### `copyRow`
|
|
155
|
-
|
|
156
|
-
Copy source row to target row (overwrite).
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
async copyRow(srcR: number, targetR: number): Promise<void>;
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
#### `copyCell`
|
|
163
|
-
|
|
164
|
-
Copy source cell to target cell.
|
|
165
|
-
|
|
166
|
-
```typescript
|
|
167
|
-
async copyCell(srcAddr: ExcelAddressPoint, targetAddr: ExcelAddressPoint): Promise<void>;
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
#### `insertCopyRow`
|
|
171
|
-
|
|
172
|
-
Insert-copy the source row at the target position. Existing rows at and below the target are shifted down by one.
|
|
173
|
-
|
|
174
|
-
```typescript
|
|
175
|
-
async insertCopyRow(srcR: number, targetR: number): Promise<void>;
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Range Methods
|
|
179
|
-
|
|
180
|
-
#### `getRange`
|
|
181
|
-
|
|
182
|
-
Return data range of the worksheet.
|
|
183
|
-
|
|
184
|
-
```typescript
|
|
185
|
-
async getRange(): Promise<ExcelAddressRangePoint>;
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
#### `getCells`
|
|
189
|
-
|
|
190
|
-
Return all cells as a 2D array.
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
async getCells(): Promise<ExcelCell[][]>;
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Data Methods
|
|
197
|
-
|
|
198
|
-
#### `getDataTable`
|
|
199
|
-
|
|
200
|
-
Return worksheet data as a table (record array).
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
async getDataTable(opt?: {
|
|
204
|
-
headerRowIndex?: number;
|
|
205
|
-
checkEndColIndex?: number;
|
|
206
|
-
usableHeaderNameFn?: (headerName: string) => boolean;
|
|
207
|
-
}): Promise<Record<string, ExcelValueType>[]>;
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Parameters:**
|
|
211
|
-
- `opt.headerRowIndex` -- Header row index (default: first row)
|
|
212
|
-
- `opt.checkEndColIndex` -- Column index to determine data end. Data ends when this column is empty.
|
|
213
|
-
- `opt.usableHeaderNameFn` -- Function to filter usable headers
|
|
214
|
-
|
|
215
|
-
#### `setDataMatrix`
|
|
216
|
-
|
|
217
|
-
Write 2D array data to the worksheet.
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
async setDataMatrix(matrix: ExcelValueType[][]): Promise<void>;
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
#### `setRecords`
|
|
224
|
-
|
|
225
|
-
Write record array to the worksheet. Headers are auto-generated in the first row, data follows in subsequent rows.
|
|
226
|
-
|
|
227
|
-
```typescript
|
|
228
|
-
async setRecords(records: Record<string, ExcelValueType>[]): Promise<void>;
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### View Methods
|
|
232
|
-
|
|
233
|
-
#### `setZoom`
|
|
234
|
-
|
|
235
|
-
Set worksheet zoom scale (percent).
|
|
236
|
-
|
|
237
|
-
```typescript
|
|
238
|
-
async setZoom(percent: number): Promise<void>;
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
#### `freezeAt`
|
|
242
|
-
|
|
243
|
-
Set freeze panes for rows/columns.
|
|
244
|
-
|
|
245
|
-
```typescript
|
|
246
|
-
async freezeAt(point: { r?: number; c?: number }): Promise<void>;
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### Image Methods
|
|
250
|
-
|
|
251
|
-
#### `addImage`
|
|
252
|
-
|
|
253
|
-
Insert an image into the worksheet.
|
|
254
|
-
|
|
255
|
-
```typescript
|
|
256
|
-
async addImage(opts: {
|
|
257
|
-
bytes: Bytes;
|
|
258
|
-
ext: string;
|
|
259
|
-
from: { r: number; c: number; rOff?: number | string; cOff?: number | string };
|
|
260
|
-
to?: { r: number; c: number; rOff?: number | string; cOff?: number | string };
|
|
261
|
-
}): Promise<void>;
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
**Parameters:**
|
|
265
|
-
- `opts.bytes` -- Image binary data
|
|
266
|
-
- `opts.ext` -- Image extension (png, jpg, etc.)
|
|
267
|
-
- `opts.from` -- Image start position (0-based row/column index, rOff/cOff in EMU offset)
|
|
268
|
-
- `opts.to` -- Image end position (if omitted, inserted at from position with original size)
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## ExcelRow
|
|
273
|
-
|
|
274
|
-
Class representing a row in an Excel worksheet. Provides cell access functionality.
|
|
275
|
-
|
|
276
|
-
#### `cell`
|
|
277
|
-
|
|
278
|
-
Return cell at the given column index (0-based).
|
|
279
|
-
|
|
280
|
-
```typescript
|
|
281
|
-
cell(c: number): ExcelCell;
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
#### `getCells`
|
|
285
|
-
|
|
286
|
-
Return all cells in the row.
|
|
287
|
-
|
|
288
|
-
```typescript
|
|
289
|
-
async getCells(): Promise<ExcelCell[]>;
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## ExcelCol
|
|
295
|
-
|
|
296
|
-
Class representing a column in an Excel worksheet. Provides cell access and column width configuration.
|
|
297
|
-
|
|
298
|
-
#### `cell`
|
|
299
|
-
|
|
300
|
-
Return cell at the given row index (0-based).
|
|
301
|
-
|
|
302
|
-
```typescript
|
|
303
|
-
cell(r: number): ExcelCell;
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
#### `getCells`
|
|
307
|
-
|
|
308
|
-
Return all cells in the column.
|
|
309
|
-
|
|
310
|
-
```typescript
|
|
311
|
-
async getCells(): Promise<ExcelCell[]>;
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
#### `setWidth`
|
|
315
|
-
|
|
316
|
-
Set column width.
|
|
317
|
-
|
|
318
|
-
```typescript
|
|
319
|
-
async setWidth(size: number): Promise<void>;
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
## ExcelCell
|
|
325
|
-
|
|
326
|
-
Class representing an Excel cell. Provides value read/write, formula, style, and cell merge functionality.
|
|
327
|
-
|
|
328
|
-
All cell methods are `async` because the required XML (SharedStrings, Styles, etc.) is loaded on-demand for memory efficiency.
|
|
329
|
-
|
|
330
|
-
### Properties
|
|
331
|
-
|
|
332
|
-
#### `addr`
|
|
333
|
-
|
|
334
|
-
Cell address (0-based row/column index).
|
|
335
|
-
|
|
336
|
-
```typescript
|
|
337
|
-
readonly addr: ExcelAddressPoint;
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### Value Methods
|
|
341
|
-
|
|
342
|
-
#### `getValue`
|
|
343
|
-
|
|
344
|
-
Return cell value.
|
|
345
|
-
|
|
346
|
-
```typescript
|
|
347
|
-
async getValue(): Promise<ExcelValueType>;
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
#### `setValue`
|
|
351
|
-
|
|
352
|
-
Set cell value (`undefined` deletes the cell).
|
|
353
|
-
|
|
354
|
-
```typescript
|
|
355
|
-
async setValue(val: ExcelValueType): Promise<void>;
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
#### `getFormula`
|
|
359
|
-
|
|
360
|
-
Return cell formula.
|
|
361
|
-
|
|
362
|
-
```typescript
|
|
363
|
-
async getFormula(): Promise<string | undefined>;
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
#### `setFormula`
|
|
367
|
-
|
|
368
|
-
Set formula on cell (`undefined` removes the formula).
|
|
369
|
-
|
|
370
|
-
```typescript
|
|
371
|
-
async setFormula(val: string | undefined): Promise<void>;
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### Merge Methods
|
|
375
|
-
|
|
376
|
-
#### `merge`
|
|
377
|
-
|
|
378
|
-
Merge cells from current cell to the specified end coordinates.
|
|
379
|
-
|
|
380
|
-
```typescript
|
|
381
|
-
async merge(r: number, c: number): Promise<void>;
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
**Example:**
|
|
385
|
-
```typescript
|
|
386
|
-
// Merges range A1:C3 (3 rows x 3 columns)
|
|
387
|
-
await ws.cell(0, 0).merge(2, 2);
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
### Style Methods
|
|
391
|
-
|
|
392
|
-
#### `getStyleId`
|
|
393
|
-
|
|
394
|
-
Return cell style ID.
|
|
395
|
-
|
|
396
|
-
```typescript
|
|
397
|
-
async getStyleId(): Promise<string | undefined>;
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
#### `setStyleId`
|
|
401
|
-
|
|
402
|
-
Set cell style ID.
|
|
403
|
-
|
|
404
|
-
```typescript
|
|
405
|
-
async setStyleId(styleId: string | undefined): Promise<void>;
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
#### `setStyle`
|
|
409
|
-
|
|
410
|
-
Set cell style.
|
|
411
|
-
|
|
412
|
-
```typescript
|
|
413
|
-
async setStyle(opts: ExcelStyleOptions): Promise<void>;
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
---
|
|
417
|
-
|
|
418
|
-
## ExcelUtils
|
|
419
|
-
|
|
420
|
-
Collection of Excel utility functions. Provides cell address conversion, date/number conversion, and number format processing.
|
|
421
|
-
|
|
422
|
-
```typescript
|
|
423
|
-
import { ExcelUtils } from "@simplysm/excel";
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### Address Conversion
|
|
427
|
-
|
|
428
|
-
#### `stringifyAddr`
|
|
429
|
-
|
|
430
|
-
Convert cell coordinates to "A1" format string.
|
|
431
|
-
|
|
432
|
-
```typescript
|
|
433
|
-
static stringifyAddr(point: ExcelAddressPoint): string;
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
#### `stringifyRowAddr`
|
|
437
|
-
|
|
438
|
-
Convert row index (0-based) to row address string (e.g. `0` -> `"1"`).
|
|
439
|
-
|
|
440
|
-
```typescript
|
|
441
|
-
static stringifyRowAddr(r: number): string;
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
#### `stringifyColAddr`
|
|
445
|
-
|
|
446
|
-
Convert column index (0-based) to column address string (e.g. `0` -> `"A"`, `26` -> `"AA"`).
|
|
447
|
-
|
|
448
|
-
```typescript
|
|
449
|
-
static stringifyColAddr(c: number): string;
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
#### `parseRowAddr`
|
|
453
|
-
|
|
454
|
-
Extract row index from cell address (e.g. `"A3"` -> `2`).
|
|
455
|
-
|
|
456
|
-
```typescript
|
|
457
|
-
static parseRowAddr(addr: string): number;
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
#### `parseColAddr`
|
|
461
|
-
|
|
462
|
-
Extract column index from cell address (e.g. `"B3"` -> `1`).
|
|
463
|
-
|
|
464
|
-
```typescript
|
|
465
|
-
static parseColAddr(addr: string): number;
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
#### `parseCellAddr`
|
|
469
|
-
|
|
470
|
-
Convert cell address to coordinates (e.g. `"B3"` -> `{r: 2, c: 1}`).
|
|
471
|
-
|
|
472
|
-
```typescript
|
|
473
|
-
static parseCellAddr(addr: string): ExcelAddressPoint;
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
#### `parseRangeAddr`
|
|
477
|
-
|
|
478
|
-
Convert range address to coordinates (e.g. `"A1:C3"` -> `{s: {r:0,c:0}, e: {r:2,c:2}}`).
|
|
479
|
-
|
|
480
|
-
```typescript
|
|
481
|
-
static parseRangeAddr(rangeAddr: string): ExcelAddressRangePoint;
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
#### `stringifyRangeAddr`
|
|
485
|
-
|
|
486
|
-
Convert range coordinates to address string.
|
|
487
|
-
|
|
488
|
-
```typescript
|
|
489
|
-
static stringifyRangeAddr(point: ExcelAddressRangePoint): string;
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
### Date/Number Conversion
|
|
493
|
-
|
|
494
|
-
#### `convertTimeTickToNumber`
|
|
495
|
-
|
|
496
|
-
Convert JavaScript timestamp (ms) to Excel date number. Excel counts 1900-01-01 as 1 (1899-12-30 is date 0).
|
|
497
|
-
|
|
498
|
-
```typescript
|
|
499
|
-
static convertTimeTickToNumber(tick: number): number;
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
#### `convertNumberToTimeTick`
|
|
503
|
-
|
|
504
|
-
Convert Excel date number to JavaScript timestamp (ms).
|
|
505
|
-
|
|
506
|
-
```typescript
|
|
507
|
-
static convertNumberToTimeTick(value: number): number;
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
### Number Format
|
|
511
|
-
|
|
512
|
-
#### `convertNumFmtCodeToName`
|
|
513
|
-
|
|
514
|
-
Convert number format code to format name.
|
|
515
|
-
|
|
516
|
-
```typescript
|
|
517
|
-
static convertNumFmtCodeToName(numFmtCode: string): ExcelNumberFormat;
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
#### `convertNumFmtIdToName`
|
|
521
|
-
|
|
522
|
-
Convert number format ID to format name.
|
|
523
|
-
|
|
524
|
-
```typescript
|
|
525
|
-
static convertNumFmtIdToName(numFmtId: number): ExcelNumberFormat;
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
Built-in format ID ranges:
|
|
529
|
-
- `0-13, 37-40, 48`: number/general/currency/percent formats
|
|
530
|
-
- `14-17, 27-31, 34-36, 50-58`: date formats (including localized)
|
|
531
|
-
- `22`: date+time format
|
|
532
|
-
- `18-21, 32-33, 45-47`: time formats
|
|
533
|
-
- `49`: text format
|
|
534
|
-
|
|
535
|
-
#### `convertNumFmtNameToId`
|
|
536
|
-
|
|
537
|
-
Convert number format name to format ID.
|
|
538
|
-
|
|
539
|
-
```typescript
|
|
540
|
-
static convertNumFmtNameToId(numFmtName: ExcelNumberFormat): number;
|
|
541
|
-
```
|
package/docs/utilities.md
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Utilities
|
|
2
|
-
|
|
3
|
-
## `ExcelUtils`
|
|
4
|
-
|
|
5
|
-
Collection of Excel utility functions. Provides cell address conversion, date/number conversion, and number format processing.
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { ExcelUtils } from "@simplysm/excel";
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Address Conversion
|
|
12
|
-
|
|
13
|
-
#### `stringifyAddr`
|
|
14
|
-
|
|
15
|
-
Convert cell coordinates to "A1" format string.
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
static stringifyAddr(point: ExcelAddressPoint): string;
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
#### `stringifyRowAddr`
|
|
22
|
-
|
|
23
|
-
Convert row index (0-based) to row address string (e.g. `0` -> `"1"`).
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
static stringifyRowAddr(r: number): string;
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
#### `stringifyColAddr`
|
|
30
|
-
|
|
31
|
-
Convert column index (0-based) to column address string (e.g. `0` -> `"A"`, `26` -> `"AA"`).
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
static stringifyColAddr(c: number): string;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
**Throws:** `Error` if column index is outside range `0-16383`.
|
|
38
|
-
|
|
39
|
-
#### `parseRowAddr`
|
|
40
|
-
|
|
41
|
-
Extract row index from cell address (e.g. `"A3"` -> `2`).
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
static parseRowAddr(addr: string): number;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
#### `parseColAddr`
|
|
48
|
-
|
|
49
|
-
Extract column index from cell address (e.g. `"B3"` -> `1`).
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
static parseColAddr(addr: string): number;
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
#### `parseCellAddr`
|
|
56
|
-
|
|
57
|
-
Convert cell address to coordinates (e.g. `"B3"` -> `{r: 2, c: 1}`).
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
static parseCellAddr(addr: string): ExcelAddressPoint;
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
#### `parseRangeAddr`
|
|
64
|
-
|
|
65
|
-
Convert range address to coordinates (e.g. `"A1:C3"` -> `{s: {r:0,c:0}, e: {r:2,c:2}}`).
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
static parseRangeAddr(rangeAddr: string): ExcelAddressRangePoint;
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
#### `stringifyRangeAddr`
|
|
72
|
-
|
|
73
|
-
Convert range coordinates to address string.
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
static stringifyRangeAddr(point: ExcelAddressRangePoint): string;
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Date/Number Conversion
|
|
80
|
-
|
|
81
|
-
#### `convertTimeTickToNumber`
|
|
82
|
-
|
|
83
|
-
Convert JavaScript timestamp (ms) to Excel date number. Excel counts 1900-01-01 as 1 (1899-12-30 is date 0).
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
static convertTimeTickToNumber(tick: number): number;
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
#### `convertNumberToTimeTick`
|
|
90
|
-
|
|
91
|
-
Convert Excel date number to JavaScript timestamp (ms).
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
static convertNumberToTimeTick(value: number): number;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Number Format
|
|
98
|
-
|
|
99
|
-
#### `convertNumFmtCodeToName`
|
|
100
|
-
|
|
101
|
-
Convert number format code to format name.
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
static convertNumFmtCodeToName(numFmtCode: string): ExcelNumberFormat;
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
#### `convertNumFmtIdToName`
|
|
108
|
-
|
|
109
|
-
Convert number format ID to format name.
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
static convertNumFmtIdToName(numFmtId: number): ExcelNumberFormat;
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Built-in format ID ranges:
|
|
116
|
-
- `0-13, 37-40, 48`: number/general/currency/percent formats
|
|
117
|
-
- `14-17, 27-31, 34-36, 50-58`: date formats (including localized)
|
|
118
|
-
- `22`: date+time format
|
|
119
|
-
- `18-21, 32-33, 45-47`: time formats
|
|
120
|
-
- `49`: text format
|
|
121
|
-
|
|
122
|
-
#### `convertNumFmtNameToId`
|
|
123
|
-
|
|
124
|
-
Convert number format name to format ID.
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
static convertNumFmtNameToId(numFmtName: ExcelNumberFormat): number;
|
|
128
|
-
```
|