@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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
class WorkbookProtectionXform extends BaseXform {
|
|
3
|
+
get tag() {
|
|
4
|
+
return "workbookProtection";
|
|
5
|
+
}
|
|
6
|
+
render(xmlStream, model) {
|
|
7
|
+
if (!model) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const attributes = {};
|
|
11
|
+
if (model.lockStructure) {
|
|
12
|
+
attributes.lockStructure = "1";
|
|
13
|
+
}
|
|
14
|
+
if (model.lockWindows) {
|
|
15
|
+
attributes.lockWindows = "1";
|
|
16
|
+
}
|
|
17
|
+
if (model.lockRevision) {
|
|
18
|
+
attributes.lockRevision = "1";
|
|
19
|
+
}
|
|
20
|
+
if (model.workbookPassword) {
|
|
21
|
+
attributes.workbookPassword = model.workbookPassword;
|
|
22
|
+
}
|
|
23
|
+
if (model.revisionsPassword) {
|
|
24
|
+
attributes.revisionsPassword = model.revisionsPassword;
|
|
25
|
+
}
|
|
26
|
+
if (model.algorithmName) {
|
|
27
|
+
attributes.workbookAlgorithmName = model.algorithmName;
|
|
28
|
+
attributes.workbookHashValue = model.hashValue;
|
|
29
|
+
attributes.workbookSaltValue = model.saltValue;
|
|
30
|
+
attributes.workbookSpinCount = model.spinCount?.toString();
|
|
31
|
+
}
|
|
32
|
+
if (Object.values(attributes).some(v => v !== undefined)) {
|
|
33
|
+
xmlStream.leafNode(this.tag, attributes);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
parseOpen(node) {
|
|
37
|
+
switch (node.name) {
|
|
38
|
+
case this.tag: {
|
|
39
|
+
const a = node.attributes;
|
|
40
|
+
this.model = {
|
|
41
|
+
lockStructure: a.lockStructure === "1" || undefined,
|
|
42
|
+
lockWindows: a.lockWindows === "1" || undefined,
|
|
43
|
+
lockRevision: a.lockRevision === "1" || undefined,
|
|
44
|
+
workbookPassword: a.workbookPassword || undefined,
|
|
45
|
+
revisionsPassword: a.revisionsPassword || undefined
|
|
46
|
+
};
|
|
47
|
+
if (a.workbookAlgorithmName) {
|
|
48
|
+
this.model.algorithmName = a.workbookAlgorithmName;
|
|
49
|
+
this.model.hashValue = a.workbookHashValue;
|
|
50
|
+
this.model.saltValue = a.workbookSaltValue;
|
|
51
|
+
this.model.spinCount = a.workbookSpinCount
|
|
52
|
+
? parseInt(a.workbookSpinCount, 10)
|
|
53
|
+
: undefined;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
default:
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
parseText() { }
|
|
62
|
+
parseClose() {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export { WorkbookProtectionXform };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { colCache } from "../../../utils/col-cache.js";
|
|
2
2
|
import { BaseXform } from "../base-xform.js";
|
|
3
3
|
import { DefinedNamesXform } from "./defined-name-xform.js";
|
|
4
|
+
import { ExternalReferenceXform } from "./external-reference-xform.js";
|
|
4
5
|
import { WorksheetXform } from "./sheet-xform.js";
|
|
5
6
|
import { WorkbookCalcPropertiesXform } from "./workbook-calc-properties-xform.js";
|
|
6
7
|
import { WorkbookPivotCacheXform } from "./workbook-pivot-cache-xform.js";
|
|
7
8
|
import { WorkbookPropertiesXform } from "./workbook-properties-xform.js";
|
|
9
|
+
import { WorkbookProtectionXform } from "./workbook-protection-xform.js";
|
|
8
10
|
import { WorkbookViewXform } from "./workbook-view-xform.js";
|
|
9
11
|
import { ListXform } from "../list-xform.js";
|
|
10
12
|
import { StaticXform } from "../static-xform.js";
|
|
@@ -15,6 +17,7 @@ class WorkbookXform extends BaseXform {
|
|
|
15
17
|
this.map = {
|
|
16
18
|
fileVersion: WorkbookXform.STATIC_XFORMS.fileVersion,
|
|
17
19
|
workbookPr: new WorkbookPropertiesXform(),
|
|
20
|
+
workbookProtection: new WorkbookProtectionXform(),
|
|
18
21
|
bookViews: new ListXform({
|
|
19
22
|
tag: "bookViews",
|
|
20
23
|
count: false,
|
|
@@ -31,6 +34,11 @@ class WorkbookXform extends BaseXform {
|
|
|
31
34
|
tag: "pivotCaches",
|
|
32
35
|
count: false,
|
|
33
36
|
childXform: new WorkbookPivotCacheXform()
|
|
37
|
+
}),
|
|
38
|
+
externalReferences: new ListXform({
|
|
39
|
+
tag: "externalReferences",
|
|
40
|
+
count: false,
|
|
41
|
+
childXform: new ExternalReferenceXform()
|
|
34
42
|
})
|
|
35
43
|
};
|
|
36
44
|
}
|
|
@@ -90,6 +98,7 @@ class WorkbookXform extends BaseXform {
|
|
|
90
98
|
xmlStream.openNode("workbook", WorkbookXform.WORKBOOK_ATTRIBUTES);
|
|
91
99
|
this.map.fileVersion.render(xmlStream);
|
|
92
100
|
this.map.workbookPr.render(xmlStream, model.properties);
|
|
101
|
+
this.map.workbookProtection.render(xmlStream, model.protection);
|
|
93
102
|
this.map.bookViews.render(xmlStream, model.views);
|
|
94
103
|
this.map.sheets.render(xmlStream, model.sheets);
|
|
95
104
|
this.map.definedNames.render(xmlStream, model.definedNames);
|
|
@@ -107,6 +116,15 @@ class WorkbookXform extends BaseXform {
|
|
|
107
116
|
return true;
|
|
108
117
|
});
|
|
109
118
|
this.map.pivotCaches.render(xmlStream, uniquePivotCaches);
|
|
119
|
+
// <externalReferences> order matters: one entry per externalLink in
|
|
120
|
+
// declaration order, each carrying the r:id that resolves (via
|
|
121
|
+
// workbook.xml.rels) to `xl/externalLinks/externalLink{N}.xml`. The
|
|
122
|
+
// index inside this list is exactly the `[N]` used in formula strings.
|
|
123
|
+
const externalLinks = model.externalLinks ?? [];
|
|
124
|
+
if (externalLinks.length > 0) {
|
|
125
|
+
const externalReferenceModels = externalLinks.map((link) => ({ rId: link.rId }));
|
|
126
|
+
this.map.externalReferences.render(xmlStream, externalReferenceModels);
|
|
127
|
+
}
|
|
110
128
|
xmlStream.closeNode();
|
|
111
129
|
}
|
|
112
130
|
parseOpen(node) {
|
|
@@ -142,8 +160,9 @@ class WorkbookXform extends BaseXform {
|
|
|
142
160
|
this.model = {
|
|
143
161
|
sheets: this.map.sheets.model,
|
|
144
162
|
properties: this.map.workbookPr.model || {},
|
|
163
|
+
protection: this.map.workbookProtection.model,
|
|
145
164
|
views: this.map.bookViews.model,
|
|
146
|
-
calcProperties: {}
|
|
165
|
+
calcProperties: this.map.calcPr.model || {}
|
|
147
166
|
};
|
|
148
167
|
if (this.map.definedNames.model) {
|
|
149
168
|
this.model.definedNames = this.map.definedNames.model;
|
|
@@ -151,6 +170,13 @@ class WorkbookXform extends BaseXform {
|
|
|
151
170
|
if (this.map.pivotCaches.model && this.map.pivotCaches.model.length > 0) {
|
|
152
171
|
this.model.pivotCaches = this.map.pivotCaches.model;
|
|
153
172
|
}
|
|
173
|
+
// Attach parsed <externalReferences> as a list of { rId } objects.
|
|
174
|
+
// The reader in xlsx.browser.ts will later join each entry with the
|
|
175
|
+
// matching workbookRels row (to pick up the externalLink Target) and
|
|
176
|
+
// the parsed externalLinkN.xml part (to pick up sheetNames / cache).
|
|
177
|
+
if (this.map.externalReferences.model && this.map.externalReferences.model.length > 0) {
|
|
178
|
+
this.model.externalReferences = this.map.externalReferences.model;
|
|
179
|
+
}
|
|
154
180
|
return false;
|
|
155
181
|
default:
|
|
156
182
|
// not quite sure how we get here!
|
|
@@ -190,13 +216,20 @@ class WorkbookXform extends BaseXform {
|
|
|
190
216
|
const definedNames = [];
|
|
191
217
|
if (model.definedNames) {
|
|
192
218
|
model.definedNames.forEach((definedName) => {
|
|
219
|
+
// For print area/titles, use rawText to extract ranges since the xform
|
|
220
|
+
// layer no longer pre-classifies content (two-phase design).
|
|
221
|
+
const effectiveRanges = definedName.ranges?.length > 0
|
|
222
|
+
? definedName.ranges
|
|
223
|
+
: definedName.rawText
|
|
224
|
+
? [definedName.rawText]
|
|
225
|
+
: [];
|
|
193
226
|
if (definedName.name === "_xlnm.Print_Area") {
|
|
194
227
|
worksheet = worksheets[definedName.localSheetId];
|
|
195
|
-
if (worksheet &&
|
|
228
|
+
if (worksheet && effectiveRanges.length > 0) {
|
|
196
229
|
if (!worksheet.pageSetup) {
|
|
197
230
|
worksheet.pageSetup = {};
|
|
198
231
|
}
|
|
199
|
-
const range = colCache.decodeEx(
|
|
232
|
+
const range = colCache.decodeEx(effectiveRanges[0]);
|
|
200
233
|
worksheet.pageSetup.printArea = worksheet.pageSetup.printArea
|
|
201
234
|
? `${worksheet.pageSetup.printArea}&&${range.dimensions}`
|
|
202
235
|
: range.dimensions;
|
|
@@ -204,11 +237,11 @@ class WorkbookXform extends BaseXform {
|
|
|
204
237
|
}
|
|
205
238
|
else if (definedName.name === "_xlnm.Print_Titles") {
|
|
206
239
|
worksheet = worksheets[definedName.localSheetId];
|
|
207
|
-
if (worksheet &&
|
|
240
|
+
if (worksheet && effectiveRanges.length > 0) {
|
|
208
241
|
if (!worksheet.pageSetup) {
|
|
209
242
|
worksheet.pageSetup = {};
|
|
210
243
|
}
|
|
211
|
-
const rangeString =
|
|
244
|
+
const rangeString = effectiveRanges.join(",");
|
|
212
245
|
const dollarRegex = /\$/g;
|
|
213
246
|
const rowRangeRegex = /\$\d+:\$\d+/;
|
|
214
247
|
const rowRangeMatches = rangeString.match(rowRangeRegex);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OOXML_PATHS, commentsPathFromName, ctrlPropPath, drawingPath, pivotCacheDefinitionPath, pivotCacheRecordsPath, pivotTablePath, tablePath, toContentTypesPartName, worksheetPath } from "../../../utils/ooxml-paths.js";
|
|
1
|
+
import { OOXML_PATHS, commentsPathFromName, ctrlPropPath, drawingPath, externalLinkPath, pivotCacheDefinitionPath, pivotCacheRecordsPath, pivotTablePath, tablePath, toContentTypesPartName, worksheetPath } from "../../../utils/ooxml-paths.js";
|
|
2
2
|
import { BaseXform } from "../base-xform.js";
|
|
3
3
|
import { StdDocAttributes } from "../../../../xml/writer.js";
|
|
4
4
|
// used for rendering the [Content_Types].xml file
|
|
@@ -74,6 +74,17 @@ class ContentTypesXform extends BaseXform {
|
|
|
74
74
|
PartName: toContentTypesPartName(OOXML_PATHS.xlStyles),
|
|
75
75
|
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
|
|
76
76
|
});
|
|
77
|
+
// Each externalLink part needs its own Override. Omitted entries make
|
|
78
|
+
// Excel fail to load the external reference (and, in some builds,
|
|
79
|
+
// trigger a "the workbook is damaged" dialog).
|
|
80
|
+
if (model.externalLinks && model.externalLinks.length > 0) {
|
|
81
|
+
for (const link of model.externalLinks) {
|
|
82
|
+
xmlStream.leafNode("Override", {
|
|
83
|
+
PartName: toContentTypesPartName(externalLinkPath(link.index)),
|
|
84
|
+
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
77
88
|
// Add FeaturePropertyBag if checkboxes are used
|
|
78
89
|
if (model.hasCheckboxes) {
|
|
79
90
|
xmlStream.leafNode("Override", {
|
|
@@ -81,6 +92,13 @@ class ContentTypesXform extends BaseXform {
|
|
|
81
92
|
ContentType: "application/vnd.ms-excel.featurepropertybag+xml"
|
|
82
93
|
});
|
|
83
94
|
}
|
|
95
|
+
// Add metadata part for dynamic array formulas
|
|
96
|
+
if (model.hasDynamicArrayFormulas) {
|
|
97
|
+
xmlStream.leafNode("Override", {
|
|
98
|
+
PartName: toContentTypesPartName(OOXML_PATHS.xlMetadata),
|
|
99
|
+
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
84
102
|
const hasSharedStrings = model.sharedStrings && model.sharedStrings.count;
|
|
85
103
|
if (hasSharedStrings) {
|
|
86
104
|
xmlStream.leafNode("Override", {
|
|
@@ -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,158 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
import { StdDocAttributes } from "../../../../xml/writer.js";
|
|
3
|
+
// Namespace URIs
|
|
4
|
+
const NS_SPREADSHEETML = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
5
|
+
const NS_DYNAMIC_ARRAY = "http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray";
|
|
6
|
+
const XLDAPR_EXT_URI = "{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}";
|
|
7
|
+
class MetadataXform extends BaseXform {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
// Parsing state
|
|
11
|
+
/** metadataType names in declaration order (1-indexed in OOXML) */
|
|
12
|
+
this._metadataTypeNames = [];
|
|
13
|
+
/** Per cellMetadata bk: the rc.t value (metadataType index, 1-indexed) */
|
|
14
|
+
this._cellMetadataTypeRefs = [];
|
|
15
|
+
/** Whether we are currently inside <cellMetadata> */
|
|
16
|
+
this._inCellMetadata = false;
|
|
17
|
+
/** Current rc.t value being collected inside a <bk> */
|
|
18
|
+
this._currentRcType = undefined;
|
|
19
|
+
}
|
|
20
|
+
get tag() {
|
|
21
|
+
return "metadata";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Render xl/metadata.xml for the given model.
|
|
25
|
+
* Only emits content when dynamicArrayCount > 0.
|
|
26
|
+
*/
|
|
27
|
+
render(xmlStream, model) {
|
|
28
|
+
if (!model || model.dynamicArrayCount <= 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
xmlStream.openXml(StdDocAttributes);
|
|
32
|
+
xmlStream.openNode("metadata", {
|
|
33
|
+
xmlns: NS_SPREADSHEETML,
|
|
34
|
+
"xmlns:xda": NS_DYNAMIC_ARRAY
|
|
35
|
+
});
|
|
36
|
+
// metadataTypes: declare XLDAPR
|
|
37
|
+
xmlStream.openNode("metadataTypes", { count: "1" });
|
|
38
|
+
xmlStream.leafNode("metadataType", {
|
|
39
|
+
name: "XLDAPR",
|
|
40
|
+
minSupportedVersion: "120000",
|
|
41
|
+
copy: "1",
|
|
42
|
+
pasteAll: "1",
|
|
43
|
+
pasteValues: "1",
|
|
44
|
+
merge: "1",
|
|
45
|
+
splitFirst: "1",
|
|
46
|
+
rowColShift: "1",
|
|
47
|
+
clearFormats: "1",
|
|
48
|
+
clearComments: "1",
|
|
49
|
+
assign: "1",
|
|
50
|
+
coerce: "1",
|
|
51
|
+
adjust: "1",
|
|
52
|
+
cellMeta: "1"
|
|
53
|
+
});
|
|
54
|
+
xmlStream.closeNode(); // </metadataTypes>
|
|
55
|
+
// futureMetadata: one shared block for all DA formulas
|
|
56
|
+
xmlStream.openNode("futureMetadata", { name: "XLDAPR", count: "1" });
|
|
57
|
+
xmlStream.openNode("bk");
|
|
58
|
+
xmlStream.openNode("extLst");
|
|
59
|
+
xmlStream.openNode("ext", { uri: XLDAPR_EXT_URI });
|
|
60
|
+
xmlStream.leafNode("xda:dynamicArrayProperties", {
|
|
61
|
+
fDynamic: "1",
|
|
62
|
+
fCollapsed: "0"
|
|
63
|
+
});
|
|
64
|
+
xmlStream.closeNode(); // </ext>
|
|
65
|
+
xmlStream.closeNode(); // </extLst>
|
|
66
|
+
xmlStream.closeNode(); // </bk>
|
|
67
|
+
xmlStream.closeNode(); // </futureMetadata>
|
|
68
|
+
// cellMetadata: one record (all DA cells share cm="1" which points here)
|
|
69
|
+
xmlStream.openNode("cellMetadata", { count: "1" });
|
|
70
|
+
xmlStream.openNode("bk");
|
|
71
|
+
// t="1" → metadataType index (1-indexed), v="0" → futureMetadata block index (0-indexed)
|
|
72
|
+
xmlStream.leafNode("rc", { t: "1", v: "0" });
|
|
73
|
+
xmlStream.closeNode(); // </bk>
|
|
74
|
+
xmlStream.closeNode(); // </cellMetadata>
|
|
75
|
+
xmlStream.closeNode(); // </metadata>
|
|
76
|
+
}
|
|
77
|
+
// =========================================================================
|
|
78
|
+
// Parse: build precise cm → metadataType mapping
|
|
79
|
+
// =========================================================================
|
|
80
|
+
reset() {
|
|
81
|
+
this._metadataTypeNames = [];
|
|
82
|
+
this._cellMetadataTypeRefs = [];
|
|
83
|
+
this._inCellMetadata = false;
|
|
84
|
+
this._currentRcType = undefined;
|
|
85
|
+
}
|
|
86
|
+
parseOpen(node) {
|
|
87
|
+
switch (node.name) {
|
|
88
|
+
case "metadata":
|
|
89
|
+
this.reset();
|
|
90
|
+
return true;
|
|
91
|
+
case "metadataType":
|
|
92
|
+
// Collect type names in declaration order (1-indexed in OOXML,
|
|
93
|
+
// but stored 0-indexed here — we adjust when looking up).
|
|
94
|
+
this._metadataTypeNames.push(node.attributes.name || "");
|
|
95
|
+
return true;
|
|
96
|
+
case "cellMetadata":
|
|
97
|
+
this._inCellMetadata = true;
|
|
98
|
+
return true;
|
|
99
|
+
case "bk":
|
|
100
|
+
if (this._inCellMetadata) {
|
|
101
|
+
this._currentRcType = undefined;
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
case "rc":
|
|
105
|
+
if (this._inCellMetadata && node.attributes.t !== undefined) {
|
|
106
|
+
this._currentRcType = parseInt(node.attributes.t, 10);
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
// Parse nested elements without action
|
|
110
|
+
case "metadataTypes":
|
|
111
|
+
case "futureMetadata":
|
|
112
|
+
case "extLst":
|
|
113
|
+
case "ext":
|
|
114
|
+
case "xda:dynamicArrayProperties":
|
|
115
|
+
return true;
|
|
116
|
+
default:
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
parseText() { }
|
|
121
|
+
parseClose(name) {
|
|
122
|
+
switch (name) {
|
|
123
|
+
case "bk":
|
|
124
|
+
if (this._inCellMetadata) {
|
|
125
|
+
// Record the metadataType reference for this cellMetadata entry.
|
|
126
|
+
// rc.t is 1-indexed into metadataTypes; store as-is.
|
|
127
|
+
this._cellMetadataTypeRefs.push(this._currentRcType ?? 0);
|
|
128
|
+
this._currentRcType = undefined;
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
case "cellMetadata":
|
|
132
|
+
this._inCellMetadata = false;
|
|
133
|
+
return true;
|
|
134
|
+
case "metadata": {
|
|
135
|
+
// Build the set of cm values (1-indexed) that map to XLDAPR.
|
|
136
|
+
// cm on <c> is 1-indexed into cellMetadata bk entries.
|
|
137
|
+
const dynamicArrayCmIndices = new Set();
|
|
138
|
+
for (let i = 0; i < this._cellMetadataTypeRefs.length; i++) {
|
|
139
|
+
const typeIndex = this._cellMetadataTypeRefs[i]; // 1-indexed
|
|
140
|
+
// metadataTypeNames is 0-indexed, so subtract 1
|
|
141
|
+
const typeName = this._metadataTypeNames[typeIndex - 1];
|
|
142
|
+
if (typeName === "XLDAPR") {
|
|
143
|
+
// cm is 1-indexed: bk[0] → cm=1, bk[1] → cm=2, etc.
|
|
144
|
+
dynamicArrayCmIndices.add(i + 1);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
this.model = {
|
|
148
|
+
hasDynamicArrays: dynamicArrayCmIndices.size > 0,
|
|
149
|
+
dynamicArrayCmIndices
|
|
150
|
+
};
|
|
151
|
+
return false; // done parsing
|
|
152
|
+
}
|
|
153
|
+
default:
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export { MetadataXform };
|
|
@@ -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,105 @@
|
|
|
1
|
+
import { BaseXform } from "../base-xform.js";
|
|
2
|
+
import { BaseCellAnchorXform } from "./base-cell-anchor-xform.js";
|
|
3
|
+
import { ExtXform } from "./ext-xform.js";
|
|
4
|
+
import { PicXform } from "./pic-xform.js";
|
|
5
|
+
import { StaticXform } from "../static-xform.js";
|
|
6
|
+
/** https://en.wikipedia.org/wiki/Office_Open_XML_file_formats#DrawingML */
|
|
7
|
+
const EMU_PER_PIXEL_AT_96_DPI = 9525;
|
|
8
|
+
/**
|
|
9
|
+
* Xform for the <xdr:pos> element (absolute position in EMU).
|
|
10
|
+
* Converts between EMU (in XML) and pixels (in model).
|
|
11
|
+
*/
|
|
12
|
+
class PosXform extends BaseXform {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.map = {};
|
|
16
|
+
this.model = { x: 0, y: 0 };
|
|
17
|
+
}
|
|
18
|
+
get tag() {
|
|
19
|
+
return "xdr:pos";
|
|
20
|
+
}
|
|
21
|
+
render(xmlStream, model) {
|
|
22
|
+
xmlStream.leafNode(this.tag, {
|
|
23
|
+
x: Math.floor(model.x * EMU_PER_PIXEL_AT_96_DPI),
|
|
24
|
+
y: Math.floor(model.y * EMU_PER_PIXEL_AT_96_DPI)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
parseOpen(node) {
|
|
28
|
+
if (node.name === this.tag) {
|
|
29
|
+
this.model = {
|
|
30
|
+
x: parseInt(node.attributes.x ?? "0", 10) / EMU_PER_PIXEL_AT_96_DPI,
|
|
31
|
+
y: parseInt(node.attributes.y ?? "0", 10) / EMU_PER_PIXEL_AT_96_DPI
|
|
32
|
+
};
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
parseText() { }
|
|
38
|
+
parseClose() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Xform for <xdr:absoluteAnchor> — images positioned by absolute coordinates
|
|
44
|
+
* rather than cell references.
|
|
45
|
+
*
|
|
46
|
+
* Structure:
|
|
47
|
+
* ```xml
|
|
48
|
+
* <xdr:absoluteAnchor>
|
|
49
|
+
* <xdr:pos x="0" y="0"/>
|
|
50
|
+
* <xdr:ext cx="1000000" cy="1000000"/>
|
|
51
|
+
* <xdr:pic>...</xdr:pic>
|
|
52
|
+
* <xdr:clientData/>
|
|
53
|
+
* </xdr:absoluteAnchor>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
class AbsoluteAnchorXform extends BaseCellAnchorXform {
|
|
57
|
+
constructor() {
|
|
58
|
+
super();
|
|
59
|
+
this.map = {
|
|
60
|
+
"xdr:pos": new PosXform(),
|
|
61
|
+
"xdr:ext": new ExtXform({ tag: "xdr:ext" }),
|
|
62
|
+
"xdr:pic": new PicXform(),
|
|
63
|
+
"xdr:clientData": new StaticXform({ tag: "xdr:clientData" })
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
get tag() {
|
|
67
|
+
return "xdr:absoluteAnchor";
|
|
68
|
+
}
|
|
69
|
+
prepare(model, options) {
|
|
70
|
+
if (model.picture) {
|
|
71
|
+
this.map["xdr:pic"].prepare(model.picture, options);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
render(xmlStream, model) {
|
|
75
|
+
xmlStream.openNode(this.tag);
|
|
76
|
+
this.map["xdr:pos"].render(xmlStream, model.range.pos ?? { x: 0, y: 0 });
|
|
77
|
+
this.map["xdr:ext"].render(xmlStream, model.range.ext);
|
|
78
|
+
if (model.picture) {
|
|
79
|
+
this.map["xdr:pic"].render(xmlStream, model.picture);
|
|
80
|
+
}
|
|
81
|
+
this.map["xdr:clientData"].render(xmlStream, {});
|
|
82
|
+
xmlStream.closeNode();
|
|
83
|
+
}
|
|
84
|
+
parseClose(name) {
|
|
85
|
+
if (this.parser) {
|
|
86
|
+
if (!this.parser.parseClose(name)) {
|
|
87
|
+
this.parser = undefined;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
switch (name) {
|
|
92
|
+
case this.tag:
|
|
93
|
+
this.model.range.pos = this.map["xdr:pos"].model;
|
|
94
|
+
this.model.range.ext = this.map["xdr:ext"].model;
|
|
95
|
+
this.model.picture = this.map["xdr:pic"].model;
|
|
96
|
+
return false;
|
|
97
|
+
default:
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
reconcile(model, options) {
|
|
102
|
+
model.medium = this.reconcilePicture(model.picture, options);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export { AbsoluteAnchorXform };
|
|
@@ -31,6 +31,9 @@ class BaseCellAnchorXform extends BaseXform {
|
|
|
31
31
|
reconcilePicture(model, options) {
|
|
32
32
|
if (model && model.rId) {
|
|
33
33
|
const rel = options.rels[model.rId];
|
|
34
|
+
if (!rel) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
34
37
|
const match = rel.Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);
|
|
35
38
|
if (match) {
|
|
36
39
|
const name = match[1];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { colCache } from "../../../utils/col-cache.js";
|
|
2
2
|
import { BaseXform } from "../base-xform.js";
|
|
3
|
+
import { AbsoluteAnchorXform } from "./absolute-anchor-xform.js";
|
|
3
4
|
import { OneCellAnchorXform } from "./one-cell-anchor-xform.js";
|
|
4
5
|
import { TwoCellAnchorXform } from "./two-cell-anchor-xform.js";
|
|
5
6
|
import { StdDocAttributes } from "../../../../xml/writer.js";
|
|
6
7
|
function getAnchorType(model) {
|
|
7
8
|
const range = typeof model.range === "string" ? colCache.decode(model.range) : model.range;
|
|
9
|
+
if (range.pos !== undefined) {
|
|
10
|
+
return "xdr:absoluteAnchor";
|
|
11
|
+
}
|
|
8
12
|
return range.br ? "xdr:twoCellAnchor" : "xdr:oneCellAnchor";
|
|
9
13
|
}
|
|
10
14
|
class DrawingXform extends BaseXform {
|
|
@@ -12,7 +16,8 @@ class DrawingXform extends BaseXform {
|
|
|
12
16
|
super();
|
|
13
17
|
this.map = {
|
|
14
18
|
"xdr:twoCellAnchor": new TwoCellAnchorXform(),
|
|
15
|
-
"xdr:oneCellAnchor": new OneCellAnchorXform()
|
|
19
|
+
"xdr:oneCellAnchor": new OneCellAnchorXform(),
|
|
20
|
+
"xdr:absoluteAnchor": new AbsoluteAnchorXform()
|
|
16
21
|
};
|
|
17
22
|
this.model = { anchors: [] };
|
|
18
23
|
}
|
|
@@ -80,7 +85,10 @@ class DrawingXform extends BaseXform {
|
|
|
80
85
|
}
|
|
81
86
|
reconcile(model, options) {
|
|
82
87
|
model.anchors.forEach(anchor => {
|
|
83
|
-
if (anchor.
|
|
88
|
+
if (anchor.range?.pos !== undefined) {
|
|
89
|
+
this.map["xdr:absoluteAnchor"].reconcile(anchor, options);
|
|
90
|
+
}
|
|
91
|
+
else if (anchor.br) {
|
|
84
92
|
this.map["xdr:twoCellAnchor"].reconcile(anchor, options);
|
|
85
93
|
}
|
|
86
94
|
else {
|