@cj-tech-master/excelts 9.2.1 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/README_zh.md +29 -6
- package/dist/browser/index.browser.d.ts +1 -1
- package/dist/browser/index.browser.js +4 -0
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.js +4 -0
- package/dist/browser/modules/excel/cell.d.ts +17 -3
- package/dist/browser/modules/excel/cell.js +170 -22
- package/dist/browser/modules/excel/defined-names.d.ts +96 -1
- package/dist/browser/modules/excel/defined-names.js +411 -21
- package/dist/browser/modules/excel/image.d.ts +11 -0
- package/dist/browser/modules/excel/image.js +24 -1
- package/dist/browser/modules/excel/stream/workbook-reader.browser.d.ts +9 -3
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +14 -0
- package/dist/browser/modules/excel/stream/workbook-reader.d.ts +2 -1
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +39 -5
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +48 -1
- package/dist/browser/modules/excel/stream/workbook-writer.d.ts +3 -2
- package/dist/browser/modules/excel/stream/worksheet-reader.js +17 -1
- package/dist/browser/modules/excel/stream/worksheet-writer.d.ts +39 -6
- package/dist/browser/modules/excel/stream/worksheet-writer.js +45 -5
- package/dist/browser/modules/excel/table.js +15 -2
- package/dist/browser/modules/excel/types.d.ts +133 -2
- package/dist/browser/modules/excel/utils/col-cache.d.ts +1 -0
- package/dist/browser/modules/excel/utils/col-cache.js +15 -0
- package/dist/browser/modules/excel/utils/drawing-utils.d.ts +3 -3
- package/dist/browser/modules/excel/utils/drawing-utils.js +4 -0
- package/dist/browser/modules/excel/utils/external-link-formula.d.ts +76 -0
- package/dist/browser/modules/excel/utils/external-link-formula.js +208 -0
- package/dist/browser/modules/excel/utils/iterate-stream.d.ts +9 -3
- package/dist/browser/modules/excel/utils/iterate-stream.js +3 -1
- package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +19 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.js +37 -2
- package/dist/browser/modules/excel/utils/shared-strings.d.ts +8 -3
- package/dist/browser/modules/excel/utils/shared-strings.js +21 -2
- package/dist/browser/modules/excel/utils/workbook-protection.d.ts +30 -0
- package/dist/browser/modules/excel/utils/workbook-protection.js +30 -0
- package/dist/browser/modules/excel/workbook.browser.d.ts +257 -6
- package/dist/browser/modules/excel/workbook.browser.js +318 -34
- package/dist/browser/modules/excel/workbook.d.ts +1 -1
- package/dist/browser/modules/excel/worksheet.d.ts +3 -1
- package/dist/browser/modules/excel/worksheet.js +21 -2
- package/dist/browser/modules/excel/xlsx/rel-type.d.ts +15 -0
- package/dist/browser/modules/excel/xlsx/rel-type.js +16 -1
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +6 -5
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.d.ts +84 -0
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +330 -0
- package/dist/browser/modules/excel/xlsx/xform/book/external-reference-xform.d.ts +17 -0
- package/dist/browser/modules/excel/xlsx/xform/book/external-reference-xform.js +24 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.d.ts +3 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-protection-xform.d.ts +20 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-protection-xform.js +66 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +19 -1
- package/dist/browser/modules/excel/xlsx/xform/core/metadata-xform.d.ts +56 -0
- package/dist/browser/modules/excel/xlsx/xform/core/metadata-xform.js +158 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.d.ts +26 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +105 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.d.ts +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
- package/dist/browser/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/ignored-errors-xform.d.ts +21 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +80 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
- package/dist/browser/modules/excel/xlsx/xform/style/border-xform.js +4 -1
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +172 -13
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +410 -20
- package/dist/browser/modules/excel/xlsx/xlsx.d.ts +7 -4
- package/dist/browser/modules/excel/xlsx/xlsx.js +4 -5
- package/dist/browser/modules/formula/compile/address-utils.d.ts +62 -0
- package/dist/browser/modules/formula/compile/address-utils.js +83 -0
- package/dist/browser/modules/formula/compile/binder.d.ts +42 -0
- package/dist/browser/modules/formula/compile/binder.js +487 -0
- package/dist/browser/modules/formula/compile/bound-ast.d.ts +230 -0
- package/dist/browser/modules/formula/compile/bound-ast.js +80 -0
- package/dist/browser/modules/formula/compile/compiled-formula.d.ts +137 -0
- package/dist/browser/modules/formula/compile/compiled-formula.js +383 -0
- package/dist/browser/modules/formula/compile/dependency-analysis.d.ts +93 -0
- package/dist/browser/modules/formula/compile/dependency-analysis.js +432 -0
- package/dist/browser/modules/formula/compile/structured-ref-utils.d.ts +93 -0
- package/dist/browser/modules/formula/compile/structured-ref-utils.js +136 -0
- package/dist/browser/modules/formula/default-syntax-probe.d.ts +79 -0
- package/dist/browser/modules/formula/default-syntax-probe.js +83 -0
- package/dist/browser/modules/formula/functions/_date-context.d.ts +4 -0
- package/dist/browser/modules/formula/functions/_date-context.js +29 -0
- package/dist/browser/modules/formula/functions/_shared.d.ts +121 -0
- package/dist/browser/modules/formula/functions/_shared.js +381 -0
- package/dist/browser/modules/formula/functions/conditional.d.ts +27 -0
- package/dist/browser/modules/formula/functions/conditional.js +343 -0
- package/dist/browser/modules/formula/functions/database.d.ts +37 -0
- package/dist/browser/modules/formula/functions/database.js +274 -0
- package/dist/browser/modules/formula/functions/date.d.ts +61 -0
- package/dist/browser/modules/formula/functions/date.js +855 -0
- package/dist/browser/modules/formula/functions/dynamic-array.d.ts +23 -0
- package/dist/browser/modules/formula/functions/dynamic-array.js +860 -0
- package/dist/browser/modules/formula/functions/engineering.d.ts +57 -0
- package/dist/browser/modules/formula/functions/engineering.js +1128 -0
- package/dist/browser/modules/formula/functions/financial.d.ts +202 -0
- package/dist/browser/modules/formula/functions/financial.js +2296 -0
- package/dist/browser/modules/formula/functions/lookup.d.ts +18 -0
- package/dist/browser/modules/formula/functions/lookup.js +886 -0
- package/dist/browser/modules/formula/functions/math.d.ts +114 -0
- package/dist/browser/modules/formula/functions/math.js +1406 -0
- package/dist/browser/modules/formula/functions/statistical.d.ts +193 -0
- package/dist/browser/modules/formula/functions/statistical.js +3390 -0
- package/dist/browser/modules/formula/functions/text.d.ts +86 -0
- package/dist/browser/modules/formula/functions/text.js +1845 -0
- package/dist/browser/modules/formula/host-registry.d.ts +53 -0
- package/dist/browser/modules/formula/host-registry.js +69 -0
- package/dist/browser/modules/formula/index.d.ts +39 -0
- package/dist/browser/modules/formula/index.js +49 -0
- package/dist/browser/modules/formula/install.d.ts +62 -0
- package/dist/browser/modules/formula/install.js +88 -0
- package/dist/browser/modules/formula/integration/apply-writeback-plan.d.ts +26 -0
- package/dist/browser/modules/formula/integration/apply-writeback-plan.js +210 -0
- package/dist/browser/modules/formula/integration/calculate-formulas-impl.d.ts +30 -0
- package/dist/browser/modules/formula/integration/calculate-formulas-impl.js +616 -0
- package/dist/browser/modules/formula/integration/calculate-formulas.d.ts +67 -0
- package/dist/browser/modules/formula/integration/calculate-formulas.js +68 -0
- package/dist/browser/modules/formula/integration/formula-instance.d.ts +64 -0
- package/dist/browser/modules/formula/integration/formula-instance.js +79 -0
- package/dist/browser/modules/formula/integration/workbook-adapter.d.ts +26 -0
- package/dist/browser/modules/formula/integration/workbook-adapter.js +324 -0
- package/dist/browser/modules/formula/integration/workbook-snapshot.d.ts +267 -0
- package/dist/browser/modules/formula/integration/workbook-snapshot.js +77 -0
- package/dist/browser/modules/formula/materialize/build-writeback-plan.d.ts +34 -0
- package/dist/browser/modules/formula/materialize/build-writeback-plan.js +473 -0
- package/dist/browser/modules/formula/materialize/spill-engine.d.ts +9 -0
- package/dist/browser/modules/formula/materialize/spill-engine.js +38 -0
- package/dist/browser/modules/formula/materialize/types.d.ts +179 -0
- package/dist/browser/modules/formula/materialize/types.js +29 -0
- package/dist/browser/modules/formula/materialize/writeback-plan.d.ts +167 -0
- package/dist/browser/modules/formula/materialize/writeback-plan.js +27 -0
- package/dist/browser/modules/formula/runtime/evaluator.d.ts +151 -0
- package/dist/browser/modules/formula/runtime/evaluator.js +2291 -0
- package/dist/browser/modules/formula/runtime/function-registry.d.ts +47 -0
- package/dist/browser/modules/formula/runtime/function-registry.js +840 -0
- package/dist/browser/modules/formula/runtime/values.d.ts +211 -0
- package/dist/browser/modules/formula/runtime/values.js +385 -0
- package/dist/browser/modules/formula/syntax/ast.d.ts +129 -0
- package/dist/browser/modules/formula/syntax/ast.js +28 -0
- package/dist/browser/modules/formula/syntax/parser.d.ts +18 -0
- package/dist/browser/modules/formula/syntax/parser.js +439 -0
- package/dist/browser/modules/formula/syntax/token-types.d.ts +153 -0
- package/dist/browser/modules/formula/syntax/token-types.js +59 -0
- package/dist/browser/modules/formula/syntax/tokenizer.d.ts +10 -0
- package/dist/browser/modules/formula/syntax/tokenizer.js +1074 -0
- package/dist/browser/modules/pdf/excel-bridge.js +9 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/modules/excel/cell.js +170 -22
- package/dist/cjs/modules/excel/defined-names.js +411 -21
- package/dist/cjs/modules/excel/image.js +24 -1
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +14 -0
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +48 -1
- package/dist/cjs/modules/excel/stream/worksheet-reader.js +17 -1
- package/dist/cjs/modules/excel/stream/worksheet-writer.js +45 -5
- package/dist/cjs/modules/excel/table.js +15 -2
- package/dist/cjs/modules/excel/utils/col-cache.js +15 -0
- package/dist/cjs/modules/excel/utils/drawing-utils.js +4 -0
- package/dist/cjs/modules/excel/utils/external-link-formula.js +212 -0
- package/dist/cjs/modules/excel/utils/iterate-stream.js +3 -1
- package/dist/cjs/modules/excel/utils/ooxml-paths.js +42 -2
- package/dist/cjs/modules/excel/utils/shared-strings.js +21 -2
- package/dist/cjs/modules/excel/utils/workbook-protection.js +33 -0
- package/dist/cjs/modules/excel/workbook.browser.js +318 -34
- package/dist/cjs/modules/excel/worksheet.js +20 -1
- package/dist/cjs/modules/excel/xlsx/rel-type.js +16 -1
- package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
- package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +333 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/external-reference-xform.js +27 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-protection-xform.js +69 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +18 -0
- package/dist/cjs/modules/excel/xlsx/xform/core/metadata-xform.js +161 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +108 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
- package/dist/cjs/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +83 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
- package/dist/cjs/modules/excel/xlsx/xform/style/border-xform.js +4 -1
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +408 -18
- package/dist/cjs/modules/excel/xlsx/xlsx.js +4 -5
- package/dist/cjs/modules/formula/compile/address-utils.js +89 -0
- package/dist/cjs/modules/formula/compile/binder.js +489 -0
- package/dist/cjs/modules/formula/compile/bound-ast.js +68 -0
- package/dist/cjs/modules/formula/compile/compiled-formula.js +387 -0
- package/dist/cjs/modules/formula/compile/dependency-analysis.js +437 -0
- package/dist/cjs/modules/formula/compile/structured-ref-utils.js +141 -0
- package/dist/cjs/modules/formula/default-syntax-probe.js +87 -0
- package/dist/cjs/modules/formula/functions/_date-context.js +33 -0
- package/dist/cjs/modules/formula/functions/_shared.js +396 -0
- package/dist/cjs/modules/formula/functions/conditional.js +354 -0
- package/dist/cjs/modules/formula/functions/database.js +288 -0
- package/dist/cjs/modules/formula/functions/date.js +883 -0
- package/dist/cjs/modules/formula/functions/dynamic-array.js +881 -0
- package/dist/cjs/modules/formula/functions/engineering.js +1183 -0
- package/dist/cjs/modules/formula/functions/financial.js +2348 -0
- package/dist/cjs/modules/formula/functions/lookup.js +902 -0
- package/dist/cjs/modules/formula/functions/math.js +1487 -0
- package/dist/cjs/modules/formula/functions/statistical.js +3488 -0
- package/dist/cjs/modules/formula/functions/text.js +1889 -0
- package/dist/cjs/modules/formula/host-registry.js +75 -0
- package/dist/cjs/modules/formula/index.js +58 -0
- package/dist/cjs/modules/formula/install.js +93 -0
- package/dist/cjs/modules/formula/integration/apply-writeback-plan.js +213 -0
- package/dist/cjs/modules/formula/integration/calculate-formulas-impl.js +619 -0
- package/dist/cjs/modules/formula/integration/calculate-formulas.js +71 -0
- package/dist/cjs/modules/formula/integration/formula-instance.js +82 -0
- package/dist/cjs/modules/formula/integration/workbook-adapter.js +327 -0
- package/dist/cjs/modules/formula/integration/workbook-snapshot.js +84 -0
- package/dist/cjs/modules/formula/materialize/build-writeback-plan.js +475 -0
- package/dist/cjs/modules/formula/materialize/spill-engine.js +42 -0
- package/dist/cjs/modules/formula/materialize/types.js +32 -0
- package/dist/cjs/modules/formula/materialize/writeback-plan.js +28 -0
- package/dist/cjs/modules/formula/runtime/evaluator.js +2298 -0
- package/dist/cjs/modules/formula/runtime/function-registry.js +846 -0
- package/dist/cjs/modules/formula/runtime/values.js +385 -0
- package/dist/cjs/modules/formula/syntax/ast.js +8 -0
- package/dist/cjs/modules/formula/syntax/parser.js +440 -0
- package/dist/cjs/modules/formula/syntax/token-types.js +32 -0
- package/dist/cjs/modules/formula/syntax/tokenizer.js +1076 -0
- package/dist/cjs/modules/pdf/excel-bridge.js +9 -0
- package/dist/esm/index.browser.js +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/modules/excel/cell.js +170 -22
- package/dist/esm/modules/excel/defined-names.js +411 -21
- package/dist/esm/modules/excel/image.js +24 -1
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +14 -0
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +48 -1
- package/dist/esm/modules/excel/stream/worksheet-reader.js +17 -1
- package/dist/esm/modules/excel/stream/worksheet-writer.js +45 -5
- package/dist/esm/modules/excel/table.js +15 -2
- package/dist/esm/modules/excel/utils/col-cache.js +15 -0
- package/dist/esm/modules/excel/utils/drawing-utils.js +4 -0
- package/dist/esm/modules/excel/utils/external-link-formula.js +208 -0
- package/dist/esm/modules/excel/utils/iterate-stream.js +3 -1
- package/dist/esm/modules/excel/utils/ooxml-paths.js +37 -2
- package/dist/esm/modules/excel/utils/shared-strings.js +21 -2
- package/dist/esm/modules/excel/utils/workbook-protection.js +30 -0
- package/dist/esm/modules/excel/workbook.browser.js +318 -34
- package/dist/esm/modules/excel/worksheet.js +21 -2
- package/dist/esm/modules/excel/xlsx/rel-type.js +16 -1
- package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
- package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +330 -0
- package/dist/esm/modules/excel/xlsx/xform/book/external-reference-xform.js +24 -0
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-protection-xform.js +66 -0
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +19 -1
- package/dist/esm/modules/excel/xlsx/xform/core/metadata-xform.js +158 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +105 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
- package/dist/esm/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
- package/dist/esm/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +80 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
- package/dist/esm/modules/excel/xlsx/xform/style/border-xform.js +4 -1
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +410 -20
- package/dist/esm/modules/excel/xlsx/xlsx.js +4 -5
- package/dist/esm/modules/formula/compile/address-utils.js +83 -0
- package/dist/esm/modules/formula/compile/binder.js +487 -0
- package/dist/esm/modules/formula/compile/bound-ast.js +80 -0
- package/dist/esm/modules/formula/compile/compiled-formula.js +383 -0
- package/dist/esm/modules/formula/compile/dependency-analysis.js +432 -0
- package/dist/esm/modules/formula/compile/structured-ref-utils.js +136 -0
- package/dist/esm/modules/formula/default-syntax-probe.js +83 -0
- package/dist/esm/modules/formula/functions/_date-context.js +29 -0
- package/dist/esm/modules/formula/functions/_shared.js +381 -0
- package/dist/esm/modules/formula/functions/conditional.js +343 -0
- package/dist/esm/modules/formula/functions/database.js +274 -0
- package/dist/esm/modules/formula/functions/date.js +855 -0
- package/dist/esm/modules/formula/functions/dynamic-array.js +860 -0
- package/dist/esm/modules/formula/functions/engineering.js +1128 -0
- package/dist/esm/modules/formula/functions/financial.js +2296 -0
- package/dist/esm/modules/formula/functions/lookup.js +886 -0
- package/dist/esm/modules/formula/functions/math.js +1406 -0
- package/dist/esm/modules/formula/functions/statistical.js +3390 -0
- package/dist/esm/modules/formula/functions/text.js +1845 -0
- package/dist/esm/modules/formula/host-registry.js +69 -0
- package/dist/esm/modules/formula/index.js +49 -0
- package/dist/esm/modules/formula/install.js +88 -0
- package/dist/esm/modules/formula/integration/apply-writeback-plan.js +210 -0
- package/dist/esm/modules/formula/integration/calculate-formulas-impl.js +616 -0
- package/dist/esm/modules/formula/integration/calculate-formulas.js +68 -0
- package/dist/esm/modules/formula/integration/formula-instance.js +79 -0
- package/dist/esm/modules/formula/integration/workbook-adapter.js +324 -0
- package/dist/esm/modules/formula/integration/workbook-snapshot.js +77 -0
- package/dist/esm/modules/formula/materialize/build-writeback-plan.js +473 -0
- package/dist/esm/modules/formula/materialize/spill-engine.js +38 -0
- package/dist/esm/modules/formula/materialize/types.js +29 -0
- package/dist/esm/modules/formula/materialize/writeback-plan.js +27 -0
- package/dist/esm/modules/formula/runtime/evaluator.js +2291 -0
- package/dist/esm/modules/formula/runtime/function-registry.js +840 -0
- package/dist/esm/modules/formula/runtime/values.js +385 -0
- package/dist/esm/modules/formula/syntax/ast.js +28 -0
- package/dist/esm/modules/formula/syntax/parser.js +439 -0
- package/dist/esm/modules/formula/syntax/token-types.js +59 -0
- package/dist/esm/modules/formula/syntax/tokenizer.js +1074 -0
- package/dist/esm/modules/pdf/excel-bridge.js +9 -0
- package/dist/iife/excelts.iife.js +2302 -373
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +34 -34
- package/dist/types/index.browser.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/modules/excel/cell.d.ts +17 -3
- package/dist/types/modules/excel/defined-names.d.ts +96 -1
- package/dist/types/modules/excel/image.d.ts +11 -0
- package/dist/types/modules/excel/stream/workbook-reader.browser.d.ts +9 -3
- package/dist/types/modules/excel/stream/workbook-reader.d.ts +2 -1
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +39 -5
- package/dist/types/modules/excel/stream/workbook-writer.d.ts +3 -2
- package/dist/types/modules/excel/stream/worksheet-writer.d.ts +39 -6
- package/dist/types/modules/excel/types.d.ts +133 -2
- package/dist/types/modules/excel/utils/col-cache.d.ts +1 -0
- package/dist/types/modules/excel/utils/drawing-utils.d.ts +3 -3
- package/dist/types/modules/excel/utils/external-link-formula.d.ts +76 -0
- package/dist/types/modules/excel/utils/iterate-stream.d.ts +9 -3
- package/dist/types/modules/excel/utils/ooxml-paths.d.ts +19 -0
- package/dist/types/modules/excel/utils/shared-strings.d.ts +8 -3
- package/dist/types/modules/excel/utils/workbook-protection.d.ts +30 -0
- package/dist/types/modules/excel/workbook.browser.d.ts +257 -6
- package/dist/types/modules/excel/workbook.d.ts +1 -1
- package/dist/types/modules/excel/worksheet.d.ts +3 -1
- package/dist/types/modules/excel/xlsx/rel-type.d.ts +15 -0
- package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +6 -5
- package/dist/types/modules/excel/xlsx/xform/book/external-link-xform.d.ts +84 -0
- package/dist/types/modules/excel/xlsx/xform/book/external-reference-xform.d.ts +17 -0
- package/dist/types/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.d.ts +3 -0
- package/dist/types/modules/excel/xlsx/xform/book/workbook-protection-xform.d.ts +20 -0
- package/dist/types/modules/excel/xlsx/xform/core/metadata-xform.d.ts +56 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.d.ts +26 -0
- package/dist/types/modules/excel/xlsx/xform/sheet/cell-xform.d.ts +1 -1
- package/dist/types/modules/excel/xlsx/xform/sheet/ignored-errors-xform.d.ts +21 -0
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +172 -13
- package/dist/types/modules/excel/xlsx/xlsx.d.ts +7 -4
- package/dist/types/modules/formula/compile/address-utils.d.ts +62 -0
- package/dist/types/modules/formula/compile/binder.d.ts +42 -0
- package/dist/types/modules/formula/compile/bound-ast.d.ts +230 -0
- package/dist/types/modules/formula/compile/compiled-formula.d.ts +137 -0
- package/dist/types/modules/formula/compile/dependency-analysis.d.ts +93 -0
- package/dist/types/modules/formula/compile/structured-ref-utils.d.ts +93 -0
- package/dist/types/modules/formula/default-syntax-probe.d.ts +79 -0
- package/dist/types/modules/formula/functions/_date-context.d.ts +4 -0
- package/dist/types/modules/formula/functions/_shared.d.ts +121 -0
- package/dist/types/modules/formula/functions/conditional.d.ts +27 -0
- package/dist/types/modules/formula/functions/database.d.ts +37 -0
- package/dist/types/modules/formula/functions/date.d.ts +61 -0
- package/dist/types/modules/formula/functions/dynamic-array.d.ts +23 -0
- package/dist/types/modules/formula/functions/engineering.d.ts +57 -0
- package/dist/types/modules/formula/functions/financial.d.ts +202 -0
- package/dist/types/modules/formula/functions/lookup.d.ts +18 -0
- package/dist/types/modules/formula/functions/math.d.ts +114 -0
- package/dist/types/modules/formula/functions/statistical.d.ts +193 -0
- package/dist/types/modules/formula/functions/text.d.ts +86 -0
- package/dist/types/modules/formula/host-registry.d.ts +53 -0
- package/dist/types/modules/formula/index.d.ts +39 -0
- package/dist/types/modules/formula/install.d.ts +62 -0
- package/dist/types/modules/formula/integration/apply-writeback-plan.d.ts +26 -0
- package/dist/types/modules/formula/integration/calculate-formulas-impl.d.ts +30 -0
- package/dist/types/modules/formula/integration/calculate-formulas.d.ts +67 -0
- package/dist/types/modules/formula/integration/formula-instance.d.ts +64 -0
- package/dist/types/modules/formula/integration/workbook-adapter.d.ts +26 -0
- package/dist/types/modules/formula/integration/workbook-snapshot.d.ts +267 -0
- package/dist/types/modules/formula/materialize/build-writeback-plan.d.ts +34 -0
- package/dist/types/modules/formula/materialize/spill-engine.d.ts +9 -0
- package/dist/types/modules/formula/materialize/types.d.ts +179 -0
- package/dist/types/modules/formula/materialize/writeback-plan.d.ts +167 -0
- package/dist/types/modules/formula/runtime/evaluator.d.ts +151 -0
- package/dist/types/modules/formula/runtime/function-registry.d.ts +47 -0
- package/dist/types/modules/formula/runtime/values.d.ts +211 -0
- package/dist/types/modules/formula/syntax/ast.d.ts +129 -0
- package/dist/types/modules/formula/syntax/parser.d.ts +18 -0
- package/dist/types/modules/formula/syntax/token-types.d.ts +153 -0
- package/dist/types/modules/formula/syntax/tokenizer.d.ts +10 -0
- package/package.json +28 -28
|
@@ -14,9 +14,10 @@ import { DefinedNames, type DefinedNameModel } from "./defined-names.js";
|
|
|
14
14
|
import type { PivotTable } from "./pivot-table.js";
|
|
15
15
|
import { WorkbookReader, type WorkbookReaderOptions } from "./stream/workbook-reader.js";
|
|
16
16
|
import { WorkbookWriter, type WorkbookWriterOptions } from "./stream/workbook-writer.js";
|
|
17
|
-
import type { AddWorksheetOptions, CalculationProperties, ImageData, WorkbookProperties, WorkbookView, Buffer as ExcelBuffer } from "./types.js";
|
|
17
|
+
import type { AddWorksheetOptions, CalculationProperties, CellValue, Font, ImageData, WorkbookProperties, WorkbookProtection, WorkbookView, Buffer as ExcelBuffer } from "./types.js";
|
|
18
18
|
import { Worksheet, type WorksheetModel } from "./worksheet.js";
|
|
19
19
|
import { XLSX } from "./xlsx/xlsx.js";
|
|
20
|
+
import type { SyntaxProbe } from "../formula/default-syntax-probe.js";
|
|
20
21
|
import type { MarkdownOptions } from "../markdown/types.js";
|
|
21
22
|
import type { Readable } from "../stream/index.js";
|
|
22
23
|
import type { IReadable, IWritable } from "../stream/types.js";
|
|
@@ -38,6 +39,7 @@ export interface WorkbookModel {
|
|
|
38
39
|
created: Date;
|
|
39
40
|
modified: Date;
|
|
40
41
|
properties: Partial<WorkbookProperties>;
|
|
42
|
+
protection?: WorkbookProtectionModel;
|
|
41
43
|
worksheets: WorksheetModel[];
|
|
42
44
|
sheets?: WorksheetModel[];
|
|
43
45
|
definedNames: DefinedNameModel[];
|
|
@@ -56,14 +58,101 @@ export interface WorkbookModel {
|
|
|
56
58
|
media: WorkbookMedia[];
|
|
57
59
|
pivotTables: PivotTable[];
|
|
58
60
|
/** Loaded pivot tables from file - used during reconciliation */
|
|
59
|
-
loadedPivotTables?:
|
|
61
|
+
loadedPivotTables?: PivotTable[];
|
|
60
62
|
calcProperties: Partial<CalculationProperties>;
|
|
61
63
|
/** Passthrough files (charts, etc.) preserved for round-trip */
|
|
62
64
|
passthrough?: Record<string, Uint8Array>;
|
|
63
65
|
/** Raw drawing XML data for passthrough (when drawing contains chart references) */
|
|
64
66
|
rawDrawings?: Record<string, Uint8Array>;
|
|
65
67
|
/** Default font preserved from the original file for round-trip fidelity */
|
|
66
|
-
defaultFont?:
|
|
68
|
+
defaultFont?: Partial<Font>;
|
|
69
|
+
/**
|
|
70
|
+
* External workbook references in declaration order. Matches the on-disk
|
|
71
|
+
* `[N]Sheet!Ref` indexing (1-based). Empty or undefined when the workbook
|
|
72
|
+
* has no external references.
|
|
73
|
+
*/
|
|
74
|
+
externalLinks?: ExternalLinkModel[];
|
|
75
|
+
}
|
|
76
|
+
/** Internal model for workbook-level protection (serialized to <workbookProtection>) */
|
|
77
|
+
export interface WorkbookProtectionModel {
|
|
78
|
+
lockStructure?: boolean;
|
|
79
|
+
lockWindows?: boolean;
|
|
80
|
+
lockRevision?: boolean;
|
|
81
|
+
workbookPassword?: string;
|
|
82
|
+
revisionsPassword?: string;
|
|
83
|
+
algorithmName?: string;
|
|
84
|
+
hashValue?: string;
|
|
85
|
+
saltValue?: string;
|
|
86
|
+
spinCount?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Cached values for a single sheet of an external workbook. Keys are the
|
|
90
|
+
* A1-notation cell addresses *in uppercase* (e.g. `"A1"`, `"B12"`). Values
|
|
91
|
+
* are the cached primitives Excel displays when the external file is not
|
|
92
|
+
* currently available — must be JSON primitives: string, number, boolean, or
|
|
93
|
+
* null for an explicitly blank cell.
|
|
94
|
+
*/
|
|
95
|
+
export type ExternalLinkCachedSheet = Record<string, string | number | boolean | null>;
|
|
96
|
+
/**
|
|
97
|
+
* A single external workbook reference. Each entry corresponds to one
|
|
98
|
+
* `xl/externalLinks/externalLink{N}.xml` part in the output file, and to
|
|
99
|
+
* one `<externalReference r:id="...">` entry in `xl/workbook.xml`.
|
|
100
|
+
*
|
|
101
|
+
* The on-disk formula syntax for referring to this workbook is `[N]Sheet!A1`
|
|
102
|
+
* where `N` is the 1-based `index` below.
|
|
103
|
+
*/
|
|
104
|
+
export interface ExternalLinkModel {
|
|
105
|
+
/**
|
|
106
|
+
* The 1-based index used in `[N]Sheet!A1` formulas. This is the position
|
|
107
|
+
* in the workbook's `<externalReferences>` list (in declaration order).
|
|
108
|
+
* Assigned automatically on read/write; treat as read-only when produced
|
|
109
|
+
* by the library.
|
|
110
|
+
*/
|
|
111
|
+
index: number;
|
|
112
|
+
/**
|
|
113
|
+
* The rel Target that will be written into
|
|
114
|
+
* `xl/externalLinks/_rels/externalLink{N}.xml.rels`. For relative paths
|
|
115
|
+
* (which is what users almost always want), pass the bare filename or a
|
|
116
|
+
* path relative to the current workbook: `"测试.xlsx"`, `"data/ref.xlsx"`.
|
|
117
|
+
* Office resolves bare relative paths from the current workbook's
|
|
118
|
+
* directory — *that* is the fix for the "Office goes to the Documents
|
|
119
|
+
* folder" problem described in exceljs#3039.
|
|
120
|
+
*
|
|
121
|
+
* Absolute `file:///` or `http(s)://` URIs are accepted and written
|
|
122
|
+
* through unchanged.
|
|
123
|
+
*/
|
|
124
|
+
target: string;
|
|
125
|
+
/**
|
|
126
|
+
* Almost always `"External"`. `"Internal"` is for embedded workbooks
|
|
127
|
+
* (rare) and is preserved on round-trip when present in the source file.
|
|
128
|
+
*/
|
|
129
|
+
targetMode: "External" | "Internal";
|
|
130
|
+
/**
|
|
131
|
+
* The relationship id inside `xl/_rels/workbook.xml.rels` pointing to this
|
|
132
|
+
* external link's XML part. Populated automatically on read and
|
|
133
|
+
* re-assigned on write. Callers should leave this undefined.
|
|
134
|
+
*/
|
|
135
|
+
rId?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The sheet names exposed by the external workbook, in declaration order.
|
|
138
|
+
* Excel writes one `<sheetName val="..."/>` per entry under
|
|
139
|
+
* `<sheetNames>` inside the externalLink part.
|
|
140
|
+
*
|
|
141
|
+
* At minimum you must declare every sheet that appears in a formula
|
|
142
|
+
* targeting this external workbook, otherwise Excel will fail to link
|
|
143
|
+
* the cached values and show `#REF!`.
|
|
144
|
+
*/
|
|
145
|
+
sheetNames: string[];
|
|
146
|
+
/**
|
|
147
|
+
* Cached primitive values per sheet. Key is the *sheet name* (matching an
|
|
148
|
+
* entry in `sheetNames`), value is a map from A1 address to primitive.
|
|
149
|
+
*
|
|
150
|
+
* Cached values are what Excel displays when the referenced external file
|
|
151
|
+
* is not available (e.g. freshly-downloaded workbook on another machine).
|
|
152
|
+
* Writing them turns your file from "opens with errors" into "opens,
|
|
153
|
+
* shows values, offers to update links".
|
|
154
|
+
*/
|
|
155
|
+
cachedValues?: Record<string, ExternalLinkCachedSheet>;
|
|
67
156
|
}
|
|
68
157
|
/**
|
|
69
158
|
* Supported input types for CSV parsing
|
|
@@ -94,7 +183,19 @@ interface CsvOptionsExtras {
|
|
|
94
183
|
dateFormats?: readonly DateFormat[];
|
|
95
184
|
dateFormat?: string;
|
|
96
185
|
dateUTC?: boolean;
|
|
97
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Transform each cell value as rows are parsed from CSV or formatted for
|
|
188
|
+
* CSV output.
|
|
189
|
+
*
|
|
190
|
+
* - During parse: `value` is the raw JS value produced by the CSV parser
|
|
191
|
+
* (string, number, boolean, Date, ...) and already narrows to `CellValue`.
|
|
192
|
+
* - During format: `value` is the worksheet cell's `CellValue`.
|
|
193
|
+
*
|
|
194
|
+
* The function should return a `CellValue`; returning non-`CellValue`
|
|
195
|
+
* types (functions, symbols, ...) is unsupported and will break downstream
|
|
196
|
+
* serialization.
|
|
197
|
+
*/
|
|
198
|
+
map?(value: CellValue, index: number): CellValue;
|
|
98
199
|
includeEmptyRows?: boolean;
|
|
99
200
|
requestHeaders?: Record<string, string>;
|
|
100
201
|
requestBody?: BodyInit;
|
|
@@ -145,6 +246,17 @@ declare class Workbook {
|
|
|
145
246
|
views: WorkbookView[];
|
|
146
247
|
media: WorkbookMedia[];
|
|
147
248
|
pivotTables: PivotTable[];
|
|
249
|
+
protection?: WorkbookProtectionModel;
|
|
250
|
+
/**
|
|
251
|
+
* External workbook references, in declaration order. The 1-based index
|
|
252
|
+
* of each entry matches the `[N]` prefix used inside formula strings
|
|
253
|
+
* (e.g. the first entry is referenced as `[1]Sheet1!A1` on disk).
|
|
254
|
+
*
|
|
255
|
+
* Prefer {@link addExternalLink} for appending — it handles index
|
|
256
|
+
* assignment and sheet-name deduplication. Direct mutation of this array
|
|
257
|
+
* is supported but callers must keep indices contiguous starting at 1.
|
|
258
|
+
*/
|
|
259
|
+
externalLinks: ExternalLinkModel[];
|
|
148
260
|
protected _worksheets: Worksheet[];
|
|
149
261
|
protected _definedNames: DefinedNames;
|
|
150
262
|
protected _themes?: unknown;
|
|
@@ -153,9 +265,50 @@ declare class Workbook {
|
|
|
153
265
|
/** Raw drawing XML data for passthrough (when drawing contains chart references) */
|
|
154
266
|
protected _rawDrawings: Record<string, Uint8Array>;
|
|
155
267
|
/** Default font preserved from original file for round-trip fidelity */
|
|
156
|
-
protected _defaultFont?:
|
|
268
|
+
protected _defaultFont?: Partial<Font>;
|
|
269
|
+
/**
|
|
270
|
+
* Cache of external-workbook references auto-discovered from formula
|
|
271
|
+
* strings during previous `writeBuffer()` calls. This is an internal
|
|
272
|
+
* stash used to keep subsequent writes fixed-point stable: once a
|
|
273
|
+
* formula has been normalised to `[N]Sheet!A1`, the writer needs the
|
|
274
|
+
* corresponding link metadata on the next write too, but we don't want
|
|
275
|
+
* those auto-discovered entries to appear on the user-facing
|
|
276
|
+
* `externalLinks` list. Indexed by lower-cased target path.
|
|
277
|
+
*
|
|
278
|
+
* Entries explicitly added via `addExternalLink()` live on `externalLinks`
|
|
279
|
+
* instead — the writer combines both at serialisation time.
|
|
280
|
+
*/
|
|
281
|
+
protected _writerExternalLinkCache: Map<string, ExternalLinkModel>;
|
|
282
|
+
/** Global registry of table names (lowercase) for cross-worksheet uniqueness checks. */
|
|
283
|
+
readonly _tableNames: Set<string>;
|
|
157
284
|
private _xlsx?;
|
|
158
|
-
|
|
285
|
+
/**
|
|
286
|
+
* @param options Optional construction options.
|
|
287
|
+
* - `formulaSyntaxProbe`: An explicit tokenizer+parser probe used to
|
|
288
|
+
* classify defined-name text during XLSX load. Providing this makes
|
|
289
|
+
* classification deterministic for *this* workbook regardless of
|
|
290
|
+
* whether `installFormulaEngine()` has been called. Most callers
|
|
291
|
+
* don't need it — `installFormulaEngine()` registers a
|
|
292
|
+
* process-wide default probe that is picked up automatically.
|
|
293
|
+
*/
|
|
294
|
+
constructor(options?: {
|
|
295
|
+
formulaSyntaxProbe?: SyntaxProbe;
|
|
296
|
+
});
|
|
297
|
+
/**
|
|
298
|
+
* The default font for the workbook (fontId=0 / "Normal" style).
|
|
299
|
+
* Cells without explicit font styles will inherit this font in Excel.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```ts
|
|
303
|
+
* wb.defaultFont = { name: "Arial", size: 12 };
|
|
304
|
+
* ```
|
|
305
|
+
*
|
|
306
|
+
* When reading an existing XLSX file, this preserves the original default font
|
|
307
|
+
* for round-trip fidelity. Setting it on a new workbook changes the default
|
|
308
|
+
* from Calibri 11 to your chosen font.
|
|
309
|
+
*/
|
|
310
|
+
get defaultFont(): Partial<Font> | undefined;
|
|
311
|
+
set defaultFont(font: Partial<Font> | undefined);
|
|
159
312
|
/**
|
|
160
313
|
* Import a worksheet from another workbook (or a standalone worksheet).
|
|
161
314
|
* Deep-copies all worksheet properties via the model getter/setter, including
|
|
@@ -168,6 +321,18 @@ declare class Workbook {
|
|
|
168
321
|
* @returns The newly created worksheet
|
|
169
322
|
*/
|
|
170
323
|
importSheet(source: Worksheet, name?: string): Worksheet;
|
|
324
|
+
/**
|
|
325
|
+
* Protect the workbook structure with an optional password.
|
|
326
|
+
* Prevents users from adding, deleting, renaming, moving, or copying worksheets.
|
|
327
|
+
*
|
|
328
|
+
* @param password - Optional password to protect the structure
|
|
329
|
+
* @param options - Optional protection flags (lockStructure, lockWindows, lockRevision)
|
|
330
|
+
*/
|
|
331
|
+
protect(password?: string, options?: Partial<WorkbookProtection>): Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* Remove workbook structure protection.
|
|
334
|
+
*/
|
|
335
|
+
unprotect(): void;
|
|
171
336
|
/**
|
|
172
337
|
* xlsx file format operations
|
|
173
338
|
* Node.js: readFile, writeFile, read (stream), write (stream), load (buffer), writeBuffer
|
|
@@ -399,12 +564,98 @@ declare class Workbook {
|
|
|
399
564
|
*/
|
|
400
565
|
eachSheet(callback: (sheet: Worksheet, id: number) => void): void;
|
|
401
566
|
get definedNames(): DefinedNames;
|
|
567
|
+
/**
|
|
568
|
+
* Recalculate all formula cells in this workbook.
|
|
569
|
+
*
|
|
570
|
+
* Evaluates every formula cell using the built-in calculation engine and updates
|
|
571
|
+
* each cell's cached `result` value in-place. Formulas are evaluated with
|
|
572
|
+
* recursive dependency resolution, memoization, and circular reference detection.
|
|
573
|
+
*
|
|
574
|
+
* Call this after programmatically modifying cell values that are referenced by
|
|
575
|
+
* formulas, to ensure formula results reflect the latest data.
|
|
576
|
+
*
|
|
577
|
+
* Unsupported functions preserve their original cached result if one exists.
|
|
578
|
+
*
|
|
579
|
+
* ## Tree-shaking note
|
|
580
|
+
*
|
|
581
|
+
* The formula engine ships ~200KB of code (433 Excel functions, parser,
|
|
582
|
+
* evaluator, dependency graph, spill materialiser). To keep it out of
|
|
583
|
+
* bundles that don't need it, the engine is registered at runtime
|
|
584
|
+
* rather than imported by the core `Workbook` module. Call
|
|
585
|
+
* {@link installFormulaEngine} once at startup before the first call
|
|
586
|
+
* to this method, or a clear error will be thrown explaining what to do.
|
|
587
|
+
*
|
|
588
|
+
* ```ts
|
|
589
|
+
* import { installFormulaEngine } from "@cj-tech-master/excelts/formula";
|
|
590
|
+
*
|
|
591
|
+
* installFormulaEngine(); // once, at startup
|
|
592
|
+
*
|
|
593
|
+
* sheet.getCell("A1").value = 100;
|
|
594
|
+
* workbook.calculateFormulas(); // now works
|
|
595
|
+
* ```
|
|
596
|
+
*
|
|
597
|
+
* Callers who prefer a zero-side-effect, tree-shakeable surface can
|
|
598
|
+
* use the functional equivalent directly:
|
|
599
|
+
*
|
|
600
|
+
* ```ts
|
|
601
|
+
* import { calculateFormulas } from "@cj-tech-master/excelts/formula";
|
|
602
|
+
* calculateFormulas(workbook);
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
calculateFormulas(): void;
|
|
402
606
|
clearThemes(): void;
|
|
403
607
|
/**
|
|
404
608
|
* Add Image to Workbook and return the id
|
|
405
609
|
*/
|
|
406
610
|
addImage(image: ImageData): number;
|
|
407
611
|
getImage(id: number | string): WorkbookMedia | undefined;
|
|
612
|
+
/**
|
|
613
|
+
* Declare that formulas in this workbook may reference an external
|
|
614
|
+
* workbook. Registers the target so the output file contains the required
|
|
615
|
+
* `xl/externalLinks/externalLink{N}.xml` part plus its `.rels` sibling
|
|
616
|
+
* and Office/WPS can resolve the reference correctly.
|
|
617
|
+
*
|
|
618
|
+
* When Office opens the file, it resolves a relative `target` like
|
|
619
|
+
* `"测试.xlsx"` **relative to the current workbook's directory** — which
|
|
620
|
+
* is the exact behaviour the user expects when they write
|
|
621
|
+
* `=[测试.xlsx]Sheet1!A1`. Absolute `file:///…` or `http(s)://…` URIs
|
|
622
|
+
* are accepted and written through unchanged.
|
|
623
|
+
*
|
|
624
|
+
* @returns the registered {@link ExternalLinkModel}. Its `index` field is
|
|
625
|
+
* the 1-based number used inside the `[N]` prefix of on-disk formula
|
|
626
|
+
* strings (the library rewrites `[target]` forms to `[index]` at write
|
|
627
|
+
* time automatically).
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
* ```ts
|
|
631
|
+
* const wb = new Workbook();
|
|
632
|
+
* const ws = wb.addWorksheet("Main");
|
|
633
|
+
*
|
|
634
|
+
* // Declare the link once — sheet names and cached values are optional
|
|
635
|
+
* // but improve interoperability (Excel displays cached values when the
|
|
636
|
+
* // external file is unavailable).
|
|
637
|
+
* wb.addExternalLink({
|
|
638
|
+
* target: "测试.xlsx",
|
|
639
|
+
* sheetNames: ["Sheet1"],
|
|
640
|
+
* cachedValues: { Sheet1: { A1: 42 } }
|
|
641
|
+
* });
|
|
642
|
+
*
|
|
643
|
+
* // Write the formula using either the target name OR the numeric index;
|
|
644
|
+
* // the library normalises both to the on-disk `[N]` form.
|
|
645
|
+
* ws.getCell("A1").value = { formula: "=[测试.xlsx]Sheet1!A1", result: 42 };
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
addExternalLink(input: {
|
|
649
|
+
target: string;
|
|
650
|
+
sheetNames?: string[];
|
|
651
|
+
cachedValues?: ExternalLinkModel["cachedValues"];
|
|
652
|
+
targetMode?: ExternalLinkModel["targetMode"];
|
|
653
|
+
}): ExternalLinkModel;
|
|
654
|
+
/**
|
|
655
|
+
* Retrieve an external link by its 1-based on-disk index (the number
|
|
656
|
+
* inside the `[N]` formula prefix) or by matching target path.
|
|
657
|
+
*/
|
|
658
|
+
getExternalLink(indexOrTarget: number | string): ExternalLinkModel | undefined;
|
|
408
659
|
get model(): WorkbookModel;
|
|
409
660
|
set model(value: WorkbookModel);
|
|
410
661
|
}
|
|
@@ -60,4 +60,4 @@ declare class Workbook extends WorkbookBrowser {
|
|
|
60
60
|
writeMarkdownFile(filename: string, options?: MarkdownOptions): Promise<void>;
|
|
61
61
|
}
|
|
62
62
|
export { Workbook };
|
|
63
|
-
export type { CsvOptions, CsvInput, WorkbookModel, WorkbookMedia } from "./workbook.browser.js";
|
|
63
|
+
export type { CsvOptions, CsvInput, WorkbookModel, WorkbookMedia, WorkbookProtectionModel, ExternalLinkModel, ExternalLinkCachedSheet } from "./workbook.browser.js";
|
|
@@ -7,7 +7,7 @@ import { type PivotTable, type PivotTableModel } from "./pivot-table.js";
|
|
|
7
7
|
import { Range, type RangeInput } from "./range.js";
|
|
8
8
|
import { Row, type RowModel } from "./row.js";
|
|
9
9
|
import { Table, type TableModel } from "./table.js";
|
|
10
|
-
import type { AddImageRange, AutoFilter, CellValue, ColBreak, ConditionalFormattingOptions, DataValidation, RowBreak, RowValues, TableProperties, WatermarkOptions, WorksheetProperties, WorksheetState, WorksheetView } from "./types.js";
|
|
10
|
+
import type { AddImageRange, AutoFilter, CellValue, ColBreak, ConditionalFormattingOptions, DataValidation, IgnoredError, RowBreak, RowValues, TableProperties, WatermarkOptions, WorksheetProperties, WorksheetState, WorksheetView } from "./types.js";
|
|
11
11
|
import { type Origin } from "./utils/address.js";
|
|
12
12
|
import type { Workbook } from "./workbook.js";
|
|
13
13
|
type DataValidationModel = {
|
|
@@ -108,6 +108,7 @@ interface WorksheetModel {
|
|
|
108
108
|
pivotTables: PivotTable[];
|
|
109
109
|
conditionalFormattings: ConditionalFormattingOptions[];
|
|
110
110
|
formControls: FormCheckboxModel[];
|
|
111
|
+
ignoredErrors: IgnoredError[];
|
|
111
112
|
watermark?: WatermarkOptions | null;
|
|
112
113
|
cols?: ColumnModel[];
|
|
113
114
|
rows?: RowModel[];
|
|
@@ -142,6 +143,7 @@ declare class Worksheet {
|
|
|
142
143
|
pivotTables: PivotTable[];
|
|
143
144
|
conditionalFormattings: ConditionalFormattingOptions[];
|
|
144
145
|
formControls: FormCheckbox[];
|
|
146
|
+
ignoredErrors: IgnoredError[];
|
|
145
147
|
private _headerRowCount?;
|
|
146
148
|
/** Loaded drawing data (for charts, etc.) - preserved for round-trip */
|
|
147
149
|
private _drawing;
|
|
@@ -17,5 +17,20 @@ declare const RelType: {
|
|
|
17
17
|
PivotTable: string;
|
|
18
18
|
FeaturePropertyBag: string;
|
|
19
19
|
CtrlProp: string;
|
|
20
|
+
SheetMetadata: string;
|
|
21
|
+
/**
|
|
22
|
+
* Relationship type for the externalLink part referenced from
|
|
23
|
+
* xl/_rels/workbook.xml.rels. Target is an internal path like
|
|
24
|
+
* `externalLinks/externalLink1.xml`.
|
|
25
|
+
*/
|
|
26
|
+
ExternalLink: string;
|
|
27
|
+
/**
|
|
28
|
+
* Relationship type used *inside* xl/externalLinks/_rels/externalLinkN.xml.rels
|
|
29
|
+
* to point at the actual external workbook. When `TargetMode="External"` and
|
|
30
|
+
* `Target` is a bare relative path (e.g. `"测试.xlsx"`), Office resolves it
|
|
31
|
+
* relative to the current workbook's directory — exactly the behaviour users
|
|
32
|
+
* expect from `=[测试.xlsx]Sheet1!A1`.
|
|
33
|
+
*/
|
|
34
|
+
ExternalLinkPath: string;
|
|
20
35
|
};
|
|
21
36
|
export { RelType };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import type { DefinedNameModel } from "../../../defined-names.js";
|
|
1
2
|
import { BaseXform } from "../base-xform.js";
|
|
2
|
-
interface DefinedNameModel {
|
|
3
|
-
name: string;
|
|
4
|
-
ranges: string[];
|
|
5
|
-
localSheetId?: number;
|
|
6
|
-
}
|
|
7
3
|
declare class DefinedNamesXform extends BaseXform {
|
|
8
4
|
private _parsedName?;
|
|
9
5
|
private _parsedLocalSheetId?;
|
|
@@ -12,6 +8,11 @@ declare class DefinedNamesXform extends BaseXform {
|
|
|
12
8
|
render(xmlStream: any, model: DefinedNameModel): void;
|
|
13
9
|
parseOpen(node: any): boolean;
|
|
14
10
|
parseText(text: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Stage 1 of the two-phase defined name design: the XLSX layer only
|
|
13
|
+
* preserves the raw XML text. Semantic classification (reference vs
|
|
14
|
+
* formula vs opaque) is deferred to `DefinedNames.set model()`.
|
|
15
|
+
*/
|
|
15
16
|
parseClose(): boolean;
|
|
16
17
|
}
|
|
17
18
|
export { DefinedNamesXform };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExternalLinkXform — read and write `xl/externalLinks/externalLinkN.xml`.
|
|
3
|
+
*
|
|
4
|
+
* This part describes one external workbook referenced by the current file:
|
|
5
|
+
* the list of sheets inside the foreign workbook, plus an optional cache of
|
|
6
|
+
* the primitive values at each referenced address. The `r:id` attribute on
|
|
7
|
+
* `<externalBook>` points (via the neighbouring `_rels/externalLinkN.xml.rels`)
|
|
8
|
+
* at the actual file; that resolution is handled by the writer/reader in
|
|
9
|
+
* `xlsx.browser.ts`, not here.
|
|
10
|
+
*
|
|
11
|
+
* Schema shape:
|
|
12
|
+
*
|
|
13
|
+
* <externalLink xmlns=".../spreadsheetml/2006/main"
|
|
14
|
+
* xmlns:r=".../relationships">
|
|
15
|
+
* <externalBook r:id="rId1">
|
|
16
|
+
* <sheetNames>
|
|
17
|
+
* <sheetName val="Sheet1"/>
|
|
18
|
+
* <sheetName val="Sheet2"/>
|
|
19
|
+
* </sheetNames>
|
|
20
|
+
* <sheetDataSet>
|
|
21
|
+
* <sheetData sheetId="0"> (0-based index into sheetNames)
|
|
22
|
+
* <row r="1">
|
|
23
|
+
* <cell r="A1" t="n"><v>123</v></cell>
|
|
24
|
+
* <cell r="B1" t="str"><v>hello</v></cell>
|
|
25
|
+
* </row>
|
|
26
|
+
* <row r="2">
|
|
27
|
+
* <cell r="A2" t="b"><v>1</v></cell>
|
|
28
|
+
* </row>
|
|
29
|
+
* </sheetData>
|
|
30
|
+
* <sheetData sheetId="1" refreshError="1"/> (no cached values)
|
|
31
|
+
* </sheetDataSet>
|
|
32
|
+
* </externalBook>
|
|
33
|
+
* </externalLink>
|
|
34
|
+
*
|
|
35
|
+
* The `t` attribute on `<cell>` mirrors the inline-value types used inside a
|
|
36
|
+
* worksheet's `<c>` element: "n" (number, default), "str" (string), "b"
|
|
37
|
+
* (boolean), "e" (error). We don't emit shared-string indices here because
|
|
38
|
+
* the externalLink part is self-contained — each cached string is serialised
|
|
39
|
+
* inline as plain text inside `<v>`.
|
|
40
|
+
*
|
|
41
|
+
* Parser state machine:
|
|
42
|
+
* externalLink → externalBook → sheetNames → sheetName (stores names in order)
|
|
43
|
+
* \→ sheetDataSet → sheetData → row → cell → v (values)
|
|
44
|
+
*
|
|
45
|
+
* The parser tolerates missing cache data (Excel's `refreshError="1"` mode);
|
|
46
|
+
* sheets without a matching `<sheetData>` simply have no entry in
|
|
47
|
+
* `cachedValues`.
|
|
48
|
+
*/
|
|
49
|
+
import type { ExternalLinkCachedSheet, ExternalLinkModel } from "../../../workbook.browser.js";
|
|
50
|
+
import { BaseXform } from "../base-xform.js";
|
|
51
|
+
import type { XmlSink } from "../../../../xml/types.js";
|
|
52
|
+
/**
|
|
53
|
+
* Parsed shape of a single externalLinkN.xml part. Callers (xlsx.browser.ts)
|
|
54
|
+
* merge `rId` with the matching `workbookRels` entry to recover the model's
|
|
55
|
+
* `target` / `targetMode`, since those live in the sibling `.rels` file.
|
|
56
|
+
*/
|
|
57
|
+
export interface ParsedExternalLink {
|
|
58
|
+
/** r:id on <externalBook>. Points at the rel inside externalLinkN.xml.rels. */
|
|
59
|
+
externalBookRId: string;
|
|
60
|
+
sheetNames: string[];
|
|
61
|
+
cachedValues: Record<string, ExternalLinkCachedSheet>;
|
|
62
|
+
}
|
|
63
|
+
declare class ExternalLinkXform extends BaseXform<ParsedExternalLink> {
|
|
64
|
+
/** Sheet name indexed by sheetId (0-based) — filled during parse. */
|
|
65
|
+
private sheetNamesByIndex;
|
|
66
|
+
/** Current sheet's accumulated cached cells. */
|
|
67
|
+
private currentSheetCells;
|
|
68
|
+
/** Current sheet's name (looked up from sheetId). */
|
|
69
|
+
private currentSheetName;
|
|
70
|
+
/** Current cell being parsed: address + type. */
|
|
71
|
+
private currentCellAddress;
|
|
72
|
+
private currentCellType;
|
|
73
|
+
/** Accumulated text content of the current <v> element. */
|
|
74
|
+
private currentCellValue;
|
|
75
|
+
/** Which element we're currently inside. */
|
|
76
|
+
private inV;
|
|
77
|
+
get tag(): string;
|
|
78
|
+
reset(): void;
|
|
79
|
+
render(xmlStream: XmlSink, model: ExternalLinkModel): void;
|
|
80
|
+
parseOpen(node: any): boolean;
|
|
81
|
+
parseText(text: string): void;
|
|
82
|
+
parseClose(name: string): boolean;
|
|
83
|
+
}
|
|
84
|
+
export { ExternalLinkXform };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xform for a single `<externalReference r:id="..."/>` element inside
|
|
3
|
+
* `<externalReferences>` in `xl/workbook.xml`. Each `<externalReference>`
|
|
4
|
+
* maps positionally (in document order, 1-based) to an `[N]Sheet!Ref`
|
|
5
|
+
* prefix in formula strings.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseXform } from "../base-xform.js";
|
|
8
|
+
export interface ExternalReferenceModel {
|
|
9
|
+
rId: string;
|
|
10
|
+
}
|
|
11
|
+
declare class ExternalReferenceXform extends BaseXform<ExternalReferenceModel> {
|
|
12
|
+
render(xmlStream: any, model: ExternalReferenceModel): void;
|
|
13
|
+
parseOpen(node: any): boolean;
|
|
14
|
+
parseText(): void;
|
|
15
|
+
parseClose(): boolean;
|
|
16
|
+
}
|
|
17
|
+
export { ExternalReferenceXform };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BaseXform } from "../base-xform.js";
|
|
2
2
|
interface CalcPropertiesModel {
|
|
3
3
|
fullCalcOnLoad?: boolean;
|
|
4
|
+
iterate?: boolean;
|
|
5
|
+
iterateCount?: number;
|
|
6
|
+
iterateDelta?: number;
|
|
4
7
|
}
|
|
5
8
|
declare class WorkbookCalcPropertiesXform extends BaseXform {
|
|
6
9
|
render(xmlStream: any, model: CalcPropertiesModel): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
interface WorkbookProtectionModel {
|
|
3
|
+
lockStructure?: boolean;
|
|
4
|
+
lockWindows?: boolean;
|
|
5
|
+
lockRevision?: boolean;
|
|
6
|
+
workbookPassword?: string;
|
|
7
|
+
revisionsPassword?: string;
|
|
8
|
+
algorithmName?: string;
|
|
9
|
+
hashValue?: string;
|
|
10
|
+
saltValue?: string;
|
|
11
|
+
spinCount?: number;
|
|
12
|
+
}
|
|
13
|
+
declare class WorkbookProtectionXform extends BaseXform {
|
|
14
|
+
get tag(): string;
|
|
15
|
+
render(xmlStream: any, model?: WorkbookProtectionModel): void;
|
|
16
|
+
parseOpen(node: any): boolean;
|
|
17
|
+
parseText(): void;
|
|
18
|
+
parseClose(): boolean;
|
|
19
|
+
}
|
|
20
|
+
export { WorkbookProtectionXform };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
/**
|
|
3
|
+
* Internal model for xl/metadata.xml.
|
|
4
|
+
*
|
|
5
|
+
* The metadata file supports various metadata types via futureMetadata blocks.
|
|
6
|
+
* For dynamic array formulas, the only type we care about is "XLDAPR" (Excel
|
|
7
|
+
* Dynamic Array PRoperties). The structure is:
|
|
8
|
+
*
|
|
9
|
+
* metadataTypes: declares which metadata types exist (always XLDAPR for DA)
|
|
10
|
+
* futureMetadata: per-type blocks with ext data (dynamicArrayProperties)
|
|
11
|
+
* cellMetadata: maps cm indices (1-indexed on <c>) to futureMetadata entries
|
|
12
|
+
*
|
|
13
|
+
* For simplicity, all dynamic array formulas share a single XLDAPR futureMetadata
|
|
14
|
+
* block with fDynamic="1" fCollapsed="0", and a single cellMetadata record
|
|
15
|
+
* pointing to it. Every dynamic array cell gets cm="1".
|
|
16
|
+
*/
|
|
17
|
+
interface MetadataModel {
|
|
18
|
+
/** Number of cells that reference dynamic array metadata */
|
|
19
|
+
dynamicArrayCount: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parsed result from xl/metadata.xml.
|
|
23
|
+
*
|
|
24
|
+
* `dynamicArrayCmIndices` is a set of cm values (1-indexed, matching the `cm`
|
|
25
|
+
* attribute on `<c>` elements) whose corresponding cellMetadata record points
|
|
26
|
+
* to an XLDAPR metadataType. This allows precise per-cell identification of
|
|
27
|
+
* dynamic array formulas without assuming all cm values are XLDAPR.
|
|
28
|
+
*
|
|
29
|
+
* `hasDynamicArrays` is a convenience shorthand: `dynamicArrayCmIndices.size > 0`.
|
|
30
|
+
*/
|
|
31
|
+
interface MetadataParseResult {
|
|
32
|
+
hasDynamicArrays: boolean;
|
|
33
|
+
dynamicArrayCmIndices: Set<number>;
|
|
34
|
+
}
|
|
35
|
+
declare class MetadataXform extends BaseXform {
|
|
36
|
+
/** metadataType names in declaration order (1-indexed in OOXML) */
|
|
37
|
+
private _metadataTypeNames;
|
|
38
|
+
/** Per cellMetadata bk: the rc.t value (metadataType index, 1-indexed) */
|
|
39
|
+
private _cellMetadataTypeRefs;
|
|
40
|
+
/** Whether we are currently inside <cellMetadata> */
|
|
41
|
+
private _inCellMetadata;
|
|
42
|
+
/** Current rc.t value being collected inside a <bk> */
|
|
43
|
+
private _currentRcType;
|
|
44
|
+
get tag(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Render xl/metadata.xml for the given model.
|
|
47
|
+
* Only emits content when dynamicArrayCount > 0.
|
|
48
|
+
*/
|
|
49
|
+
render(xmlStream: any, model: MetadataModel): void;
|
|
50
|
+
reset(): void;
|
|
51
|
+
parseOpen(node: any): boolean;
|
|
52
|
+
parseText(): void;
|
|
53
|
+
parseClose(name: string): boolean;
|
|
54
|
+
}
|
|
55
|
+
export { MetadataXform };
|
|
56
|
+
export type { MetadataModel, MetadataParseResult };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseCellAnchorXform } from "./base-cell-anchor-xform.js";
|
|
2
|
+
/**
|
|
3
|
+
* Xform for <xdr:absoluteAnchor> — images positioned by absolute coordinates
|
|
4
|
+
* rather than cell references.
|
|
5
|
+
*
|
|
6
|
+
* Structure:
|
|
7
|
+
* ```xml
|
|
8
|
+
* <xdr:absoluteAnchor>
|
|
9
|
+
* <xdr:pos x="0" y="0"/>
|
|
10
|
+
* <xdr:ext cx="1000000" cy="1000000"/>
|
|
11
|
+
* <xdr:pic>...</xdr:pic>
|
|
12
|
+
* <xdr:clientData/>
|
|
13
|
+
* </xdr:absoluteAnchor>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare class AbsoluteAnchorXform extends BaseCellAnchorXform {
|
|
17
|
+
constructor();
|
|
18
|
+
get tag(): string;
|
|
19
|
+
prepare(model: any, options: {
|
|
20
|
+
index: number;
|
|
21
|
+
}): void;
|
|
22
|
+
render(xmlStream: any, model: any): void;
|
|
23
|
+
parseClose(name: string): boolean;
|
|
24
|
+
reconcile(model: any, options: any): void;
|
|
25
|
+
}
|
|
26
|
+
export { AbsoluteAnchorXform };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IgnoredError } from "../../../types.js";
|
|
2
|
+
import { BaseXform } from "../base-xform.js";
|
|
3
|
+
/**
|
|
4
|
+
* Xform for the <ignoredErrors> element in a worksheet.
|
|
5
|
+
*
|
|
6
|
+
* Renders:
|
|
7
|
+
* ```xml
|
|
8
|
+
* <ignoredErrors>
|
|
9
|
+
* <ignoredError sqref="A1:B10" numberStoredAsText="1" />
|
|
10
|
+
* </ignoredErrors>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare class IgnoredErrorsXform extends BaseXform {
|
|
14
|
+
model: IgnoredError[];
|
|
15
|
+
get tag(): string;
|
|
16
|
+
render(xmlStream: any, model: IgnoredError[] | undefined): void;
|
|
17
|
+
parseOpen(node: any): boolean;
|
|
18
|
+
parseText(): void;
|
|
19
|
+
parseClose(name: string): boolean;
|
|
20
|
+
}
|
|
21
|
+
export { IgnoredErrorsXform };
|