@cj-tech-master/excelts 1.4.5-canary.20251212053535.13d32d8 → 1.4.5-canary.20251212143538.45665af
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/dist/browser/excelts.iife.js +257 -21
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +2 -2
- package/dist/cjs/doc/column.js +36 -7
- package/dist/cjs/doc/row.js +48 -18
- package/dist/cjs/doc/workbook.js +25 -2
- package/dist/cjs/doc/worksheet.js +150 -25
- package/dist/esm/doc/column.js +36 -7
- package/dist/esm/doc/row.js +48 -18
- package/dist/esm/doc/workbook.js +25 -2
- package/dist/esm/doc/worksheet.js +150 -25
- package/dist/types/doc/column.d.ts +37 -2
- package/dist/types/doc/row.d.ts +50 -5
- package/dist/types/doc/workbook.d.ts +24 -1
- package/dist/types/doc/worksheet.d.ts +153 -6
- package/package.json +1 -1
|
@@ -45,9 +45,6 @@ interface WorksheetOptions {
|
|
|
45
45
|
views?: Partial<WorksheetView>[];
|
|
46
46
|
autoFilter?: AutoFilter | null;
|
|
47
47
|
}
|
|
48
|
-
interface EachRowOptions {
|
|
49
|
-
includeEmpty?: boolean;
|
|
50
|
-
}
|
|
51
48
|
interface PageSetupMargins {
|
|
52
49
|
left: number;
|
|
53
50
|
right: number;
|
|
@@ -140,62 +137,212 @@ declare class Worksheet {
|
|
|
140
137
|
constructor(options: WorksheetOptions);
|
|
141
138
|
get name(): string;
|
|
142
139
|
set name(name: string | undefined);
|
|
140
|
+
/**
|
|
141
|
+
* The workbook that contains this worksheet
|
|
142
|
+
*/
|
|
143
143
|
get workbook(): Workbook;
|
|
144
|
+
/**
|
|
145
|
+
* When you're done with this worksheet, call this to remove from workbook
|
|
146
|
+
*/
|
|
144
147
|
destroy(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Get the bounding range of the cells in this worksheet
|
|
150
|
+
*/
|
|
145
151
|
get dimensions(): Range;
|
|
146
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Get the current columns array
|
|
154
|
+
*/
|
|
155
|
+
get columns(): Column[];
|
|
156
|
+
/**
|
|
157
|
+
* Add column headers and define column keys and widths.
|
|
158
|
+
*
|
|
159
|
+
* Note: these column structures are a workbook-building convenience only,
|
|
160
|
+
* apart from the column width, they will not be fully persisted.
|
|
161
|
+
*/
|
|
147
162
|
set columns(value: ColumnDefn[]);
|
|
148
163
|
getColumnKey(key: string): Column | undefined;
|
|
149
164
|
setColumnKey(key: string, value: Column): void;
|
|
150
165
|
deleteColumnKey(key: string): void;
|
|
151
166
|
eachColumnKey(f: (column: Column, key: string) => void): void;
|
|
167
|
+
/**
|
|
168
|
+
* Access an individual column by key, letter and 1-based column number
|
|
169
|
+
*/
|
|
152
170
|
getColumn(c: string | number): Column;
|
|
171
|
+
/**
|
|
172
|
+
* Cut one or more columns (columns to the right are shifted left)
|
|
173
|
+
* and optionally insert more
|
|
174
|
+
*
|
|
175
|
+
* If column properties have been defined, they will be cut or moved accordingly
|
|
176
|
+
*
|
|
177
|
+
* Known Issue: If a splice causes any merged cells to move, the results may be unpredictable
|
|
178
|
+
*
|
|
179
|
+
* Also: If the worksheet has more rows than values in the column inserts,
|
|
180
|
+
* the rows will still be shifted as if the values existed
|
|
181
|
+
*/
|
|
153
182
|
spliceColumns(start: number, count: number, ...inserts: CellValue[][]): void;
|
|
183
|
+
/**
|
|
184
|
+
* Get the last column in a worksheet
|
|
185
|
+
*/
|
|
154
186
|
get lastColumn(): Column;
|
|
187
|
+
/**
|
|
188
|
+
* The total column size of the document. Equal to the maximum cell count from all of the rows
|
|
189
|
+
*/
|
|
155
190
|
get columnCount(): number;
|
|
191
|
+
/**
|
|
192
|
+
* A count of the number of columns that have values
|
|
193
|
+
*/
|
|
156
194
|
get actualColumnCount(): number;
|
|
157
195
|
_commitRow(row: Row): void;
|
|
158
196
|
get _lastRowNumber(): number;
|
|
159
197
|
get _nextRow(): number;
|
|
198
|
+
/**
|
|
199
|
+
* Get the last editable row in a worksheet (or undefined if there are none)
|
|
200
|
+
*/
|
|
160
201
|
get lastRow(): Row | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Tries to find and return row for row number, else undefined
|
|
204
|
+
*
|
|
205
|
+
* @param r - The 1-indexed row number
|
|
206
|
+
*/
|
|
161
207
|
findRow(r: number): Row | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Tries to find and return rows for row number start and length, else undefined
|
|
210
|
+
*
|
|
211
|
+
* @param start - The 1-indexed starting row number
|
|
212
|
+
* @param length - The length of the expected array
|
|
213
|
+
*/
|
|
162
214
|
findRows(start: number, length: number): (Row | undefined)[];
|
|
215
|
+
/**
|
|
216
|
+
* The total row size of the document. Equal to the row number of the last row that has values.
|
|
217
|
+
*/
|
|
163
218
|
get rowCount(): number;
|
|
219
|
+
/**
|
|
220
|
+
* 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.
|
|
221
|
+
*/
|
|
164
222
|
get actualRowCount(): number;
|
|
223
|
+
/**
|
|
224
|
+
* Get or create row by 1-based index
|
|
225
|
+
*/
|
|
165
226
|
getRow(r: number): Row;
|
|
227
|
+
/**
|
|
228
|
+
* Get or create rows by 1-based index
|
|
229
|
+
*/
|
|
166
230
|
getRows(start: number, length: number): Row[] | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* Add a couple of Rows by key-value, after the last current row, using the column keys,
|
|
233
|
+
* or add a row by contiguous Array (assign to columns A, B & C)
|
|
234
|
+
*/
|
|
167
235
|
addRow(value: RowValues, style?: string): Row;
|
|
236
|
+
/**
|
|
237
|
+
* Add multiple rows by providing an array of arrays or key-value pairs
|
|
238
|
+
*/
|
|
168
239
|
addRows(value: RowValues[], style?: string): Row[];
|
|
240
|
+
/**
|
|
241
|
+
* Insert a Row by key-value, at the position (shifting down all rows from position),
|
|
242
|
+
* using the column keys, or add a row by contiguous Array (assign to columns A, B & C)
|
|
243
|
+
*/
|
|
169
244
|
insertRow(pos: number, value: RowValues, style?: string): Row;
|
|
245
|
+
/**
|
|
246
|
+
* Insert multiple rows at position (shifting down all rows from position)
|
|
247
|
+
* by providing an array of arrays or key-value pairs
|
|
248
|
+
*/
|
|
170
249
|
insertRows(pos: number, values: RowValues[], style?: string): Row[] | undefined;
|
|
171
250
|
_setStyleOption(pos: number, style?: string): void;
|
|
172
251
|
_copyStyle(src: number, dest: number, styleEmpty?: boolean): void;
|
|
252
|
+
/**
|
|
253
|
+
* Duplicate rows and insert new rows
|
|
254
|
+
*/
|
|
173
255
|
duplicateRow(rowNum: number, count: number, insert?: boolean): void;
|
|
256
|
+
/**
|
|
257
|
+
* Cut one or more rows (rows below are shifted up)
|
|
258
|
+
* and optionally insert more
|
|
259
|
+
*
|
|
260
|
+
* Known Issue: If a splice causes any merged cells to move, the results may be unpredictable
|
|
261
|
+
*/
|
|
174
262
|
spliceRows(start: number, count: number, ...inserts: RowValues[]): void;
|
|
175
|
-
|
|
176
|
-
|
|
263
|
+
/**
|
|
264
|
+
* Iterate over all rows that have values in a worksheet
|
|
265
|
+
*/
|
|
266
|
+
eachRow(callback: (row: Row, rowNumber: number) => void): void;
|
|
267
|
+
/**
|
|
268
|
+
* Iterate over all rows (including empty rows) in a worksheet
|
|
269
|
+
*/
|
|
270
|
+
eachRow(opt: {
|
|
271
|
+
includeEmpty?: boolean;
|
|
272
|
+
}, callback: (row: Row, rowNumber: number) => void): void;
|
|
273
|
+
/**
|
|
274
|
+
* Return all rows as sparse array
|
|
275
|
+
*/
|
|
177
276
|
getSheetValues(): CellValue[][];
|
|
277
|
+
/**
|
|
278
|
+
* Returns the cell at [r,c] or address given by r. If not found, return undefined
|
|
279
|
+
*/
|
|
178
280
|
findCell(r: number | string, c?: number): Cell | undefined;
|
|
281
|
+
/**
|
|
282
|
+
* Get or create cell at [r,c] or address given by r
|
|
283
|
+
*/
|
|
179
284
|
getCell(r: number | string, c?: number): Cell;
|
|
285
|
+
/**
|
|
286
|
+
* Merge cells, either:
|
|
287
|
+
*
|
|
288
|
+
* tlbr string, e.g. `'A4:B5'`
|
|
289
|
+
*
|
|
290
|
+
* tl string, br string, e.g. `'G10', 'H11'`
|
|
291
|
+
*
|
|
292
|
+
* t, l, b, r numbers, e.g. `10,11,12,13`
|
|
293
|
+
*/
|
|
180
294
|
mergeCells(...cells: RangeInput[]): void;
|
|
181
295
|
mergeCellsWithoutStyle(...cells: RangeInput[]): void;
|
|
182
296
|
_mergeCellsInternal(dimensions: Range, ignoreStyle?: boolean): void;
|
|
183
297
|
_unMergeMaster(master: Cell): void;
|
|
184
298
|
get hasMerges(): boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Scan the range and if any cell is part of a merge, un-merge the group.
|
|
301
|
+
* Note this function can affect multiple merges and merge-blocks are
|
|
302
|
+
* atomic - either they're all merged or all un-merged.
|
|
303
|
+
*/
|
|
185
304
|
unMergeCells(...cells: RangeInput[]): void;
|
|
186
305
|
fillFormula(range: string, formula: string, results?: FormulaResult[][] | FormulaResult[] | ((row: number, col: number) => FormulaResult | undefined), shareType?: string): void;
|
|
306
|
+
/**
|
|
307
|
+
* Using the image id from `Workbook.addImage`,
|
|
308
|
+
* embed an image within the worksheet to cover a range
|
|
309
|
+
*/
|
|
187
310
|
addImage(imageId: string | number, range: AddImageRange): void;
|
|
188
311
|
getImages(): Image[];
|
|
312
|
+
/**
|
|
313
|
+
* Using the image id from `Workbook.addImage`, set the background to the worksheet
|
|
314
|
+
*/
|
|
189
315
|
addBackgroundImage(imageId: string | number): void;
|
|
190
316
|
getBackgroundImageId(): string | undefined;
|
|
317
|
+
/**
|
|
318
|
+
* Protect the worksheet with optional password and options
|
|
319
|
+
*/
|
|
191
320
|
protect(password?: string, options?: Partial<SheetProtection>): Promise<void>;
|
|
192
321
|
unprotect(): void;
|
|
322
|
+
/**
|
|
323
|
+
* Add a new table and return a reference to it
|
|
324
|
+
*/
|
|
193
325
|
addTable(model: TableProperties): Table;
|
|
326
|
+
/**
|
|
327
|
+
* Fetch table by name
|
|
328
|
+
*/
|
|
194
329
|
getTable(name: string): Table;
|
|
330
|
+
/**
|
|
331
|
+
* Delete table by name
|
|
332
|
+
*/
|
|
195
333
|
removeTable(name: string): void;
|
|
334
|
+
/**
|
|
335
|
+
* Fetch all tables in the worksheet
|
|
336
|
+
*/
|
|
196
337
|
getTables(): Table[];
|
|
197
338
|
addPivotTable(model: PivotTableModel): PivotTable;
|
|
339
|
+
/**
|
|
340
|
+
* Add conditional formatting rules
|
|
341
|
+
*/
|
|
198
342
|
addConditionalFormatting(cf: ConditionalFormattingOptions): void;
|
|
343
|
+
/**
|
|
344
|
+
* Delete conditional formatting rules
|
|
345
|
+
*/
|
|
199
346
|
removeConditionalFormatting(filter: number | ((value: ConditionalFormattingOptions, index: number, array: ConditionalFormattingOptions[]) => boolean)): void;
|
|
200
347
|
get model(): WorksheetModel;
|
|
201
348
|
_parseRows(model: WorksheetModel): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "1.4.5-canary.
|
|
3
|
+
"version": "1.4.5-canary.20251212143538.45665af",
|
|
4
4
|
"description": "TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|