@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
|
@@ -15,6 +15,7 @@ import { WorksheetReader } from "./worksheet-reader.js";
|
|
|
15
15
|
import { iterateStream } from "../utils/iterate-stream.js";
|
|
16
16
|
import { getWorksheetNoFromWorksheetPath, getWorksheetNoFromWorksheetRelsPath, normalizeZipPath, OOXML_PATHS, worksheetRelTarget } from "../utils/ooxml-paths.js";
|
|
17
17
|
import { WorkbookXform } from "../xlsx/xform/book/workbook-xform.js";
|
|
18
|
+
import { MetadataXform } from "../xlsx/xform/core/metadata-xform.js";
|
|
18
19
|
import { RelationshipsXform } from "../xlsx/xform/core/relationships-xform.js";
|
|
19
20
|
import { StylesXform } from "../xlsx/xform/style/styles-xform.js";
|
|
20
21
|
import { Readable } from "../../stream/index.browser.js";
|
|
@@ -36,6 +37,8 @@ export class WorkbookReaderBase extends EventEmitter {
|
|
|
36
37
|
}
|
|
37
38
|
constructor(input, options, WorksheetReaderClass, HyperlinkReaderClass) {
|
|
38
39
|
super();
|
|
40
|
+
/** Whether xl/metadata.xml contains XLDAPR dynamic array metadata */
|
|
41
|
+
this.hasDynamicArrayMetadata = false;
|
|
39
42
|
/** Running total of bytes buffered for waiting worksheets. */
|
|
40
43
|
this._totalBufferedBytes = 0;
|
|
41
44
|
this.input = input;
|
|
@@ -443,6 +446,14 @@ export class WorkbookReaderBase extends EventEmitter {
|
|
|
443
446
|
await this.styles.parseStream(iterateStream(entry));
|
|
444
447
|
}
|
|
445
448
|
}
|
|
449
|
+
async _parseMetadata(entry) {
|
|
450
|
+
const xform = new MetadataXform();
|
|
451
|
+
const result = await xform.parseStream(iterateStream(entry));
|
|
452
|
+
if (result) {
|
|
453
|
+
this.hasDynamicArrayMetadata = !!result.hasDynamicArrays;
|
|
454
|
+
this.dynamicArrayCmIndices = result.dynamicArrayCmIndices;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
446
457
|
*_parseWorksheet(iterator, sheetNo) {
|
|
447
458
|
this._emitEntry({ type: "worksheet", id: sheetNo });
|
|
448
459
|
const sheetNoNumber = parseInt(sheetNo, 10);
|
|
@@ -511,6 +522,9 @@ export class WorkbookReaderBase extends EventEmitter {
|
|
|
511
522
|
case OOXML_PATHS.xlStyles:
|
|
512
523
|
await this._parseStyles(entry);
|
|
513
524
|
break;
|
|
525
|
+
case OOXML_PATHS.xlMetadata:
|
|
526
|
+
await this._parseMetadata(entry);
|
|
527
|
+
break;
|
|
514
528
|
default:
|
|
515
529
|
sheetNo = getWorksheetNoFromWorksheetPath(normalizedPath)?.toString();
|
|
516
530
|
if (sheetNo) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extends base with file path support and temp file storage for large files.
|
|
5
5
|
*/
|
|
6
|
+
import type { ZipEntry } from "../../archive/unzip/stream.js";
|
|
6
7
|
import { HyperlinkReader } from "./hyperlink-reader.js";
|
|
7
8
|
import { WorkbookReaderBase, type CommonInput, type WorkbookReaderOptions, type WorksheetReadyEvent, WorkbookReaderOptionsSchema } from "./workbook-reader.browser.js";
|
|
8
9
|
import { WorksheetReader } from "./worksheet-reader.js";
|
|
@@ -18,7 +19,7 @@ interface WaitingWorksheet {
|
|
|
18
19
|
declare class WorkbookReader extends WorkbookReaderBase<NodeInput, WorksheetReader, HyperlinkReader, WaitingWorksheet> {
|
|
19
20
|
constructor(input: NodeInput, options?: WorkbookReaderOptions);
|
|
20
21
|
_getStream(input: NodeInput): Readable;
|
|
21
|
-
_storeWaitingWorksheet(sheetNo: string, entry:
|
|
22
|
+
_storeWaitingWorksheet(sheetNo: string, entry: ZipEntry): Promise<WaitingWorksheet>;
|
|
22
23
|
_processWaitingWorksheets(waitingWorksheets: WaitingWorksheet[]): AsyncIterableIterator<WorksheetReadyEvent<WorksheetReader>>;
|
|
23
24
|
}
|
|
24
25
|
export { WorkbookReader, WorkbookReaderOptionsSchema };
|
|
@@ -10,11 +10,17 @@
|
|
|
10
10
|
import { Zip } from "../../archive/zip/stream.js";
|
|
11
11
|
import { DefinedNames } from "../defined-names.js";
|
|
12
12
|
import { WorksheetWriter } from "./worksheet-writer.js";
|
|
13
|
-
import type { ImageData, WorkbookView, AddWorksheetOptions } from "../types.js";
|
|
13
|
+
import type { Font, ImageData, WorkbookView, WorkbookProtection, AddWorksheetOptions } from "../types.js";
|
|
14
14
|
import { SharedStrings } from "../utils/shared-strings.js";
|
|
15
15
|
import { StylesXform } from "../xlsx/xform/style/styles-xform.js";
|
|
16
16
|
import type { Writable } from "../../stream/index.js";
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* An image registered in the streaming writer.
|
|
19
|
+
*
|
|
20
|
+
* Extends the public {@link ImageData} shape with the unique stored name
|
|
21
|
+
* (`name`) assigned by `addImage`, and pins `type` to `"image"`.
|
|
22
|
+
*/
|
|
23
|
+
export interface Medium extends ImageData {
|
|
18
24
|
type: "image";
|
|
19
25
|
name: string;
|
|
20
26
|
}
|
|
@@ -56,8 +62,8 @@ export interface WorkbookWriterOptions {
|
|
|
56
62
|
trueStreaming?: boolean;
|
|
57
63
|
}
|
|
58
64
|
interface OutputStreamLike {
|
|
59
|
-
emit(eventName: string | symbol, ...args:
|
|
60
|
-
write(chunk:
|
|
65
|
+
emit(eventName: string | symbol, ...args: unknown[]): boolean;
|
|
66
|
+
write(chunk: Uint8Array | string): boolean | Promise<boolean>;
|
|
61
67
|
end(): void;
|
|
62
68
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
63
69
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -107,6 +113,18 @@ export declare abstract class WorkbookWriterBase<TWorksheetWriter extends Worksh
|
|
|
107
113
|
compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
108
114
|
media: Medium[];
|
|
109
115
|
commentRefs: CommentRef[];
|
|
116
|
+
/** Number of cells with dynamic array formulas, accumulated during worksheet commit */
|
|
117
|
+
dynamicArrayCount: number;
|
|
118
|
+
/** Workbook-level structure protection */
|
|
119
|
+
protection?: {
|
|
120
|
+
lockStructure?: boolean;
|
|
121
|
+
lockWindows?: boolean;
|
|
122
|
+
lockRevision?: boolean;
|
|
123
|
+
algorithmName?: string;
|
|
124
|
+
hashValue?: string;
|
|
125
|
+
saltValue?: string;
|
|
126
|
+
spinCount?: number;
|
|
127
|
+
};
|
|
110
128
|
zip: Zip;
|
|
111
129
|
stream: OutputStreamLike;
|
|
112
130
|
promise: Promise<void[] | void>;
|
|
@@ -118,12 +136,27 @@ export declare abstract class WorkbookWriterBase<TWorksheetWriter extends Worksh
|
|
|
118
136
|
*/
|
|
119
137
|
protected _createOutputStream(options: WorkbookWriterOptions): OutputStreamLike;
|
|
120
138
|
get definedNames(): DefinedNames;
|
|
139
|
+
/**
|
|
140
|
+
* The default font for the workbook (fontId=0 / "Normal" style).
|
|
141
|
+
* Must be set before any worksheet rows are committed.
|
|
142
|
+
*/
|
|
143
|
+
get defaultFont(): Partial<Font> | undefined;
|
|
144
|
+
set defaultFont(font: Partial<Font> | undefined);
|
|
121
145
|
protected _addFile(data: string | Uint8Array, name: string, base64?: boolean): void;
|
|
122
146
|
private _commitWorksheets;
|
|
123
147
|
commit(): Promise<void>;
|
|
124
148
|
get nextId(): number;
|
|
125
149
|
addImage(image: ImageData): number;
|
|
126
|
-
getImage(id: number):
|
|
150
|
+
getImage(id: number): Medium | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Protect the workbook structure with an optional password.
|
|
153
|
+
* Prevents users from adding, deleting, renaming, moving, or copying worksheets.
|
|
154
|
+
*/
|
|
155
|
+
protect(password?: string, options?: Partial<WorkbookProtection>): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Remove workbook structure protection.
|
|
158
|
+
*/
|
|
159
|
+
unprotect(): void;
|
|
127
160
|
addWorksheet(name?: string, options?: Partial<AddWorksheetOptions>): TWorksheetWriter;
|
|
128
161
|
getWorksheet(id?: string | number): TWorksheetWriter | undefined;
|
|
129
162
|
addStyles(): Promise<void>;
|
|
@@ -144,6 +177,7 @@ export declare abstract class WorkbookWriterBase<TWorksheetWriter extends Worksh
|
|
|
144
177
|
addCore(): Promise<void>;
|
|
145
178
|
addSharedStrings(): Promise<void>;
|
|
146
179
|
addFeaturePropertyBag(): Promise<void>;
|
|
180
|
+
addMetadata(): Promise<void>;
|
|
147
181
|
addWorkbookRels(): Promise<void>;
|
|
148
182
|
addWorkbook(): Promise<void>;
|
|
149
183
|
private _finalize;
|
|
@@ -15,12 +15,14 @@ import { filterDrawingAnchors } from "../utils/drawing-utils.js";
|
|
|
15
15
|
import { drawingPath, drawingRelsPath, mediaPath, OOXML_PATHS, OOXML_REL_TARGETS, worksheetRelTarget } from "../utils/ooxml-paths.js";
|
|
16
16
|
import { SharedStrings } from "../utils/shared-strings.js";
|
|
17
17
|
import { StreamBuf } from "../utils/stream-buf.js";
|
|
18
|
+
import { buildWorkbookProtection } from "../utils/workbook-protection.js";
|
|
18
19
|
import { RelType } from "../xlsx/rel-type.js";
|
|
19
20
|
import { WorkbookXform } from "../xlsx/xform/book/workbook-xform.js";
|
|
20
21
|
import { AppXform } from "../xlsx/xform/core/app-xform.js";
|
|
21
22
|
import { ContentTypesXform } from "../xlsx/xform/core/content-types-xform.js";
|
|
22
23
|
import { CoreXform } from "../xlsx/xform/core/core-xform.js";
|
|
23
24
|
import { FeaturePropertyBagXform } from "../xlsx/xform/core/feature-property-bag-xform.js";
|
|
25
|
+
import { MetadataXform } from "../xlsx/xform/core/metadata-xform.js";
|
|
24
26
|
import { RelationshipsXform } from "../xlsx/xform/core/relationships-xform.js";
|
|
25
27
|
import { DrawingXform } from "../xlsx/xform/drawing/drawing-xform.js";
|
|
26
28
|
import { SharedStringsXform } from "../xlsx/xform/strings/shared-strings-xform.js";
|
|
@@ -53,6 +55,7 @@ export class WorkbookWriterBase {
|
|
|
53
55
|
this.compressionLevel = Math.max(0, Math.min(9, level));
|
|
54
56
|
this.media = [];
|
|
55
57
|
this.commentRefs = [];
|
|
58
|
+
this.dynamicArrayCount = 0;
|
|
56
59
|
this._trueStreaming = options.trueStreaming ?? false;
|
|
57
60
|
// Create Zip instance
|
|
58
61
|
this.zip = new Zip((err, data, final) => {
|
|
@@ -87,6 +90,18 @@ export class WorkbookWriterBase {
|
|
|
87
90
|
get definedNames() {
|
|
88
91
|
return this._definedNames;
|
|
89
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* The default font for the workbook (fontId=0 / "Normal" style).
|
|
95
|
+
* Must be set before any worksheet rows are committed.
|
|
96
|
+
*/
|
|
97
|
+
get defaultFont() {
|
|
98
|
+
return this.styles.defaultFont;
|
|
99
|
+
}
|
|
100
|
+
set defaultFont(font) {
|
|
101
|
+
if (this.styles.setDefaultFont) {
|
|
102
|
+
this.styles.setDefaultFont(font);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
90
105
|
/** @internal */
|
|
91
106
|
_openStream(path) {
|
|
92
107
|
const stream = new StreamBuf({
|
|
@@ -147,6 +162,7 @@ export class WorkbookWriterBase {
|
|
|
147
162
|
this.addSharedStrings(),
|
|
148
163
|
this.addStyles(),
|
|
149
164
|
this.addFeaturePropertyBag(),
|
|
165
|
+
this.addMetadata(),
|
|
150
166
|
this.addWorkbookRels()
|
|
151
167
|
]);
|
|
152
168
|
await this.addWorkbook();
|
|
@@ -173,6 +189,19 @@ export class WorkbookWriterBase {
|
|
|
173
189
|
getImage(id) {
|
|
174
190
|
return this.media[id];
|
|
175
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Protect the workbook structure with an optional password.
|
|
194
|
+
* Prevents users from adding, deleting, renaming, moving, or copying worksheets.
|
|
195
|
+
*/
|
|
196
|
+
async protect(password, options) {
|
|
197
|
+
this.protection = await buildWorkbookProtection(password, options);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Remove workbook structure protection.
|
|
201
|
+
*/
|
|
202
|
+
unprotect() {
|
|
203
|
+
this.protection = undefined;
|
|
204
|
+
}
|
|
176
205
|
addWorksheet(name, options) {
|
|
177
206
|
const opts = options || {};
|
|
178
207
|
const useSharedStrings = opts.useSharedStrings !== undefined ? opts.useSharedStrings : this.useSharedStrings;
|
|
@@ -250,7 +279,8 @@ export class WorkbookWriterBase {
|
|
|
250
279
|
commentRefs: this.commentRefs,
|
|
251
280
|
media: this.media,
|
|
252
281
|
drawings,
|
|
253
|
-
hasCheckboxes: this.styles.hasCheckboxes
|
|
282
|
+
hasCheckboxes: this.styles.hasCheckboxes,
|
|
283
|
+
hasDynamicArrayFormulas: this.dynamicArrayCount > 0
|
|
254
284
|
};
|
|
255
285
|
const xform = new ContentTypesXform();
|
|
256
286
|
this._addFile(xform.toXml(model), OOXML_PATHS.contentTypes);
|
|
@@ -336,6 +366,14 @@ export class WorkbookWriterBase {
|
|
|
336
366
|
}
|
|
337
367
|
return Promise.resolve();
|
|
338
368
|
}
|
|
369
|
+
addMetadata() {
|
|
370
|
+
if (this.dynamicArrayCount <= 0) {
|
|
371
|
+
return Promise.resolve();
|
|
372
|
+
}
|
|
373
|
+
const xform = new MetadataXform();
|
|
374
|
+
this._addFile(xform.toXml({ dynamicArrayCount: this.dynamicArrayCount }), OOXML_PATHS.xlMetadata);
|
|
375
|
+
return Promise.resolve();
|
|
376
|
+
}
|
|
339
377
|
addWorkbookRels() {
|
|
340
378
|
let count = 1;
|
|
341
379
|
const relationships = [
|
|
@@ -357,6 +395,14 @@ export class WorkbookWriterBase {
|
|
|
357
395
|
Target: OOXML_REL_TARGETS.workbookFeaturePropertyBag
|
|
358
396
|
});
|
|
359
397
|
}
|
|
398
|
+
// Add metadata relationship for dynamic array formulas
|
|
399
|
+
if (this.dynamicArrayCount > 0) {
|
|
400
|
+
relationships.push({
|
|
401
|
+
Id: `rId${count++}`,
|
|
402
|
+
Type: RelType.SheetMetadata,
|
|
403
|
+
Target: OOXML_REL_TARGETS.workbookMetadata
|
|
404
|
+
});
|
|
405
|
+
}
|
|
360
406
|
this._worksheets.forEach(ws => {
|
|
361
407
|
if (ws) {
|
|
362
408
|
ws.rId = `rId${count++}`;
|
|
@@ -379,6 +425,7 @@ export class WorkbookWriterBase {
|
|
|
379
425
|
definedNames: this._definedNames.model,
|
|
380
426
|
views: this.views,
|
|
381
427
|
properties: {},
|
|
428
|
+
protection: this.protection,
|
|
382
429
|
calcProperties: {}
|
|
383
430
|
};
|
|
384
431
|
return new Promise(resolve => {
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
import { WorkbookWriterBase, type WorkbookWriterOptions as BaseOptions, type WorkbookZipOptions, type ZlibOptions } from "./workbook-writer.browser.js";
|
|
7
7
|
import { WorksheetWriter } from "./worksheet-writer.js";
|
|
8
8
|
export type { WorkbookZipOptions, ZlibOptions };
|
|
9
|
+
export type { Medium } from "./workbook-writer.browser.js";
|
|
9
10
|
export interface WorkbookWriterOptions extends BaseOptions {
|
|
10
11
|
/** If stream not specified, this field specifies the path to a file to write the XLSX workbook to */
|
|
11
12
|
filename?: string;
|
|
12
13
|
}
|
|
13
14
|
interface OutputStreamLike {
|
|
14
|
-
emit(eventName: string | symbol, ...args:
|
|
15
|
-
write(chunk:
|
|
15
|
+
emit(eventName: string | symbol, ...args: unknown[]): boolean;
|
|
16
|
+
write(chunk: Uint8Array | string): boolean | Promise<boolean>;
|
|
16
17
|
end(): void;
|
|
17
18
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
18
19
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -187,10 +187,12 @@ class WorksheetReader extends EventEmitter {
|
|
|
187
187
|
case "c":
|
|
188
188
|
if (row) {
|
|
189
189
|
const styleAttr = node.attributes.s;
|
|
190
|
+
const cmAttr = node.attributes.cm;
|
|
190
191
|
c = {
|
|
191
192
|
ref: node.attributes.r,
|
|
192
193
|
s: styleAttr !== undefined ? parseInt(styleAttr, 10) : undefined,
|
|
193
|
-
t: node.attributes.t
|
|
194
|
+
t: node.attributes.t,
|
|
195
|
+
cm: cmAttr !== undefined ? parseInt(cmAttr, 10) : undefined
|
|
194
196
|
};
|
|
195
197
|
}
|
|
196
198
|
break;
|
|
@@ -295,6 +297,20 @@ class WorksheetReader extends EventEmitter {
|
|
|
295
297
|
cellValue.result = parseFloat(c.v.text);
|
|
296
298
|
}
|
|
297
299
|
}
|
|
300
|
+
// Check if this cell is a dynamic array formula via cm → metadata mapping.
|
|
301
|
+
// Uses the precise dynamicArrayCmIndices set from WorkbookReaderBase,
|
|
302
|
+
// falling back to the coarser hasDynamicArrayMetadata boolean.
|
|
303
|
+
if (c.cm !== undefined) {
|
|
304
|
+
const { workbook: wb } = this;
|
|
305
|
+
if (wb.dynamicArrayCmIndices) {
|
|
306
|
+
if (wb.dynamicArrayCmIndices.has(c.cm)) {
|
|
307
|
+
cellValue.isDynamicArray = true;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else if (wb.hasDynamicArrayMetadata) {
|
|
311
|
+
cellValue.isDynamicArray = true;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
298
314
|
cell.value = cellValue;
|
|
299
315
|
}
|
|
300
316
|
else if (c.v) {
|
|
@@ -3,11 +3,37 @@ import { Column } from "../column.js";
|
|
|
3
3
|
import { DataValidations } from "../data-validations.js";
|
|
4
4
|
import { Dimensions } from "../range.js";
|
|
5
5
|
import { Row } from "../row.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Medium as WriterMedium } from "./workbook-writer.js";
|
|
7
|
+
import { type DrawingAnchor, type DrawingRel } from "../utils/drawing-utils.js";
|
|
8
|
+
import type { SharedStrings } from "../utils/shared-strings.js";
|
|
9
|
+
import type { StreamBuf } from "../utils/stream-buf.js";
|
|
10
|
+
import type { RowBreak, ColBreak, PageSetup, HeaderFooter, WorksheetProperties, WorksheetView, WorksheetState, AutoFilter, WorksheetProtection, ConditionalFormattingOptions, AddImageRange, IgnoredError, WatermarkOptions, RowValues } from "../types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Structural view of the fields/methods WorksheetWriter needs from its
|
|
13
|
+
* parent WorkbookWriter. Defined here (rather than importing WorkbookWriter
|
|
14
|
+
* directly) to avoid the circular `workbook-writer.ts <-> worksheet-writer.ts`
|
|
15
|
+
* dependency. The shape must stay in sync with the concrete WorkbookWriter.
|
|
16
|
+
*/
|
|
17
|
+
export interface WorkbookWriterLike {
|
|
18
|
+
/** Shared-string table (deduplicates plain/rich-text cell values). */
|
|
19
|
+
readonly sharedStrings: SharedStrings;
|
|
20
|
+
/**
|
|
21
|
+
* Style manager. Typed loosely here (`unknown`) because the concrete
|
|
22
|
+
* `StylesXform` is an internal xform class and pulling it in would
|
|
23
|
+
* reintroduce the circular import. Xform methods accept it by duck-typing.
|
|
24
|
+
*/
|
|
25
|
+
readonly styles: object;
|
|
26
|
+
/** Incremented once per dynamic-array formula cell during row commit. */
|
|
27
|
+
dynamicArrayCount: number;
|
|
28
|
+
/** Lookup a media (image/chart) by registered id. */
|
|
29
|
+
getImage(id: number): WriterMedium | undefined;
|
|
30
|
+
/** Open a streaming entry in the output zip for the given path. */
|
|
31
|
+
_openStream(path: string): InstanceType<typeof StreamBuf>;
|
|
32
|
+
}
|
|
7
33
|
interface WorksheetWriterOptions {
|
|
8
34
|
id: number;
|
|
9
35
|
name?: string;
|
|
10
|
-
workbook:
|
|
36
|
+
workbook: WorkbookWriterLike;
|
|
11
37
|
useSharedStrings?: boolean;
|
|
12
38
|
properties?: Partial<WorksheetProperties>;
|
|
13
39
|
state?: WorksheetState;
|
|
@@ -38,6 +64,11 @@ interface WriterImageModel {
|
|
|
38
64
|
height: number;
|
|
39
65
|
};
|
|
40
66
|
editAs?: string;
|
|
67
|
+
/** Absolute position in pixels — mutually exclusive with tl/br cell anchors. */
|
|
68
|
+
pos?: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
};
|
|
41
72
|
};
|
|
42
73
|
hyperlinks?: {
|
|
43
74
|
hyperlink?: string;
|
|
@@ -67,6 +98,7 @@ declare class WorksheetWriter {
|
|
|
67
98
|
private _formulae;
|
|
68
99
|
private _siFormulae;
|
|
69
100
|
conditionalFormatting: ConditionalFormattingOptions[];
|
|
101
|
+
ignoredErrors: IgnoredError[];
|
|
70
102
|
rowBreaks: RowBreak[];
|
|
71
103
|
colBreaks: ColBreak[];
|
|
72
104
|
properties: Partial<WorksheetProperties> & {
|
|
@@ -104,8 +136,8 @@ declare class WorksheetWriter {
|
|
|
104
136
|
/** Relationship Id - assigned by WorkbookWriter */
|
|
105
137
|
rId?: string;
|
|
106
138
|
constructor(options: WorksheetWriterOptions);
|
|
107
|
-
get workbook():
|
|
108
|
-
get stream():
|
|
139
|
+
get workbook(): WorkbookWriterLike;
|
|
140
|
+
get stream(): InstanceType<typeof StreamBuf>;
|
|
109
141
|
destroy(): void;
|
|
110
142
|
commit(): void;
|
|
111
143
|
get dimensions(): Dimensions;
|
|
@@ -184,6 +216,7 @@ declare class WorksheetWriter {
|
|
|
184
216
|
* The prepare phase was already done in _writeConditionalFormatting().
|
|
185
217
|
*/
|
|
186
218
|
private _writeExtLst;
|
|
219
|
+
private _writeIgnoredErrors;
|
|
187
220
|
private _writeRowBreaks;
|
|
188
221
|
private _writeColBreaks;
|
|
189
222
|
private _writeDataValidations;
|
|
@@ -197,8 +230,8 @@ declare class WorksheetWriter {
|
|
|
197
230
|
get drawing(): {
|
|
198
231
|
rId: string;
|
|
199
232
|
name: string;
|
|
200
|
-
anchors:
|
|
201
|
-
rels:
|
|
233
|
+
anchors: DrawingAnchor[];
|
|
234
|
+
rels: DrawingRel[];
|
|
202
235
|
} | undefined;
|
|
203
236
|
private _writeBackground;
|
|
204
237
|
private _writeLegacyData;
|
|
@@ -26,6 +26,7 @@ import { DrawingXform as DrawingPartXform } from "../xlsx/xform/sheet/drawing-xf
|
|
|
26
26
|
import { ExtLstXform } from "../xlsx/xform/sheet/ext-lst-xform.js";
|
|
27
27
|
import { HeaderFooterXform } from "../xlsx/xform/sheet/header-footer-xform.js";
|
|
28
28
|
import { HyperlinkXform } from "../xlsx/xform/sheet/hyperlink-xform.js";
|
|
29
|
+
import { IgnoredErrorsXform } from "../xlsx/xform/sheet/ignored-errors-xform.js";
|
|
29
30
|
import { PageMarginsXform } from "../xlsx/xform/sheet/page-margins-xform.js";
|
|
30
31
|
import { PageSetupXform } from "../xlsx/xform/sheet/page-setup-xform.js";
|
|
31
32
|
import { PictureXform } from "../xlsx/xform/sheet/picture-xform.js";
|
|
@@ -60,6 +61,7 @@ const xform = {
|
|
|
60
61
|
drawing: new DrawingPartXform(),
|
|
61
62
|
conditionalFormattings: new ConditionalFormattingsXform(),
|
|
62
63
|
extLst: new ExtLstXform(),
|
|
64
|
+
ignoredErrors: new IgnoredErrorsXform(),
|
|
63
65
|
headerFooter: new HeaderFooterXform(),
|
|
64
66
|
rowBreaks: new RowBreaksXform(),
|
|
65
67
|
colBreaks: new ColBreaksXform()
|
|
@@ -100,6 +102,8 @@ class WorksheetWriter {
|
|
|
100
102
|
this._siFormulae = 0;
|
|
101
103
|
// keep a record of conditionalFormattings
|
|
102
104
|
this.conditionalFormatting = [];
|
|
105
|
+
// ignored errors (suppress green triangles in Excel)
|
|
106
|
+
this.ignoredErrors = [];
|
|
103
107
|
// keep a record of all row and column pageBreaks
|
|
104
108
|
this.rowBreaks = [];
|
|
105
109
|
this.colBreaks = [];
|
|
@@ -212,6 +216,8 @@ class WorksheetWriter {
|
|
|
212
216
|
this._writeBackground(); // Note: must be after drawing
|
|
213
217
|
// Legacy Data tag for comments
|
|
214
218
|
this._writeLegacyData();
|
|
219
|
+
// ignoredErrors must be before extLst
|
|
220
|
+
this._writeIgnoredErrors();
|
|
215
221
|
// extLst must be the last child element before </worksheet>
|
|
216
222
|
this._writeExtLst();
|
|
217
223
|
this._writeCloseWorksheet();
|
|
@@ -529,18 +535,33 @@ class WorksheetWriter {
|
|
|
529
535
|
}
|
|
530
536
|
throw new Error(`Invalid image range: "${range}". Expected a range like "A1:C3".`);
|
|
531
537
|
}
|
|
532
|
-
|
|
533
|
-
|
|
538
|
+
// Absolute positioning (pos + ext, no cell anchors)
|
|
539
|
+
if ("pos" in range && range.pos) {
|
|
540
|
+
return {
|
|
541
|
+
type: "image",
|
|
542
|
+
imageId,
|
|
543
|
+
range: {
|
|
544
|
+
tl: { nativeCol: 0, nativeColOff: 0, nativeRow: 0, nativeRowOff: 0 },
|
|
545
|
+
ext: range.ext,
|
|
546
|
+
pos: range.pos
|
|
547
|
+
},
|
|
548
|
+
hyperlinks: range.hyperlinks
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
// Cell-based positioning (tl/br anchors)
|
|
552
|
+
const cellRange = range;
|
|
553
|
+
const tl = new Anchor(this, cellRange.tl, 0).model;
|
|
554
|
+
const br = cellRange.br ? new Anchor(this, cellRange.br, 0).model : undefined;
|
|
534
555
|
return {
|
|
535
556
|
type: "image",
|
|
536
557
|
imageId,
|
|
537
558
|
range: {
|
|
538
559
|
tl,
|
|
539
560
|
br,
|
|
540
|
-
ext:
|
|
541
|
-
editAs:
|
|
561
|
+
ext: cellRange.ext,
|
|
562
|
+
editAs: cellRange.editAs
|
|
542
563
|
},
|
|
543
|
-
hyperlinks:
|
|
564
|
+
hyperlinks: cellRange.hyperlinks
|
|
544
565
|
};
|
|
545
566
|
}
|
|
546
567
|
// =========================================================================
|
|
@@ -617,6 +638,9 @@ class WorksheetWriter {
|
|
|
617
638
|
}
|
|
618
639
|
if (row.hasValues || row.height != null) {
|
|
619
640
|
const { model } = row;
|
|
641
|
+
if (!model) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
620
644
|
const options = {
|
|
621
645
|
styles: this._workbook.styles,
|
|
622
646
|
sharedStrings: this.useSharedStrings ? this._workbook.sharedStrings : undefined,
|
|
@@ -628,6 +652,14 @@ class WorksheetWriter {
|
|
|
628
652
|
};
|
|
629
653
|
xform.row.prepare(model, options);
|
|
630
654
|
this.stream.write(xform.row.toXml(model));
|
|
655
|
+
// Count dynamic array formula cells for metadata generation
|
|
656
|
+
if (model.cells) {
|
|
657
|
+
for (const cell of model.cells) {
|
|
658
|
+
if (cell && cell.isDynamicArray) {
|
|
659
|
+
this._workbook.dynamicArrayCount++;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
631
663
|
if (options.comments.length) {
|
|
632
664
|
this.hasComments = true;
|
|
633
665
|
this._sheetCommentsWriter.addComments(options.comments);
|
|
@@ -680,6 +712,11 @@ class WorksheetWriter {
|
|
|
680
712
|
const model = { conditionalFormattings: this.conditionalFormatting };
|
|
681
713
|
this.stream.write(xform.extLst.toXml(model));
|
|
682
714
|
}
|
|
715
|
+
_writeIgnoredErrors() {
|
|
716
|
+
if (this.ignoredErrors.length > 0) {
|
|
717
|
+
this.stream.write(xform.ignoredErrors.toXml(this.ignoredErrors));
|
|
718
|
+
}
|
|
719
|
+
}
|
|
683
720
|
_writeRowBreaks() {
|
|
684
721
|
this.stream.write(xform.rowBreaks.toXml(this.rowBreaks));
|
|
685
722
|
}
|
|
@@ -753,6 +790,9 @@ class WorksheetWriter {
|
|
|
753
790
|
if (this._background) {
|
|
754
791
|
if (this._background.imageId !== undefined) {
|
|
755
792
|
const image = this._workbook.getImage(this._background.imageId);
|
|
793
|
+
if (!image) {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
756
796
|
const pictureId = this._sheetRelsWriter.addMedia({
|
|
757
797
|
Target: mediaRelTargetFromRels(image.name),
|
|
758
798
|
Type: RelType.Image
|
|
@@ -535,14 +535,27 @@ class Table {
|
|
|
535
535
|
this._ensureStyle().showColumnStripes = value;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
+
// SUBTOTAL function codes per OOXML/Excel:
|
|
539
|
+
// 1/101=AVERAGE, 2/102=COUNT, 3/103=COUNTA, 4/104=MAX, 5/105=MIN,
|
|
540
|
+
// 6/106=PRODUCT, 7/107=STDEV, 8/108=STDEVP, 9/109=SUM, 10/110=VAR, 11/111=VARP.
|
|
541
|
+
// The 1xx variants also ignore manually hidden rows — Excel always uses
|
|
542
|
+
// these for totals-row injection. OOXML totalsRowFunction names map to:
|
|
543
|
+
// average → 1 (AVERAGE)
|
|
544
|
+
// countNums → 2 (COUNT, numeric-only)
|
|
545
|
+
// count → 3 (COUNTA)
|
|
546
|
+
// max → 4
|
|
547
|
+
// min → 5
|
|
548
|
+
// stdDev → 7 (sample std dev, per Excel's totals UI)
|
|
549
|
+
// var → 10 (sample variance, per Excel's totals UI)
|
|
550
|
+
// sum → 9
|
|
538
551
|
Table.SUBTOTAL_FUNCTIONS = {
|
|
539
552
|
average: 101,
|
|
540
553
|
countNums: 102,
|
|
541
554
|
count: 103,
|
|
542
555
|
max: 104,
|
|
543
556
|
min: 105,
|
|
544
|
-
stdDev:
|
|
545
|
-
var:
|
|
557
|
+
stdDev: 107,
|
|
558
|
+
var: 110,
|
|
546
559
|
sum: 109
|
|
547
560
|
};
|
|
548
561
|
export { Table, sanitizeTableName };
|