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