xlvane 1.0.1 → 1.1.1
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 +8 -7
- package/dist/cli.js +474 -51
- package/dist/index.d.ts +10 -10
- package/dist/index.js +3 -3
- package/dist/{node-files-uazELnqk.js → node-files-CsQVpKgP.js} +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/{options-B7UhudO_.js → options-Ba6r4zP1.js} +399 -85
- package/dist/{rows-Cwte1t8m.js → rows-Biu_ddwz.js} +280 -89
- package/dist/{stream-write-Q-sef804.d.ts → stream-write-CaGFWPhB.d.ts} +45 -12
- package/dist/{stream-write-CTgWff2P.js → stream-write-CtWyTd44.js} +32 -10
- package/docs/cli-json/inspect.schema.json +8 -0
- package/docs/errors.md +18 -1
- package/docs/exceljs-compat.md +3 -3
- package/docs/inspect-json.md +2 -0
- package/llms-full.txt +41 -13
- package/package.json +1 -1
- package/skills/xlvane/SKILL.md +1 -1
|
@@ -77,7 +77,7 @@ interface ReadLimits {
|
|
|
77
77
|
readonly maxXmlAttributes: number;
|
|
78
78
|
/** Maximum length of an XML element or attribute name. Default 1 024 characters. */
|
|
79
79
|
readonly maxXmlNameLength: number;
|
|
80
|
-
/** Maximum length of one XML text node or
|
|
80
|
+
/** Maximum length of one XML text node, attribute value, comment or processing instruction. Default 8 Mi characters. */
|
|
81
81
|
readonly maxXmlTextLength: number;
|
|
82
82
|
/** Maximum number of elements plus attributes in a part that is parsed into a tree (workbook, styles, relationships). Default 1 000 000. */
|
|
83
83
|
readonly maxXmlTreeElements: number;
|
|
@@ -87,7 +87,8 @@ interface ReadLimits {
|
|
|
87
87
|
* Maximum total length, in UTF-16 code units, of the shared strings that cells refer to, each
|
|
88
88
|
* reference counted again. Protects against a small file that points thousands of cells at
|
|
89
89
|
* one huge shared string (a few MB that become many GB once values are copied, e.g. to CSV).
|
|
90
|
-
*
|
|
90
|
+
* The same limit applies, counted separately, to shared formulas: the length of the formula of
|
|
91
|
+
* each cell that shares one, as moved to that cell. Default 512 Mi.
|
|
91
92
|
*/
|
|
92
93
|
readonly maxSharedStringChars: number;
|
|
93
94
|
}
|
|
@@ -122,7 +123,7 @@ declare const ERROR_CODES: readonly ["XLV_E_INVALID_INPUT", "XLV_E_INVALID_OPTIO
|
|
|
122
123
|
* console.log(WARNING_CODES.includes('XLV_W_MACROS_PRESENT')); // true
|
|
123
124
|
* ```
|
|
124
125
|
*/
|
|
125
|
-
declare const WARNING_CODES: readonly ["XLV_W_DIMENSION_MISMATCH", "XLV_W_SHARED_FORMULA_NOT_EXPANDED", "XLV_W_FORMULA_NO_CACHED_VALUE", "XLV_W_VALUES_IN_MERGED_CELLS", "XLV_W_VERY_HIDDEN_SHEET", "XLV_W_MACROS_PRESENT", "XLV_W_EXTERNAL_LINKS", "XLV_W_DUPLICATE_CELL", "XLV_W_INVALID_VALUE", "XLV_W_SHEET_PART_MISSING", "XLV_W_PART_MISSING", "XLV_W_FORMULAS_NOT_RECALCULATED", "XLV_W_INVALID_CELL_REF", "XLV_W_UNUSUAL_HYPERLINK", "XLV_W_THREADED_COMMENTS", "XLV_W_DRAWING_CONTENT_NOT_READ", "XLV_W_MERGED_CELL_WRITE"];
|
|
126
|
+
declare const WARNING_CODES: readonly ["XLV_W_DIMENSION_MISMATCH", "XLV_W_SHARED_FORMULA_NOT_EXPANDED", "XLV_W_FORMULA_NO_CACHED_VALUE", "XLV_W_VALUES_IN_MERGED_CELLS", "XLV_W_VERY_HIDDEN_SHEET", "XLV_W_MACROS_PRESENT", "XLV_W_EXTERNAL_LINKS", "XLV_W_DUPLICATE_CELL", "XLV_W_INVALID_VALUE", "XLV_W_SHEET_PART_MISSING", "XLV_W_SHEET_PART_SHARED", "XLV_W_PART_MISSING", "XLV_W_FORMULAS_NOT_RECALCULATED", "XLV_W_INVALID_CELL_REF", "XLV_W_UNUSUAL_HYPERLINK", "XLV_W_THREADED_COMMENTS", "XLV_W_DRAWING_CONTENT_NOT_READ", "XLV_W_MERGED_CELL_WRITE", "XLV_W_LIMIT_REACHED"];
|
|
126
127
|
/**
|
|
127
128
|
* A stable error code, see {@link ERROR_CODES}.
|
|
128
129
|
*
|
|
@@ -2413,13 +2414,19 @@ type SheetLayout = "normal" | "pageBreakPreview" | "pageLayout";
|
|
|
2413
2414
|
* ```ts
|
|
2414
2415
|
* import type { SplitPanes } from 'xlvane';
|
|
2415
2416
|
*
|
|
2416
|
-
* const split: SplitPanes = { x: 120, y: 60 };
|
|
2417
|
-
* console.log(split.x);
|
|
2417
|
+
* const split: SplitPanes = { x: 120, y: 60, topLeftCell: 'H20' };
|
|
2418
|
+
* console.log(split.x, split.topLeftCell);
|
|
2418
2419
|
* ```
|
|
2419
2420
|
*/
|
|
2420
2421
|
interface SplitPanes {
|
|
2421
2422
|
readonly x: number;
|
|
2422
2423
|
readonly y: number;
|
|
2424
|
+
/**
|
|
2425
|
+
* The top-left visible cell of the bottom-right pane (`pane@topLeftCell`): its column is the
|
|
2426
|
+
* first one shown right of the vertical bar, its row the first one shown below the horizontal
|
|
2427
|
+
* bar. Absent when the file does not set it.
|
|
2428
|
+
*/
|
|
2429
|
+
readonly topLeftCell?: string;
|
|
2423
2430
|
}
|
|
2424
2431
|
/**
|
|
2425
2432
|
* Display settings of a sheet's view (`sheetView`, ECMA-376 Part 1 §18.3.1.87, W2-51). Frozen
|
|
@@ -2580,9 +2587,15 @@ interface Sheet {
|
|
|
2580
2587
|
readonly name: string;
|
|
2581
2588
|
/** 0-based position in the workbook. */
|
|
2582
2589
|
readonly index: number;
|
|
2590
|
+
/**
|
|
2591
|
+
* The sheet's id in the file (`sheet@sheetId`), which does not depend on its position; `null`
|
|
2592
|
+
* when the file has none, an invalid one or one repeated from an earlier sheet (reported as
|
|
2593
|
+
* `XLV_W_INVALID_VALUE`).
|
|
2594
|
+
*/
|
|
2595
|
+
readonly sheetId: number | null;
|
|
2583
2596
|
readonly kind: SheetKind;
|
|
2584
2597
|
readonly state: SheetState;
|
|
2585
|
-
/** Part name of the sheet, for example `/xl/worksheets/sheet1.xml`; `null` if it is missing. */
|
|
2598
|
+
/** Part name of the sheet, for example `/xl/worksheets/sheet1.xml`; `null` if it is missing or is the part of an earlier sheet (`XLV_W_SHEET_PART_SHARED`). */
|
|
2586
2599
|
readonly part: string | null;
|
|
2587
2600
|
/** The used range declared in the file (`dimension` element), or `null`. */
|
|
2588
2601
|
readonly dimension: string | null;
|
|
@@ -2943,6 +2956,8 @@ interface InspectColumn {
|
|
|
2943
2956
|
interface InspectSheet {
|
|
2944
2957
|
readonly name: string;
|
|
2945
2958
|
readonly index: number;
|
|
2959
|
+
/** The sheet's id in the file (`Sheet.sheetId`), or `null` when it is missing, invalid or repeated. */
|
|
2960
|
+
readonly sheetId: number | null;
|
|
2946
2961
|
readonly kind: SheetKind;
|
|
2947
2962
|
readonly state: SheetState;
|
|
2948
2963
|
/** Range declared in the file, or `null`. */
|
|
@@ -3091,6 +3106,8 @@ declare function inspect(input: Uint8Array | ArrayBuffer | Workbook, options?: I
|
|
|
3091
3106
|
interface WriteSheetData {
|
|
3092
3107
|
readonly name: string;
|
|
3093
3108
|
readonly state: SheetState;
|
|
3109
|
+
/** The given sheet id, or `null` for the lowest unused one (D-F03). */
|
|
3110
|
+
readonly sheetId?: number | null;
|
|
3094
3111
|
readonly cells: ReadonlyMap<number, ReadonlyMap<number, StoredCell>>;
|
|
3095
3112
|
/** Width, visibility and interned style id (0 = none) by column number. */
|
|
3096
3113
|
readonly columns: ReadonlyMap<number, {
|
|
@@ -3228,13 +3245,19 @@ interface CreateWorkbookOptions {
|
|
|
3228
3245
|
* ```ts
|
|
3229
3246
|
* import { createWorkbook, type AddSheetOptions } from 'xlvane';
|
|
3230
3247
|
*
|
|
3231
|
-
* const options: AddSheetOptions = { state: 'hidden' };
|
|
3248
|
+
* const options: AddSheetOptions = { state: 'hidden', sheetId: 3 };
|
|
3232
3249
|
* createWorkbook().addSheet('Lookup', options);
|
|
3233
3250
|
* ```
|
|
3234
3251
|
*/
|
|
3235
3252
|
interface AddSheetOptions {
|
|
3236
3253
|
/** Visibility. Default `"visible"`. */
|
|
3237
3254
|
readonly state?: SheetState;
|
|
3255
|
+
/**
|
|
3256
|
+
* The sheet's id in the file (`sheet@sheetId`), a whole number from 1 to 65534, unique in the
|
|
3257
|
+
* workbook. It does not change the sheet's position. Sheets without one get the lowest unused
|
|
3258
|
+
* ids when the workbook is written, so a workbook without given ids has the ids 1, 2, 3, ….
|
|
3259
|
+
*/
|
|
3260
|
+
readonly sheetId?: number;
|
|
3238
3261
|
}
|
|
3239
3262
|
/**
|
|
3240
3263
|
* Options for {@link NewSheet.column}.
|
|
@@ -3423,8 +3446,10 @@ interface SheetViewOptions {
|
|
|
3423
3446
|
readonly layout?: SheetLayout;
|
|
3424
3447
|
/**
|
|
3425
3448
|
* Splits the window (without freezing) at `x` points from the left and `y` points from the
|
|
3426
|
-
* top; a missing one is 0, but not both. `
|
|
3427
|
-
*
|
|
3449
|
+
* top; a missing one is 0, but not both. `topLeftCell` (optional) is the top-left visible cell
|
|
3450
|
+
* of the bottom-right pane: the first column shown right of the vertical bar and the first row
|
|
3451
|
+
* below the horizontal bar. `null` removes the split. A split replaces frozen panes, and
|
|
3452
|
+
* {@link NewSheet.freeze} replaces a split.
|
|
3428
3453
|
*/
|
|
3429
3454
|
readonly split?: Partial<SplitPanes> | null;
|
|
3430
3455
|
/** The top-left visible cell (`sheetView@topLeftCell`), e.g. `"C10"`; `null` for the default. */
|
|
@@ -3506,6 +3531,8 @@ declare class NewSheet {
|
|
|
3506
3531
|
private readonly book;
|
|
3507
3532
|
/** Visibility of the sheet. */
|
|
3508
3533
|
readonly state: SheetState;
|
|
3534
|
+
/** The id given to {@link NewWorkbook.addSheet}, or `null` when the lowest unused id is taken when writing. */
|
|
3535
|
+
readonly sheetId: number | null;
|
|
3509
3536
|
/** @internal */
|
|
3510
3537
|
readonly cellMap: Map<number, Map<number, StoredCell>>;
|
|
3511
3538
|
/** @internal */
|
|
@@ -3564,7 +3591,7 @@ declare class NewSheet {
|
|
|
3564
3591
|
readonly tableList: NormalizedTable[];
|
|
3565
3592
|
private count;
|
|
3566
3593
|
/** @internal Use {@link NewWorkbook.addSheet}. */
|
|
3567
|
-
constructor(name: string, state: SheetState, book: NewWorkbook);
|
|
3594
|
+
constructor(name: string, state: SheetState, book: NewWorkbook, sheetId?: number | null);
|
|
3568
3595
|
/** Number of cells that have a value or a style. */
|
|
3569
3596
|
get cellCount(): number;
|
|
3570
3597
|
private address;
|
|
@@ -4006,7 +4033,7 @@ declare class NewWorkbook {
|
|
|
4006
4033
|
*
|
|
4007
4034
|
* const workbook = createWorkbook();
|
|
4008
4035
|
* workbook.addSheet('Data');
|
|
4009
|
-
* workbook.addSheet('Lookup', { state: 'hidden' });
|
|
4036
|
+
* workbook.addSheet('Lookup', { state: 'hidden', sheetId: 5 });
|
|
4010
4037
|
* ```
|
|
4011
4038
|
*/
|
|
4012
4039
|
addSheet(name: string, options?: AddSheetOptions): NewSheet;
|
|
@@ -4549,6 +4576,8 @@ interface StreamRow {
|
|
|
4549
4576
|
interface StreamSheetInfo {
|
|
4550
4577
|
readonly name: string;
|
|
4551
4578
|
readonly index: number;
|
|
4579
|
+
/** `sheet@sheetId`, as `Sheet.sheetId`. */
|
|
4580
|
+
readonly sheetId: number | null;
|
|
4552
4581
|
readonly kind: SheetKind;
|
|
4553
4582
|
readonly state: SheetState;
|
|
4554
4583
|
}
|
|
@@ -4647,7 +4676,9 @@ declare const STREAM_LIMIT_DEFAULTS: Partial<ReadLimits>;
|
|
|
4647
4676
|
*/
|
|
4648
4677
|
declare function openWorkbookStream(source: Uint8Array | ArrayBuffer | Blob, options?: OpenWorkbookStreamOptions): Promise<WorkbookStream>;
|
|
4649
4678
|
/**
|
|
4650
|
-
* Options for {@link readTableStream}.
|
|
4679
|
+
* Options for {@link readTableStream}. As with `readTable`, at most `max(limits.maxCells, 16 ×
|
|
4680
|
+
* cells read)` row properties are produced (`limits.maxCells` defaults to 5 000 000 here,
|
|
4681
|
+
* although it does not limit the cells streamed).
|
|
4651
4682
|
*
|
|
4652
4683
|
* @example
|
|
4653
4684
|
* ```ts
|
|
@@ -4753,6 +4784,8 @@ type StreamRowInput = readonly CellInput[] | {
|
|
|
4753
4784
|
interface StreamSheetSpec {
|
|
4754
4785
|
readonly name: string;
|
|
4755
4786
|
readonly state?: SheetState;
|
|
4787
|
+
/** The sheet's id in the file, as for `addSheet` (1 to 65534, unique; D-F03). */
|
|
4788
|
+
readonly sheetId?: number;
|
|
4756
4789
|
/** Column options by position (column A first); `undefined` entries keep the default. */
|
|
4757
4790
|
readonly columns?: readonly (ColumnOptions | undefined)[];
|
|
4758
4791
|
readonly freeze?: FreezeOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $t as metricsOf, A as limitExceeded, Bt as resolveLimits, C as Bytes, D as TAIL_BYTES, Dt as normalizeTable, E as NotLoaded, Et as TABLE_CONTENT_TYPE, F as validateLocalHeaders, Ft as normalizeStyle, Ht as printNames, I as WarningCollector, Jt as DRAWING_CONTENT_TYPE, K as SheetRels, L as sheetNotFound, N as readCentralDirectory, O as checkSource$1, On as XlvError, Ot as checkDefinedName, P as unsupported, Q as createSharedStrings, R as createWorksheetParser, Rt as DEFAULT_READ_LIMITS, S as workbookPartsToLoad, St as openPackage, T as HEAD_BYTES, Ut as printXml, Wt as sheetProtectionXml, X as cellXml, Xt as MediaParts, Y as buildStyles, Yt as IMAGE_CONTENT_TYPES, Z as contentTypesXml, Zt as drawingParts, _ as isoDate, _t as FormulaGroups, a as DATE_FORMAT, an as MAX_COLUMNS, cn as formatCellRef, ct as sheetHead, d as convertCellInput, dt as sheetTail, en as resolveImage, f as createWorkbook, fn as APP_PROPERTIES_PART, gt as workbookXml, h as detectHeader, hn as corePropertiesXml, ht as workbookRelsXml, i as readOptions, it as noteParts, j as locateCentralDirectory, k as corrupt, kt as checkUniqueName, lt as sheetRelsPartName, mn as appPropertiesXml, n as oneOfOption, nt as hyperlinksXml, o as DATE_TIME_FORMAT, on as MAX_ROWS, ot as rootRelsXml, p as sortedNotes, pn as CORE_PROPERTIES_PART, pt as tableParts, rn as classifyRelationship, rt as nameTitles, sn as columnLetters, st as rowStart, u as checkBookViews, ut as sheetRulesXml, v as analyzeWorkbook, w as CORRUPT_HINT, wt as partKey, y as readNotes, yn as createXmlByteStreamParser, yt as crc32, zt as checkOutputPositions } from "./options-Ba6r4zP1.js";
|
|
2
2
|
import { Deflate, Inflate } from "fflate";
|
|
3
3
|
// src/zip/stream.ts
|
|
4
4
|
/**
|
|
@@ -78,7 +78,7 @@ async function openZipSource(source, limits) {
|
|
|
78
78
|
const dir = await withLoading(b, src, () => locateCentralDirectory(b, limits));
|
|
79
79
|
if (!b.has(dir.centralOffset, dir.centralLimit) && dir.centralLimit > dir.centralOffset) b.add(dir.centralOffset, await src.read(dir.centralOffset, dir.centralLimit));
|
|
80
80
|
const entries = await withLoading(b, src, () => readCentralDirectory(b, dir.centralOffset, dir.centralLimit, dir.entryCount));
|
|
81
|
-
for (const entry of entries) {
|
|
81
|
+
for (const entry of [...entries].sort((x, y) => x.headerOffset - y.headerOffset)) {
|
|
82
82
|
const at = entry.headerOffset;
|
|
83
83
|
if (at + 30 > dir.centralOffset || b.has(at, at + 30)) continue;
|
|
84
84
|
const fixed = await src.read(at, at + 30);
|
|
@@ -503,9 +503,9 @@ async function openWorkbookStream(source, options) {
|
|
|
503
503
|
if (entry.kind !== "worksheet" || entry.part === null) return [];
|
|
504
504
|
const cached = noteCache.get(entry.part);
|
|
505
505
|
if (cached !== void 0) return cached;
|
|
506
|
-
const parts = pkg.relationships(entry.part).filter((r) => !r.external && ["comments", "vmlDrawing"].includes(classifyRelationship(r.type)?.name ?? "") && pkg.hasPart(r.target));
|
|
506
|
+
const parts = pkg.relationships(entry.part).filter((r) => !r.external && ["comments", "vmlDrawing"].includes(classifyRelationship(r.type)?.name ?? "") && pkg.hasPart(r.target) && !entry.foreignParts.has(partKey(r.target)));
|
|
507
507
|
if (parts.length > 0) await preloaded.load(parts.map((r) => zipName(r.target)));
|
|
508
|
-
const notes = Object.freeze(readNotes(pkg, entry.part, entry.name, limits, warnings));
|
|
508
|
+
const notes = Object.freeze(readNotes(pkg, entry.part, entry.name, limits, warnings, entry.foreignParts));
|
|
509
509
|
noteCache.set(entry.part, notes);
|
|
510
510
|
return notes;
|
|
511
511
|
}
|
|
@@ -538,7 +538,8 @@ async function openWorkbookStream(source, options) {
|
|
|
538
538
|
conformance: info.conformance,
|
|
539
539
|
budget: {
|
|
540
540
|
remaining: Infinity,
|
|
541
|
-
sharedText: limits.maxSharedStringChars
|
|
541
|
+
sharedText: limits.maxSharedStringChars,
|
|
542
|
+
formulaText: limits.maxSharedStringChars
|
|
542
543
|
},
|
|
543
544
|
formatCache
|
|
544
545
|
}, (number, cells, rowInfo, styledCells) => ready.push({
|
|
@@ -571,6 +572,7 @@ async function openWorkbookStream(source, options) {
|
|
|
571
572
|
sheets: info.sheets.map((s) => ({
|
|
572
573
|
name: s.name,
|
|
573
574
|
index: s.index,
|
|
575
|
+
sheetId: s.sheetId,
|
|
574
576
|
kind: s.kind,
|
|
575
577
|
state: s.state
|
|
576
578
|
})),
|
|
@@ -637,6 +639,7 @@ async function* readTableStream(source, options) {
|
|
|
637
639
|
}
|
|
638
640
|
const limits = o.get("limits");
|
|
639
641
|
const book = await openWorkbookStream(source, limits === void 0 ? void 0 : { limits });
|
|
642
|
+
const outputCells = limits?.maxCells ?? DEFAULT_READ_LIMITS.maxCells;
|
|
640
643
|
const sheetName = o.get("sheet") ?? (book.sheets.find((s) => s.kind === "worksheet" && s.state === "visible") ?? book.sheets[0])?.name;
|
|
641
644
|
if (sheetName === void 0) return;
|
|
642
645
|
const buffered = [];
|
|
@@ -658,17 +661,25 @@ async function* readTableStream(source, options) {
|
|
|
658
661
|
headerRow = header;
|
|
659
662
|
}
|
|
660
663
|
const source = headerRow === null ? nonEmpty.flatMap((r) => r.cells) : nonEmpty.find((r) => r.number === headerRow)?.cells ?? [];
|
|
661
|
-
|
|
662
|
-
|
|
664
|
+
let minCol = Infinity;
|
|
665
|
+
let maxCol = -Infinity;
|
|
666
|
+
for (const c of source) {
|
|
667
|
+
if (c.col < minCol) minCol = c.col;
|
|
668
|
+
if (c.col > maxCol) maxCol = c.col;
|
|
669
|
+
}
|
|
670
|
+
const headerCells = new Map(headerRow === null ? [] : source.map((c) => [c.col, c]));
|
|
663
671
|
const out = [];
|
|
664
672
|
const used = /* @__PURE__ */ new Set();
|
|
673
|
+
const nextSuffix = /* @__PURE__ */ new Map();
|
|
665
674
|
for (let col = minCol; col <= maxCol; col++) {
|
|
666
675
|
const letter = columnLetters(col);
|
|
667
|
-
const cell =
|
|
676
|
+
const cell = headerCells.get(col);
|
|
668
677
|
const text = cell === void 0 || cell.value === null ? null : cell.value instanceof Date ? isoDate(cell.value) : String(cell.value);
|
|
669
678
|
const base = text === null || text.trim() === "" ? letter : text.trim();
|
|
670
679
|
let key = base;
|
|
671
|
-
|
|
680
|
+
let n = nextSuffix.get(base) ?? 2;
|
|
681
|
+
while (used.has(key)) key = `${base}_${String(n++)}`;
|
|
682
|
+
nextSuffix.set(base, n);
|
|
672
683
|
used.add(key);
|
|
673
684
|
out.push({
|
|
674
685
|
key,
|
|
@@ -679,8 +690,13 @@ async function* readTableStream(source, options) {
|
|
|
679
690
|
}
|
|
680
691
|
return out;
|
|
681
692
|
};
|
|
693
|
+
let positions = 0;
|
|
694
|
+
let cellsRead = 0;
|
|
682
695
|
const emit = async (r, cols) => {
|
|
683
696
|
if (headerRow !== null && r.number <= headerRow) return null;
|
|
697
|
+
cellsRead += r.cells.length;
|
|
698
|
+
positions += cols.length;
|
|
699
|
+
checkOutputPositions(positions, cellsRead, outputCells, "The table", sheetName);
|
|
684
700
|
const byCol = new Map(r.cells.map((c) => [c.col, c]));
|
|
685
701
|
if (cols.every((c) => byCol.get(c.col)?.value == null)) return null;
|
|
686
702
|
const row = {};
|
|
@@ -850,6 +866,7 @@ function writeWorkbookStream(options) {
|
|
|
850
866
|
const s = readOptions(raw, [
|
|
851
867
|
"name",
|
|
852
868
|
"state",
|
|
869
|
+
"sheetId",
|
|
853
870
|
"columns",
|
|
854
871
|
"freeze",
|
|
855
872
|
"tabColor",
|
|
@@ -872,7 +889,11 @@ function writeWorkbookStream(options) {
|
|
|
872
889
|
"rows"
|
|
873
890
|
], `sheets[${String(i)}]`);
|
|
874
891
|
const state = s.get("state");
|
|
875
|
-
const
|
|
892
|
+
const sheetId = s.get("sheetId");
|
|
893
|
+
const sheet = book.addSheet(s.get("name"), {
|
|
894
|
+
...state === void 0 ? {} : { state },
|
|
895
|
+
...sheetId === void 0 ? {} : { sheetId }
|
|
896
|
+
});
|
|
876
897
|
const columns = s.get("columns");
|
|
877
898
|
if (columns !== void 0) {
|
|
878
899
|
if (!Array.isArray(columns)) throw new XlvError("XLV_E_INVALID_OPTION", `sheets[${String(i)}].columns must be an array.`, {
|
|
@@ -1188,6 +1209,7 @@ function writeWorkbookStream(options) {
|
|
|
1188
1209
|
data: encoder.encode(workbookXml(prepared.map((p) => ({
|
|
1189
1210
|
name: p.sheet.name,
|
|
1190
1211
|
state: p.sheet.state,
|
|
1212
|
+
sheetId: p.sheet.sheetId,
|
|
1191
1213
|
autoFilter: p.filterRange
|
|
1192
1214
|
})), book.dateSystem, allNames(), book.workbookProtection, {
|
|
1193
1215
|
bookViews: book.bookViews,
|
|
@@ -104,6 +104,13 @@
|
|
|
104
104
|
"type": "integer",
|
|
105
105
|
"minimum": 0
|
|
106
106
|
},
|
|
107
|
+
"sheetId": {
|
|
108
|
+
"type": [
|
|
109
|
+
"integer",
|
|
110
|
+
"null"
|
|
111
|
+
],
|
|
112
|
+
"minimum": 0
|
|
113
|
+
},
|
|
107
114
|
"kind": {
|
|
108
115
|
"enum": [
|
|
109
116
|
"worksheet",
|
|
@@ -454,6 +461,7 @@
|
|
|
454
461
|
"required": [
|
|
455
462
|
"name",
|
|
456
463
|
"index",
|
|
464
|
+
"sheetId",
|
|
457
465
|
"kind",
|
|
458
466
|
"state",
|
|
459
467
|
"dimension",
|
package/docs/errors.md
CHANGED
|
@@ -61,11 +61,13 @@ Each code links to its section, which says what to do. The CLI prints the code a
|
|
|
61
61
|
| [`XLV_W_MACROS_PRESENT`](#xlv_w_macros_present) | The workbook contains a VBA project or Excel 4.0 macro sheets. |
|
|
62
62
|
| [`XLV_W_EXTERNAL_LINKS`](#xlv_w_external_links) | The workbook links to other workbooks. |
|
|
63
63
|
| [`XLV_W_DUPLICATE_CELL`](#xlv_w_duplicate_cell) | A sheet defines the same cell more than once. |
|
|
64
|
+
| [`XLV_W_LIMIT_REACHED`](#xlv_w_limit_reached) | Reading stopped computing something derived from the file because the work would be far out of proportion to its data. |
|
|
64
65
|
| [`XLV_W_INVALID_VALUE`](#xlv_w_invalid_value) | A value does not match its declared type and is returned in a safe form, for example a numeric cell whose text is not a number (returned … |
|
|
65
66
|
| [`XLV_W_UNUSUAL_HYPERLINK`](#xlv_w_unusual_hyperlink) | A sheet has hyperlinks whose external target uses a scheme other than `http`, `https` or `mailto`, for example `file:`, `javascript:` or … |
|
|
66
67
|
| [`XLV_W_DRAWING_CONTENT_NOT_READ`](#xlv_w_drawing_content_not_read) | The drawing of a sheet holds objects other than pictures: charts, shapes, connectors, group shapes, content parts or alternate content. |
|
|
67
68
|
| [`XLV_W_THREADED_COMMENTS`](#xlv_w_threaded_comments) | A sheet has threaded comments, the conversations of current Excel versions ([MS-XLSX] §2.3.7). |
|
|
68
69
|
| [`XLV_W_SHEET_PART_MISSING`](#xlv_w_sheet_part_missing) | A sheet listed in the workbook has no part (the relationship or the part itself is missing). |
|
|
70
|
+
| [`XLV_W_SHEET_PART_SHARED`](#xlv_w_sheet_part_shared) | Two or more sheets listed in the workbook lead to the same worksheet part, or relate to the same comments, VML or table part. |
|
|
69
71
|
| [`XLV_W_PART_MISSING`](#xlv_w_part_missing) | The workbook points to a styles or shared strings part that does not exist. |
|
|
70
72
|
| [`XLV_W_FORMULAS_NOT_RECALCULATED`](#xlv_w_formulas_not_recalculated) | Reported by `editCells` and `appendRows` when the workbook contains formulas. |
|
|
71
73
|
| [`XLV_W_INVALID_CELL_REF`](#xlv_w_invalid_cell_ref) | A worksheet contains a row whose number is not a whole number from 1 to 1048576, a cell whose `r` reference is not a valid A1 reference … |
|
|
@@ -89,6 +91,12 @@ An argument of a method of `@xlvane/compat` is not valid, in a case where excelj
|
|
|
89
91
|
### XLV_E_LIMIT_EXCEEDED
|
|
90
92
|
The file exceeds one of the resource limits (`ReadLimits`): input size, number of ZIP entries, decompressed size of one entry or of all entries, compression ratio, XML nesting depth, attribute count, name or text length, number of elements in a tree-parsed part, or number of cells. `details.limit` names the limit and `details.value` its current value. Sizes are measured on the bytes actually produced by decompression, so a file cannot avoid a limit by declaring false sizes.
|
|
91
93
|
|
|
94
|
+
Some limits also bound work derived from a small file (1.1.1, D-H01):
|
|
95
|
+
|
|
96
|
+
- `maxCells` (`details.limit` `maxCells`, `details.value` the budget): `toCSV`, `readTable`, `toJSON`, `readTableStream`, `xlvane read` and `xlvane convert` write at most `max(maxCells, 16 × cells read)` positions (rows × columns of the output), so a few cells far apart cannot make them produce a value for every position between; `@xlvane/compat`'s `xlsx.load` creates at most as many cells for merged ranges, tables and column definitions, and looks up at most 64 Mi rows (or 16 per cell read) for row settings up to the sheets' dimensions. Pass a smaller `range`, or raise `maxCells` for a trusted file.
|
|
97
|
+
- `maxXmlTextLength`: also the length of an XML comment or processing instruction.
|
|
98
|
+
- `maxSharedStringChars`: also the text of shared formulas, counted apart from shared strings: the length of each sharing cell's formula, as moved to that cell.
|
|
99
|
+
|
|
92
100
|
`fromCSV` (and `xlvane convert`/`create` with CSV input) throws it for text with more fields than `maxCells` (default 5 000 000, `details.limit` `maxCells`), more than 16 384 fields on a line or more than 1 048 576 lines.
|
|
93
101
|
|
|
94
102
|
`NewSheet.validate` throws it when a sheet would get more than 65534 data validations ([MS-OI29500] §2.1.614 g; `details.limit` `dataValidations`). When reading, the conditional formatting and data validations of one sheet count against `maxXmlTreeElements`.
|
|
@@ -162,6 +170,7 @@ A part exists but has the wrong structure: for example the workbook part's root
|
|
|
162
170
|
| `target-mode` | `TargetMode` is neither `Internal` nor `External` |
|
|
163
171
|
| `internal-target` | an internal relationship target cannot be resolved to a part name |
|
|
164
172
|
| `equivalent-part-names` | two ZIP entries map to equivalent part names (e.g. a raw UTF-8 name and its percent-encoded form) |
|
|
173
|
+
|
|
165
174
|
**Fix:** check that the file is an Excel workbook (not a Word or PowerPoint document) and re-save it in a spreadsheet application.
|
|
166
175
|
|
|
167
176
|
### XLV_E_INVALID_CELL_REF
|
|
@@ -255,7 +264,7 @@ The CSV text given to `fromCSV` has a quoted field that is never closed, text ri
|
|
|
255
264
|
`hashPassword` and `verifyPassword` throw it for a hash algorithm other than SHA-1, SHA-256, SHA-384 and SHA-512, and `hashPassword` without a `salt` throws it in a runtime that has no `crypto.getRandomValues` (pass your own random salt there; SR-50, D-C08).
|
|
256
265
|
`editCells` throws it for an array or shared formula in an edit (it writes plain formulas only), and for a cell inside an array formula's range or the master of a shared formula with other cells in its range (D-E02); `details.cell` names it.
|
|
257
266
|
`appendRows` throws it when a table ends with a totals row on the sheet's last used row (the new rows would fall below the totals row; the hint gives the `insertRows` call that grows the table instead), or when growing a table for the new rows would overlap another table (D-R03).
|
|
258
|
-
`insertRows` and `deleteRows` (and `xlvane edit --insert-rows` / `--delete-rows`) also throw it when the sheet has content whose cell references xlvane cannot move yet: tables, charts, shapes and other drawing objects (pictures alone are moved, and deleting rows that would cut a picture is refused), pivot tables, form controls, embedded objects, custom sheet views, threaded comments, extended content such as data
|
|
267
|
+
`insertRows` and `deleteRows` (and `xlvane edit --insert-rows` / `--delete-rows`) also throw it when the sheet has content whose cell references xlvane cannot move yet: tables, charts, shapes and other drawing objects (pictures alone are moved, and deleting rows that would cut a picture is refused), pivot tables, form controls, embedded objects, custom sheet views, threaded comments, extended content such as sparklines or slicers (the conditional formats and data validations of the [MS-XLSX] extension are moved, D-F04), a chart or pivot cache elsewhere that names the sheet, a data table, an array formula the change would split, or a formula or defined name that cannot be adjusted safely (for example a 3-D reference such as `Jan:Mar!A1` that includes the sheet, D-B01). The message names the part or the cell, and `details` gives the element, relationship type or formula.
|
|
259
268
|
**Fix:** for `@xlvane/compat`, see docs/exceljs-compat.md for the supported subset; remove the call, or keep using exceljs for files that need the feature.
|
|
260
269
|
For `insertRows`/`deleteRows`, insert or delete the rows in a spreadsheet application, or remove the named content first.
|
|
261
270
|
|
|
@@ -289,6 +298,10 @@ Some merged ranges have values in cells other than the top-left one. Spreadsheet
|
|
|
289
298
|
`editCells` or `appendRows` wrote a value into a cell of a merged range other than its top-left cell. The value is stored, but spreadsheet applications show only the top-left cell of a merged range, so the value is not visible. `cells` lists the cells written (up to ten); the message names the first one and its merged range.
|
|
290
299
|
**Fix:** write the value into the top-left cell of the range (named in the message), or unmerge the range first.
|
|
291
300
|
|
|
301
|
+
### XLV_W_LIMIT_REACHED
|
|
302
|
+
Reading stopped computing something derived from the file because the work would be far out of proportion to its data, and the file is read without it. Today: hyperlinks whose ranges cover far more positions than the sheet has cells (more than 16 visits per cell plus 1 000 000); `sheet.hyperlinks` lists every link, but `cell.hyperlink` is not set for the cells of the remaining links (D-H01).
|
|
303
|
+
**Fix:** nothing, if the file comes from an unknown source: this protects the reader. Look up a cell's link in `sheet.hyperlinks` by its range.
|
|
304
|
+
|
|
292
305
|
### XLV_W_VERY_HIDDEN_SHEET
|
|
293
306
|
A sheet has the state `veryHidden`: spreadsheet applications offer no menu command to unhide it, so users usually do not know it exists.
|
|
294
307
|
**Fix:** nothing, if the sheet is expected; `inspect` lists it with its state, and `workbook.sheets` includes it.
|
|
@@ -325,6 +338,10 @@ A sheet has threaded comments, the conversations of current Excel versions ([MS-
|
|
|
325
338
|
A sheet listed in the workbook has no part (the relationship or the part itself is missing). The sheet is returned with `part: null` and no cells.
|
|
326
339
|
**Fix:** re-save the file in the application that made it; the sheet's cells are not in the file.
|
|
327
340
|
|
|
341
|
+
### XLV_W_SHEET_PART_SHARED
|
|
342
|
+
Two or more sheets listed in the workbook lead to the same worksheet part, or relate to the same comments, VML or table part (part names compared without regard to case, as OPC requires). Spreadsheet applications write one such part per sheet; reading a shared part again for every sheet would decompress and parse it many times, outside the limit on decompressed bytes. The part is read for the first of these sheets only: for a worksheet part, the others are returned with `part: null` and no cells; for a comments, VML or table part, the others are read without its notes or table. A sheet that relates to one table part twice gets that table once. The location names the sheet and the part.
|
|
343
|
+
**Fix:** re-save the file in the application that made it, and check whether the sheets returned without cells should hold data.
|
|
344
|
+
|
|
328
345
|
### XLV_W_PART_MISSING
|
|
329
346
|
The workbook points to a styles or shared strings part that does not exist. Reading continues without it: without styles, date-formatted numbers are returned as numbers; without shared strings, shared-string cells are treated as empty.
|
|
330
347
|
**Fix:** re-save the file in the application that made it; check number formats and text cells of the result.
|
package/docs/exceljs-compat.md
CHANGED
|
@@ -38,7 +38,7 @@ Status: **supported** means the same behaviour as exceljs for the cases covered
|
|
|
38
38
|
| `xlsx.write(stream)` | supported | | `lib/xlsx/xlsx.js` L643 |
|
|
39
39
|
| `xlsx.createInputStream()` | supported | Throws the deprecation error, as in exceljs 4. | `lib/xlsx/xlsx.js` L238 |
|
|
40
40
|
| `csv.read(stream, options)`, `csv.readFile(path, options)` | supported | Adds a worksheet, with exceljs's options (`sheetName`, `dateFormats`, `map`, `parserOptions`: `delimiter`, `quote`, `escape`, `trim`/`ltrim`/`rtrim`, `ignoreEmpty`, `comment`, `skipLines`, `skipRows`, `maxRows`, `headers`, `renameHeaders`, `encoding`) and its default conversion of fields (X4-23), on xlvane's own parser (no fast-csv). Accepts a Node.js readable stream, a Web `ReadableStream` or any (async) iterable of strings or bytes. Differences: text of white space only stays text (exceljs reads `' '` as 0), `-Infinity` stays text (it cannot be stored), a leading byte order mark is dropped (exceljs keeps it in the first field), `headers: true` skips the header line (exceljs throws `data.map is not a function`), a missing file or a malformed line throws `XLV_E_FILE_READ` / `XLV_E_CSV_MALFORMED`. `readFile` needs `node:fs` (Node.js, Bun, Deno). Dates are parsed as dayjs 1.11 customParseFormat parses them in strict mode (D-E06): letters that are no token, such as an unbracketed `T` or `dddd`, are skipped, and each token is searched in the rest of the text. An unclosed quote is reported on the line where it opens; a `quote` or `escape` longer than one character throws `XLV_E_INVALID_OPTION`. | `lib/csv/csv.js` L32–98 |
|
|
41
|
-
| `csv.write(stream, options)`, `csv.writeFile(path, options)`, `csv.writeBuffer(options)` | supported | Writes one worksheet with exceljs's options (`sheetName`, `sheetId`, `dateFormat`, `dateUTC`, `map`, `includeEmptyRows`, `encoding`, `formatterOptions`: `delimiter`, `rowDelimiter`, `quote`, `escape`, `quoteColumns`, `headers`, `writeHeaders`, `includeEndRowDelimiter`, `writeBOM`) and fast-csv's quoting (X4-24); the cross-check sample gives the same text as exceljs 4.4.0. Differences: text that starts with `=`, `+`, `-`, `@`, tab, CR or
|
|
41
|
+
| `csv.write(stream, options)`, `csv.writeFile(path, options)`, `csv.writeBuffer(options)` | supported | Writes one worksheet with exceljs's options (`sheetName`, `sheetId`, `dateFormat`, `dateUTC`, `map`, `includeEmptyRows`, `encoding`, `formatterOptions`: `delimiter`, `rowDelimiter`, `quote`, `escape`, `quoteColumns`, `headers`, `writeHeaders`, `includeEndRowDelimiter`, `writeBOM`) and fast-csv's quoting (X4-24); the cross-check sample gives the same text as exceljs 4.4.0. Differences: text that starts with `=`, `+`, `-`, `@`, tab, CR, LF or another control character, or with a full-width or small form of these signs, is written with a leading `'` (CSV injection, docs/facts/csv.md CSV-10, CSV-12; `formulaInjection: "off"` writes it unchanged, as exceljs); a formula result of 0 or `false` is written (exceljs writes an empty field), a date result is formatted as a date and an error result as its text; one blank line per missing row also before the first row (exceljs writes one too few there); a `sheetName` or `sheetId` that does not exist throws `XLV_E_SHEET_NOT_FOUND` (exceljs writes an empty file); header names in `formatterOptions.headers` are escaped like values. With `headers`, an array row gives one field per header (longer rows cut, shorter ones end in empty fields), as fast-csv writes it; `dateFormat: ''` uses the default format, as dayjs does (D-E06). `writeFile` writes `utf8`, `utf16le` or `latin1` and needs `node:fs`. | `lib/csv/csv.js` L109–186 |
|
|
42
42
|
| `csv.createInputStream()` | supported | Throws the deprecation error, as in exceljs 4. | `lib/csv/csv.js` L101 |
|
|
43
43
|
| `definedNames` (`add`, `addEx`, `remove`, `removeEx`, `removeAllNames`, `forEach`, `getNames`, `getNamesEx`, `getRanges`, `getMatrix`, `model`) | supported | As in exceljs, a name is a set of cells, written as rectangles with absolute references and no sheet scope; on reading, names that are not cell ranges (constants, formulas, `#REF!`) and the sheet scope (`localSheetId`) are dropped. Built-in `_xlnm.` names are not listed: print areas and titles are read into `pageSetup`, as in exceljs, and xlvane writes the autofilter name itself. Names exceljs accepts but Excel does not (for example `A1` or names starting with `_xl`) throw `XLV_E_INVALID_DEFINED_NAME` when the workbook is written. | `lib/doc/defined-names.js`; `lib/xlsx/xform/book/defined-name-xform.js`; `lib/xlsx/xform/book/workbook-xform.js` L187 |
|
|
44
44
|
| `addImage(image)`, `getImage(id)` | supported | PNG, JPEG and GIF given as `buffer`, `base64` (a data URL is accepted, as in exceljs) or `filename`; the format is recognised from the bytes, `extension` is kept but not used (exceljs writes `image/jpg` for `extension: 'jpg'`). As in exceljs, a `filename` is read when the workbook is written (`xlsx.writeBuffer`/`writeFile`/`write` and the streaming `WorkbookWriter`), so a missing file fails there; outside Node.js, Bun and Deno it gives `XLV_E_NOT_SUPPORTED`. Other formats throw `XLV_E_INVALID_IMAGE`. Read back, each image part is one media entry `{ type, name, extension, buffer }`, `buffer` a `Uint8Array`. Identical images are stored once, with one relationship per drawing (exceljs writes one per use). | `lib/doc/workbook.js` L142–151; `lib/xlsx/xlsx.js` L421–442 (L426–429: `filename` read at write) |
|
|
@@ -47,7 +47,7 @@ Status: **supported** means the same behaviour as exceljs for the cases covered
|
|
|
47
47
|
|
|
48
48
|
| API | Status | Notes | Source in exceljs |
|
|
49
49
|
|---|---|---|---|
|
|
50
|
-
| `name`, `id`, `state` | partly | Ids are given as in exceljs (the first free id),
|
|
50
|
+
| `name`, `id`, `state` | partly | Ids are given as in exceljs (the first free id), written as `sheetId` and kept on loading and by the `model` setter, as exceljs does, so `getWorksheet(id)` finds the same sheet after removing a sheet, writing and loading (D-F03). Differences: an id outside 1 to 65534, the range Office uses (W2-20), is written as the lowest unused `sheetId`; a file's missing, repeated or larger than 65534 `sheetId` gives the worksheet the lowest free id (exceljs reads `NaN`, lets the later sheet replace the earlier one, or uses the large number as an array index); the streaming `WorkbookReader` numbers worksheets 1, 2, 3… in file order, where exceljs uses the number N of the part `xl/worksheets/sheetN.xml` (`lib/stream/xlsx/workbook-reader.js` L107-109, L293-297). | `lib/doc/worksheet.js` L33; `lib/doc/workbook.js` L43–51; `lib/xlsx/xform/book/sheet-xform.js` L7, L18 |
|
|
51
51
|
| `columns` (get / set `{ header, key, width, style }`) | supported | As in exceljs, a column exists for every column a cell was created in, also after `addRow` and on a loaded file without `<cols>`, so `columns.forEach(c => { c.eachCell(…); c.width = … })` works; columns without width, style, hidden flag or outline level are not written (D-R09). An empty sheet gives `[]` where exceljs gives `null`. | `lib/doc/worksheet.js` L203, L209, L243–261; `lib/doc/row.js` L48 |
|
|
52
52
|
| `getColumn(key \| letter \| number)` | supported | | `lib/doc/worksheet.js` L243 |
|
|
53
53
|
| `addRow(values \| object, style?)`, `addRows` | supported | Style `'i'` / `'i+'` copies the style of the row above, as in exceljs. | `lib/doc/worksheet.js` L406, L414 |
|
|
@@ -58,7 +58,7 @@ Status: **supported** means the same behaviour as exceljs for the cases covered
|
|
|
58
58
|
| `rowCount`, `actualRowCount`, `columnCount` | supported | | `lib/doc/worksheet.js` L374, L378, L313 |
|
|
59
59
|
| `mergeCells(range \| t, l, b, r)`, `unMergeCells` | supported | | `lib/doc/worksheet.js` L602, L656 |
|
|
60
60
|
| `mergeCellsWithoutStyle(...)`, `findRows(start, length)`, `lastColumn`, `fillFormula(range, formula, results, shareType)`, `model` (get / set), `destroy()` | supported | `fillFormula` writes the formula into the top-left cell and `{ sharedFormula }` (or the same array formula) into the others, with results from a function, a flat array or a 2-D array, as in exceljs (X4-29). `findRows` returns `_rows.slice(start - 1, start - 1 + length)` as exceljs does (D-E06). `model` is xlvane's own plain snapshot (see `workbook.model`). | `lib/doc/worksheet.js` L181, L309, L370, L607, L678–721, L842–903 |
|
|
61
|
-
| `views` | partly | The first view is written: frozen panes, split panes (`xSplit`/`ySplit` in 1/20 point), `zoomScale` (10–400), `zoomScaleNormal`, `showGridLines`, `showRowColHeaders`, `showRuler`, `rightToLeft`, `style` (`pageBreakPreview`, `pageLayout`), `activeCell`, and `topLeftCell` of a normal view (X4-28). Differences: further views are not written, because xlvane's core writes one `sheetView` per worksheet; `workbookViewId` is always 0; frozen panes get the cell right of and below the panes as `topLeftCell
|
|
61
|
+
| `views` | partly | The first view is written: frozen panes, split panes (`xSplit`/`ySplit` in 1/20 point), `zoomScale` (10–400), `zoomScaleNormal`, `showGridLines`, `showRowColHeaders`, `showRuler`, `rightToLeft`, `style` (`pageBreakPreview`, `pageLayout`), `activeCell`, and `topLeftCell` of a normal view (X4-28). Differences: further views are not written, because xlvane's core writes one `sheetView` per worksheet; `workbookViewId` is always 0; frozen panes always get the cell right of and below the panes as `topLeftCell` (exceljs writes a frozen view's own `topLeftCell` when given, sheet-view-xform.js L50-53); a split view's `topLeftCell` is written as `pane@topLeftCell` and read back, as in exceljs (L72-85, L118-124; D-F02), and its `activeCell` is written and read back as the selection of the active pane; `activePane` is the pane the split implies; `tabSelected` is written for the first visible worksheet, whatever the view says. Every worksheet reads back with one view shaped as exceljs reads it. | `lib/doc/worksheet.js` L114; `lib/xlsx/xform/sheet/sheet-view-xform.js`; `index.d.ts` L33–149 |
|
|
62
62
|
| `autoFilter` (range string) | supported | | `lib/doc/worksheet.js` L116 |
|
|
63
63
|
| `insertRow(pos, values, style?)`, `insertRows(pos, values, style?)` | partly | Style options `n`, `i`, `i+`, `o`, `o+` as in exceljs. Built on `spliceRows`, so the differences below apply. | `lib/doc/worksheet.js` L422, L428, L444 |
|
|
64
64
|
| `spliceRows(start, count, ...inserts)` | partly | xlvane moves rows as a spreadsheet application does; exceljs 4.4.0 moves only values, styles and heights (X4-15). Differences: row objects keep their identity and their `number` follows them (exceljs copies values between row objects); the hidden flag, notes and links move with the row (exceljs leaves hidden/outline at the position and drops notes); merged ranges move, grow when rows are inserted inside them (inserted cells get a copy of the top-left cell's style, the other cells keep their own), shrink when rows are removed, and are dropped when their top-left cell is removed or one cell or nothing is left, as LibreOffice does (R-14; exceljs keeps stale ranges and dissolves merges on removal); the autofilter range moves and shrinks, and stops at the last row or column (exceljs leaves it); cells inserted inside a defined name join it (exceljs leaves a gap), and names follow whatever the case of their sheet name (exceljs compares it exactly); styles are copied, never shared; removing more rows than follow the removed block works (exceljs leaves rows behind). Formulas in every worksheet follow the splice as in a spreadsheet application (xlvane `adjustFormula`, D-B01; exceljs leaves them unchanged); formulas given in the inserted rows keep the text the caller wrote. If a formula cannot be adjusted safely, the call throws `XLV_E_NOT_SUPPORTED` before anything changes. | `lib/doc/worksheet.js` L483–548 |
|
package/docs/inspect-json.md
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
|---|---|---|
|
|
35
35
|
| `name` | string | sheet name |
|
|
36
36
|
| `index` | number | 0-based position |
|
|
37
|
+
| `sheetId` | number or `null` | the sheet's id in the file (`sheet@sheetId`), independent of its position; `null` when the file has none, an invalid one or a repeated one |
|
|
37
38
|
| `kind` | `"worksheet" \| "chartsheet" \| "dialogsheet" \| "macrosheet"` | only worksheets have cells |
|
|
38
39
|
| `state` | `"visible" \| "hidden" \| "veryHidden"` | visibility |
|
|
39
40
|
| `dimension` | string or `null` | range declared in the file, e.g. `"A1:D20"` |
|
|
@@ -112,6 +113,7 @@ Values in `samples` are JSON-safe: numbers, booleans, strings (cut to 100 charac
|
|
|
112
113
|
{
|
|
113
114
|
"name": "Sales",
|
|
114
115
|
"index": 0,
|
|
116
|
+
"sheetId": 1,
|
|
115
117
|
"kind": "worksheet",
|
|
116
118
|
"state": "visible",
|
|
117
119
|
"dimension": "A1:C3",
|