@cj-tech-master/excelts 9.4.2 → 9.5.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/dist/browser/index.browser.d.ts +8 -5
- package/dist/browser/index.browser.js +19 -1
- package/dist/browser/index.d.ts +4 -2
- package/dist/browser/index.js +9 -1
- package/dist/browser/modules/excel/chart/cache-populator.d.ts +49 -0
- package/dist/browser/modules/excel/chart/cache-populator.js +1171 -0
- package/dist/browser/modules/excel/chart/chart-api.d.ts +92 -0
- package/dist/browser/modules/excel/chart/chart-api.js +364 -0
- package/dist/browser/modules/excel/chart/chart-builder.d.ts +48 -0
- package/dist/browser/modules/excel/chart/chart-builder.js +2432 -0
- package/dist/browser/modules/excel/chart/chart-ex-builder.d.ts +36 -0
- package/dist/browser/modules/excel/chart/chart-ex-builder.js +903 -0
- package/dist/browser/modules/excel/chart/chart-ex-parser.d.ts +8 -0
- package/dist/browser/modules/excel/chart/chart-ex-parser.js +1205 -0
- package/dist/browser/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
- package/dist/browser/modules/excel/chart/chart-ex-renderer.js +5352 -0
- package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +531 -0
- package/dist/browser/modules/excel/chart/chart-ex-types.js +11 -0
- package/dist/browser/modules/excel/chart/chart-images.d.ts +78 -0
- package/dist/browser/modules/excel/chart/chart-images.js +363 -0
- package/dist/browser/modules/excel/chart/chart-presets.d.ts +392 -0
- package/dist/browser/modules/excel/chart/chart-presets.js +179 -0
- package/dist/browser/modules/excel/chart/chart-renderer.d.ts +550 -0
- package/dist/browser/modules/excel/chart/chart-renderer.js +6440 -0
- package/dist/browser/modules/excel/chart/chart-sidecar.d.ts +21 -0
- package/dist/browser/modules/excel/chart/chart-sidecar.js +427 -0
- package/dist/browser/modules/excel/chart/chart-utils.d.ts +306 -0
- package/dist/browser/modules/excel/chart/chart-utils.js +821 -0
- package/dist/browser/modules/excel/chart/chart.d.ts +504 -0
- package/dist/browser/modules/excel/chart/chart.js +1320 -0
- package/dist/browser/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
- package/dist/browser/modules/excel/chart/glyph-rasterizer.js +658 -0
- package/dist/browser/modules/excel/chart/index.d.ts +54 -0
- package/dist/browser/modules/excel/chart/index.js +46 -0
- package/dist/browser/modules/excel/chart/install.d.ts +44 -0
- package/dist/browser/modules/excel/chart/install.js +91 -0
- package/dist/browser/modules/excel/chart/shape-properties.d.ts +156 -0
- package/dist/browser/modules/excel/chart/shape-properties.js +1557 -0
- package/dist/browser/modules/excel/chart/stroke-font.d.ts +36 -0
- package/dist/browser/modules/excel/chart/stroke-font.js +1556 -0
- package/dist/browser/modules/excel/chart/topojson.d.ts +98 -0
- package/dist/browser/modules/excel/chart/topojson.js +236 -0
- package/dist/browser/modules/excel/chart/types.d.ts +2559 -0
- package/dist/browser/modules/excel/chart/types.js +8 -0
- package/dist/browser/modules/excel/chart-host-registry.d.ts +157 -0
- package/dist/browser/modules/excel/chart-host-registry.js +90 -0
- package/dist/browser/modules/excel/chartsheet.d.ts +102 -0
- package/dist/browser/modules/excel/chartsheet.js +196 -0
- package/dist/browser/modules/excel/defined-names.d.ts +35 -0
- package/dist/browser/modules/excel/defined-names.js +44 -4
- package/dist/browser/modules/excel/errors.d.ts +6 -0
- package/dist/browser/modules/excel/errors.js +9 -0
- package/dist/browser/modules/excel/form-control.d.ts +6 -0
- package/dist/browser/modules/excel/form-control.js +17 -0
- package/dist/browser/modules/excel/image.js +12 -2
- package/dist/browser/modules/excel/pivot-chart.d.ts +7 -0
- package/dist/browser/modules/excel/pivot-chart.js +53 -0
- package/dist/browser/modules/excel/pivot-table.d.ts +55 -0
- package/dist/browser/modules/excel/pivot-table.js +35 -0
- package/dist/browser/modules/excel/range.js +5 -1
- package/dist/browser/modules/excel/sparkline/index.d.ts +7 -0
- package/dist/browser/modules/excel/sparkline/index.js +7 -0
- package/dist/browser/modules/excel/sparkline/sparkline.d.ts +206 -0
- package/dist/browser/modules/excel/sparkline/sparkline.js +750 -0
- package/dist/browser/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/browser/modules/excel/table.js +42 -6
- package/dist/browser/modules/excel/types.d.ts +72 -0
- package/dist/browser/modules/excel/utils/address.d.ts +18 -0
- package/dist/browser/modules/excel/utils/address.js +28 -0
- package/dist/browser/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/browser/modules/excel/utils/guid.d.ts +15 -0
- package/dist/browser/modules/excel/utils/guid.js +35 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +74 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.js +206 -9
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-table.js +177 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/context.js +191 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/index.js +102 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/reporter.js +61 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/types.js +12 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
- package/dist/browser/modules/excel/workbook.browser.d.ts +248 -30
- package/dist/browser/modules/excel/workbook.browser.js +966 -31
- package/dist/browser/modules/excel/workbook.d.ts +43 -0
- package/dist/browser/modules/excel/workbook.js +48 -0
- package/dist/browser/modules/excel/worksheet.d.ts +157 -3
- package/dist/browser/modules/excel/worksheet.js +394 -35
- package/dist/browser/modules/excel/xlsx/rel-type.d.ts +40 -0
- package/dist/browser/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
- package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/browser/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
- package/dist/browser/modules/excel/xlsx/xform/xsd-values.js +101 -0
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +4422 -78
- package/dist/browser/modules/pdf/builder/document-builder.d.ts +74 -0
- package/dist/browser/modules/pdf/builder/document-builder.js +507 -2
- package/dist/browser/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/browser/modules/pdf/excel-bridge.d.ts +69 -0
- package/dist/browser/modules/pdf/excel-bridge.js +683 -12
- package/dist/browser/modules/pdf/font/font-manager.d.ts +25 -0
- package/dist/browser/modules/pdf/font/font-manager.js +39 -0
- package/dist/browser/modules/pdf/index.d.ts +5 -2
- package/dist/browser/modules/pdf/index.js +3 -1
- package/dist/browser/modules/pdf/render/chart-surface.d.ts +33 -0
- package/dist/browser/modules/pdf/render/chart-surface.js +200 -0
- package/dist/browser/modules/pdf/render/layout-engine.d.ts +22 -1
- package/dist/browser/modules/pdf/render/layout-engine.js +436 -56
- package/dist/browser/modules/pdf/render/page-renderer.js +169 -28
- package/dist/browser/modules/pdf/render/pdf-exporter.js +117 -7
- package/dist/browser/modules/pdf/types.d.ts +227 -23
- package/dist/browser/modules/pdf/types.js +4 -0
- package/dist/browser/modules/pdf/word-bridge.d.ts +47 -0
- package/dist/browser/modules/pdf/word-bridge.js +304 -0
- package/dist/browser/modules/word/constants.d.ts +179 -0
- package/dist/browser/modules/word/constants.js +231 -0
- package/dist/browser/modules/word/content-types.d.ts +27 -0
- package/dist/browser/modules/word/content-types.js +53 -0
- package/dist/browser/modules/word/digital-signatures.d.ts +87 -0
- package/dist/browser/modules/word/digital-signatures.js +134 -0
- package/dist/browser/modules/word/document.d.ts +728 -0
- package/dist/browser/modules/word/document.js +1795 -0
- package/dist/browser/modules/word/docx-packager.d.ts +14 -0
- package/dist/browser/modules/word/docx-packager.js +822 -0
- package/dist/browser/modules/word/docx-reader.d.ts +11 -0
- package/dist/browser/modules/word/docx-reader.js +4929 -0
- package/dist/browser/modules/word/encryption.d.ts +102 -0
- package/dist/browser/modules/word/encryption.js +274 -0
- package/dist/browser/modules/word/errors.d.ts +49 -0
- package/dist/browser/modules/word/errors.js +68 -0
- package/dist/browser/modules/word/font-obfuscation.d.ts +31 -0
- package/dist/browser/modules/word/font-obfuscation.js +83 -0
- package/dist/browser/modules/word/html-renderer.d.ts +38 -0
- package/dist/browser/modules/word/html-renderer.js +782 -0
- package/dist/browser/modules/word/index.base.d.ts +19 -0
- package/dist/browser/modules/word/index.base.js +51 -0
- package/dist/browser/modules/word/index.browser.d.ts +4 -0
- package/dist/browser/modules/word/index.browser.js +4 -0
- package/dist/browser/modules/word/index.d.ts +4 -0
- package/dist/browser/modules/word/index.js +4 -0
- package/dist/browser/modules/word/internal-utils.d.ts +23 -0
- package/dist/browser/modules/word/internal-utils.js +54 -0
- package/dist/browser/modules/word/relationships.d.ts +31 -0
- package/dist/browser/modules/word/relationships.js +56 -0
- package/dist/browser/modules/word/types.d.ts +2325 -0
- package/dist/browser/modules/word/types.js +10 -0
- package/dist/browser/modules/word/units.d.ts +49 -0
- package/dist/browser/modules/word/units.js +111 -0
- package/dist/browser/modules/word/writers/chart-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/chart-writer.js +385 -0
- package/dist/browser/modules/word/writers/checkbox-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/checkbox-writer.js +42 -0
- package/dist/browser/modules/word/writers/comment-writer.d.ts +15 -0
- package/dist/browser/modules/word/writers/comment-writer.js +70 -0
- package/dist/browser/modules/word/writers/document-writer.d.ts +16 -0
- package/dist/browser/modules/word/writers/document-writer.js +461 -0
- package/dist/browser/modules/word/writers/footnote-writer.d.ts +11 -0
- package/dist/browser/modules/word/writers/footnote-writer.js +72 -0
- package/dist/browser/modules/word/writers/header-footer-writer.d.ts +13 -0
- package/dist/browser/modules/word/writers/header-footer-writer.js +129 -0
- package/dist/browser/modules/word/writers/image-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/image-writer.js +185 -0
- package/dist/browser/modules/word/writers/math-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/math-writer.js +428 -0
- package/dist/browser/modules/word/writers/numbering-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/numbering-writer.js +125 -0
- package/dist/browser/modules/word/writers/paragraph-writer.d.ts +13 -0
- package/dist/browser/modules/word/writers/paragraph-writer.js +516 -0
- package/dist/browser/modules/word/writers/parts-writer.d.ts +26 -0
- package/dist/browser/modules/word/writers/parts-writer.js +660 -0
- package/dist/browser/modules/word/writers/run-writer.d.ts +15 -0
- package/dist/browser/modules/word/writers/run-writer.js +649 -0
- package/dist/browser/modules/word/writers/section-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/section-writer.js +238 -0
- package/dist/browser/modules/word/writers/styles-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/styles-writer.js +242 -0
- package/dist/browser/modules/word/writers/table-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/table-writer.js +503 -0
- package/dist/browser/modules/word/writers/textbox-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/textbox-writer.js +53 -0
- package/dist/browser/modules/word/writers/toc-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/toc-writer.js +79 -0
- package/dist/browser/modules/xml/encode.d.ts +56 -7
- package/dist/browser/modules/xml/encode.js +157 -11
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/modules/excel/chart/cache-populator.js +1178 -0
- package/dist/cjs/modules/excel/chart/chart-api.js +371 -0
- package/dist/cjs/modules/excel/chart/chart-builder.js +2440 -0
- package/dist/cjs/modules/excel/chart/chart-ex-builder.js +907 -0
- package/dist/cjs/modules/excel/chart/chart-ex-parser.js +1208 -0
- package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +5364 -0
- package/dist/cjs/modules/excel/chart/chart-ex-types.js +12 -0
- package/dist/cjs/modules/excel/chart/chart-images.js +366 -0
- package/dist/cjs/modules/excel/chart/chart-presets.js +184 -0
- package/dist/cjs/modules/excel/chart/chart-renderer.js +6450 -0
- package/dist/cjs/modules/excel/chart/chart-sidecar.js +433 -0
- package/dist/cjs/modules/excel/chart/chart-utils.js +845 -0
- package/dist/cjs/modules/excel/chart/chart.js +1324 -0
- package/dist/cjs/modules/excel/chart/glyph-rasterizer.js +664 -0
- package/dist/cjs/modules/excel/chart/index.js +101 -0
- package/dist/cjs/modules/excel/chart/install.js +95 -0
- package/dist/cjs/modules/excel/chart/shape-properties.js +1577 -0
- package/dist/cjs/modules/excel/chart/stroke-font.js +1559 -0
- package/dist/cjs/modules/excel/chart/topojson.js +239 -0
- package/dist/cjs/modules/excel/chart/types.js +9 -0
- package/dist/cjs/modules/excel/chart-host-registry.js +96 -0
- package/dist/cjs/modules/excel/chartsheet.js +199 -0
- package/dist/cjs/modules/excel/defined-names.js +44 -4
- package/dist/cjs/modules/excel/errors.js +11 -1
- package/dist/cjs/modules/excel/form-control.js +17 -0
- package/dist/cjs/modules/excel/image.js +12 -2
- package/dist/cjs/modules/excel/pivot-chart.js +56 -0
- package/dist/cjs/modules/excel/pivot-table.js +35 -0
- package/dist/cjs/modules/excel/range.js +5 -1
- package/dist/cjs/modules/excel/sparkline/index.js +23 -0
- package/dist/cjs/modules/excel/sparkline/sparkline.js +756 -0
- package/dist/cjs/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/cjs/modules/excel/table.js +42 -6
- package/dist/cjs/modules/excel/utils/address.js +29 -0
- package/dist/cjs/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/cjs/modules/excel/utils/guid.js +38 -0
- package/dist/cjs/modules/excel/utils/ooxml-paths.js +246 -9
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +103 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart.js +2128 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chartsheet.js +29 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-content-types.js +184 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-drawing.js +270 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-pivot.js +107 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-relationships.js +188 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-structure.js +60 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-styles.js +92 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-table.js +180 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-workbook.js +166 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-worksheet.js +572 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/context.js +196 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/index.js +105 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/path-utils.js +168 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/reporter.js +66 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/types.js +13 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/xml-utils.js +110 -0
- package/dist/cjs/modules/excel/workbook.browser.js +973 -38
- package/dist/cjs/modules/excel/workbook.js +48 -0
- package/dist/cjs/modules/excel/worksheet.js +393 -34
- package/dist/cjs/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6003 -0
- package/dist/cjs/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +219 -0
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +149 -10
- package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/cjs/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +228 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/cjs/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +444 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +195 -19
- package/dist/cjs/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/cjs/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/cjs/modules/excel/xlsx/xform/xsd-values.js +106 -0
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +4420 -76
- package/dist/cjs/modules/pdf/builder/document-builder.js +506 -1
- package/dist/cjs/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/cjs/modules/pdf/excel-bridge.js +684 -12
- package/dist/cjs/modules/pdf/font/font-manager.js +39 -0
- package/dist/cjs/modules/pdf/index.js +5 -1
- package/dist/cjs/modules/pdf/render/chart-surface.js +203 -0
- package/dist/cjs/modules/pdf/render/layout-engine.js +437 -56
- package/dist/cjs/modules/pdf/render/page-renderer.js +169 -28
- package/dist/cjs/modules/pdf/render/pdf-exporter.js +115 -5
- package/dist/cjs/modules/pdf/types.js +5 -0
- package/dist/cjs/modules/pdf/word-bridge.js +307 -0
- package/dist/cjs/modules/word/constants.js +234 -0
- package/dist/cjs/modules/word/content-types.js +57 -0
- package/dist/cjs/modules/word/digital-signatures.js +140 -0
- package/dist/cjs/modules/word/document.js +1909 -0
- package/dist/cjs/modules/word/docx-packager.js +825 -0
- package/dist/cjs/modules/word/docx-reader.js +4932 -0
- package/dist/cjs/modules/word/encryption.js +282 -0
- package/dist/cjs/modules/word/errors.js +88 -0
- package/dist/cjs/modules/word/font-obfuscation.js +88 -0
- package/dist/cjs/modules/word/html-renderer.js +785 -0
- package/dist/cjs/modules/word/index.base.js +199 -0
- package/dist/cjs/modules/word/index.browser.js +20 -0
- package/dist/cjs/modules/word/index.js +20 -0
- package/dist/cjs/modules/word/internal-utils.js +59 -0
- package/dist/cjs/modules/word/relationships.js +60 -0
- package/dist/cjs/modules/word/types.js +11 -0
- package/dist/cjs/modules/word/units.js +135 -0
- package/dist/cjs/modules/word/writers/chart-writer.js +388 -0
- package/dist/cjs/modules/word/writers/checkbox-writer.js +45 -0
- package/dist/cjs/modules/word/writers/comment-writer.js +74 -0
- package/dist/cjs/modules/word/writers/document-writer.js +465 -0
- package/dist/cjs/modules/word/writers/footnote-writer.js +76 -0
- package/dist/cjs/modules/word/writers/header-footer-writer.js +134 -0
- package/dist/cjs/modules/word/writers/image-writer.js +188 -0
- package/dist/cjs/modules/word/writers/math-writer.js +431 -0
- package/dist/cjs/modules/word/writers/numbering-writer.js +128 -0
- package/dist/cjs/modules/word/writers/paragraph-writer.js +521 -0
- package/dist/cjs/modules/word/writers/parts-writer.js +671 -0
- package/dist/cjs/modules/word/writers/run-writer.js +655 -0
- package/dist/cjs/modules/word/writers/section-writer.js +241 -0
- package/dist/cjs/modules/word/writers/styles-writer.js +245 -0
- package/dist/cjs/modules/word/writers/table-writer.js +506 -0
- package/dist/cjs/modules/word/writers/textbox-writer.js +56 -0
- package/dist/cjs/modules/word/writers/toc-writer.js +82 -0
- package/dist/cjs/modules/xml/encode.js +158 -11
- package/dist/esm/index.browser.js +20 -2
- package/dist/esm/index.js +9 -1
- package/dist/esm/modules/excel/chart/cache-populator.js +1171 -0
- package/dist/esm/modules/excel/chart/chart-api.js +364 -0
- package/dist/esm/modules/excel/chart/chart-builder.js +2432 -0
- package/dist/esm/modules/excel/chart/chart-ex-builder.js +903 -0
- package/dist/esm/modules/excel/chart/chart-ex-parser.js +1205 -0
- package/dist/esm/modules/excel/chart/chart-ex-renderer.js +5352 -0
- package/dist/esm/modules/excel/chart/chart-ex-types.js +11 -0
- package/dist/esm/modules/excel/chart/chart-images.js +363 -0
- package/dist/esm/modules/excel/chart/chart-presets.js +179 -0
- package/dist/esm/modules/excel/chart/chart-renderer.js +6440 -0
- package/dist/esm/modules/excel/chart/chart-sidecar.js +427 -0
- package/dist/esm/modules/excel/chart/chart-utils.js +821 -0
- package/dist/esm/modules/excel/chart/chart.js +1320 -0
- package/dist/esm/modules/excel/chart/glyph-rasterizer.js +658 -0
- package/dist/esm/modules/excel/chart/index.js +46 -0
- package/dist/esm/modules/excel/chart/install.js +91 -0
- package/dist/esm/modules/excel/chart/shape-properties.js +1557 -0
- package/dist/esm/modules/excel/chart/stroke-font.js +1556 -0
- package/dist/esm/modules/excel/chart/topojson.js +236 -0
- package/dist/esm/modules/excel/chart/types.js +8 -0
- package/dist/esm/modules/excel/chart-host-registry.js +90 -0
- package/dist/esm/modules/excel/chartsheet.js +196 -0
- package/dist/esm/modules/excel/defined-names.js +44 -4
- package/dist/esm/modules/excel/errors.js +9 -0
- package/dist/esm/modules/excel/form-control.js +17 -0
- package/dist/esm/modules/excel/image.js +12 -2
- package/dist/esm/modules/excel/pivot-chart.js +53 -0
- package/dist/esm/modules/excel/pivot-table.js +35 -0
- package/dist/esm/modules/excel/range.js +5 -1
- package/dist/esm/modules/excel/sparkline/index.js +7 -0
- package/dist/esm/modules/excel/sparkline/sparkline.js +750 -0
- package/dist/esm/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/esm/modules/excel/table.js +42 -6
- package/dist/esm/modules/excel/utils/address.js +28 -0
- package/dist/esm/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/esm/modules/excel/utils/guid.js +35 -0
- package/dist/esm/modules/excel/utils/ooxml-paths.js +206 -9
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-table.js +177 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/context.js +191 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/index.js +102 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/reporter.js +61 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/types.js +12 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
- package/dist/esm/modules/excel/workbook.browser.js +969 -34
- package/dist/esm/modules/excel/workbook.js +48 -0
- package/dist/esm/modules/excel/worksheet.js +394 -35
- package/dist/esm/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
- package/dist/esm/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
- package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/esm/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/esm/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
- package/dist/esm/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/esm/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/esm/modules/excel/xlsx/xform/xsd-values.js +101 -0
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +4422 -78
- package/dist/esm/modules/pdf/builder/document-builder.js +507 -2
- package/dist/esm/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/esm/modules/pdf/excel-bridge.js +683 -12
- package/dist/esm/modules/pdf/font/font-manager.js +39 -0
- package/dist/esm/modules/pdf/index.js +3 -1
- package/dist/esm/modules/pdf/render/chart-surface.js +200 -0
- package/dist/esm/modules/pdf/render/layout-engine.js +436 -56
- package/dist/esm/modules/pdf/render/page-renderer.js +169 -28
- package/dist/esm/modules/pdf/render/pdf-exporter.js +117 -7
- package/dist/esm/modules/pdf/types.js +4 -0
- package/dist/esm/modules/pdf/word-bridge.js +304 -0
- package/dist/esm/modules/word/constants.js +231 -0
- package/dist/esm/modules/word/content-types.js +53 -0
- package/dist/esm/modules/word/digital-signatures.js +134 -0
- package/dist/esm/modules/word/document.js +1795 -0
- package/dist/esm/modules/word/docx-packager.js +822 -0
- package/dist/esm/modules/word/docx-reader.js +4929 -0
- package/dist/esm/modules/word/encryption.js +274 -0
- package/dist/esm/modules/word/errors.js +68 -0
- package/dist/esm/modules/word/font-obfuscation.js +83 -0
- package/dist/esm/modules/word/html-renderer.js +782 -0
- package/dist/esm/modules/word/index.base.js +51 -0
- package/dist/esm/modules/word/index.browser.js +4 -0
- package/dist/esm/modules/word/index.js +4 -0
- package/dist/esm/modules/word/internal-utils.js +54 -0
- package/dist/esm/modules/word/relationships.js +56 -0
- package/dist/esm/modules/word/types.js +10 -0
- package/dist/esm/modules/word/units.js +111 -0
- package/dist/esm/modules/word/writers/chart-writer.js +385 -0
- package/dist/esm/modules/word/writers/checkbox-writer.js +42 -0
- package/dist/esm/modules/word/writers/comment-writer.js +70 -0
- package/dist/esm/modules/word/writers/document-writer.js +461 -0
- package/dist/esm/modules/word/writers/footnote-writer.js +72 -0
- package/dist/esm/modules/word/writers/header-footer-writer.js +129 -0
- package/dist/esm/modules/word/writers/image-writer.js +185 -0
- package/dist/esm/modules/word/writers/math-writer.js +428 -0
- package/dist/esm/modules/word/writers/numbering-writer.js +125 -0
- package/dist/esm/modules/word/writers/paragraph-writer.js +516 -0
- package/dist/esm/modules/word/writers/parts-writer.js +660 -0
- package/dist/esm/modules/word/writers/run-writer.js +649 -0
- package/dist/esm/modules/word/writers/section-writer.js +238 -0
- package/dist/esm/modules/word/writers/styles-writer.js +242 -0
- package/dist/esm/modules/word/writers/table-writer.js +503 -0
- package/dist/esm/modules/word/writers/textbox-writer.js +53 -0
- package/dist/esm/modules/word/writers/toc-writer.js +79 -0
- package/dist/esm/modules/xml/encode.js +157 -11
- package/dist/iife/excelts.iife.js +11789 -687
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +52 -44
- package/dist/types/index.browser.d.ts +8 -5
- package/dist/types/index.d.ts +4 -2
- package/dist/types/modules/excel/chart/cache-populator.d.ts +49 -0
- package/dist/types/modules/excel/chart/chart-api.d.ts +92 -0
- package/dist/types/modules/excel/chart/chart-builder.d.ts +48 -0
- package/dist/types/modules/excel/chart/chart-ex-builder.d.ts +36 -0
- package/dist/types/modules/excel/chart/chart-ex-parser.d.ts +8 -0
- package/dist/types/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
- package/dist/types/modules/excel/chart/chart-ex-types.d.ts +531 -0
- package/dist/types/modules/excel/chart/chart-images.d.ts +78 -0
- package/dist/types/modules/excel/chart/chart-presets.d.ts +392 -0
- package/dist/types/modules/excel/chart/chart-renderer.d.ts +550 -0
- package/dist/types/modules/excel/chart/chart-sidecar.d.ts +21 -0
- package/dist/types/modules/excel/chart/chart-utils.d.ts +306 -0
- package/dist/types/modules/excel/chart/chart.d.ts +504 -0
- package/dist/types/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
- package/dist/types/modules/excel/chart/index.d.ts +54 -0
- package/dist/types/modules/excel/chart/install.d.ts +44 -0
- package/dist/types/modules/excel/chart/shape-properties.d.ts +156 -0
- package/dist/types/modules/excel/chart/stroke-font.d.ts +36 -0
- package/dist/types/modules/excel/chart/topojson.d.ts +98 -0
- package/dist/types/modules/excel/chart/types.d.ts +2559 -0
- package/dist/types/modules/excel/chart-host-registry.d.ts +157 -0
- package/dist/types/modules/excel/chartsheet.d.ts +102 -0
- package/dist/types/modules/excel/defined-names.d.ts +35 -0
- package/dist/types/modules/excel/errors.d.ts +6 -0
- package/dist/types/modules/excel/form-control.d.ts +6 -0
- package/dist/types/modules/excel/pivot-chart.d.ts +7 -0
- package/dist/types/modules/excel/pivot-table.d.ts +55 -0
- package/dist/types/modules/excel/sparkline/index.d.ts +7 -0
- package/dist/types/modules/excel/sparkline/sparkline.d.ts +206 -0
- package/dist/types/modules/excel/types.d.ts +72 -0
- package/dist/types/modules/excel/utils/address.d.ts +18 -0
- package/dist/types/modules/excel/utils/guid.d.ts +15 -0
- package/dist/types/modules/excel/utils/ooxml-paths.d.ts +74 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
- package/dist/types/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
- package/dist/types/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
- package/dist/types/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
- package/dist/types/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
- package/dist/types/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
- package/dist/types/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
- package/dist/types/modules/excel/workbook.browser.d.ts +248 -30
- package/dist/types/modules/excel/workbook.d.ts +43 -0
- package/dist/types/modules/excel/worksheet.d.ts +157 -3
- package/dist/types/modules/excel/xlsx/rel-type.d.ts +40 -0
- package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
- package/dist/types/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
- package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
- package/dist/types/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
- package/dist/types/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
- package/dist/types/modules/pdf/builder/document-builder.d.ts +74 -0
- package/dist/types/modules/pdf/excel-bridge.d.ts +69 -0
- package/dist/types/modules/pdf/font/font-manager.d.ts +25 -0
- package/dist/types/modules/pdf/index.d.ts +5 -2
- package/dist/types/modules/pdf/render/chart-surface.d.ts +33 -0
- package/dist/types/modules/pdf/render/layout-engine.d.ts +22 -1
- package/dist/types/modules/pdf/types.d.ts +227 -23
- package/dist/types/modules/pdf/word-bridge.d.ts +47 -0
- package/dist/types/modules/word/constants.d.ts +179 -0
- package/dist/types/modules/word/content-types.d.ts +27 -0
- package/dist/types/modules/word/digital-signatures.d.ts +87 -0
- package/dist/types/modules/word/document.d.ts +728 -0
- package/dist/types/modules/word/docx-packager.d.ts +14 -0
- package/dist/types/modules/word/docx-reader.d.ts +11 -0
- package/dist/types/modules/word/encryption.d.ts +102 -0
- package/dist/types/modules/word/errors.d.ts +49 -0
- package/dist/types/modules/word/font-obfuscation.d.ts +31 -0
- package/dist/types/modules/word/html-renderer.d.ts +38 -0
- package/dist/types/modules/word/index.base.d.ts +19 -0
- package/dist/types/modules/word/index.browser.d.ts +4 -0
- package/dist/types/modules/word/index.d.ts +4 -0
- package/dist/types/modules/word/internal-utils.d.ts +23 -0
- package/dist/types/modules/word/relationships.d.ts +31 -0
- package/dist/types/modules/word/types.d.ts +2325 -0
- package/dist/types/modules/word/units.d.ts +49 -0
- package/dist/types/modules/word/writers/chart-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/checkbox-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/comment-writer.d.ts +15 -0
- package/dist/types/modules/word/writers/document-writer.d.ts +16 -0
- package/dist/types/modules/word/writers/footnote-writer.d.ts +11 -0
- package/dist/types/modules/word/writers/header-footer-writer.d.ts +13 -0
- package/dist/types/modules/word/writers/image-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/math-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/numbering-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/paragraph-writer.d.ts +13 -0
- package/dist/types/modules/word/writers/parts-writer.d.ts +26 -0
- package/dist/types/modules/word/writers/run-writer.d.ts +15 -0
- package/dist/types/modules/word/writers/section-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/styles-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/table-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/textbox-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/toc-writer.d.ts +9 -0
- package/dist/types/modules/xml/encode.d.ts +56 -7
- package/package.json +29 -11
- package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +0 -48
- package/dist/browser/modules/excel/utils/ooxml-validator.js +0 -493
- package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +0 -77
- package/dist/browser/modules/excel/utils/passthrough-manager.js +0 -129
- package/dist/cjs/modules/excel/utils/ooxml-validator.js +0 -499
- package/dist/cjs/modules/excel/utils/passthrough-manager.js +0 -133
- package/dist/esm/modules/excel/utils/ooxml-validator.js +0 -493
- package/dist/esm/modules/excel/utils/passthrough-manager.js +0 -129
- package/dist/types/modules/excel/utils/ooxml-validator.d.ts +0 -48
- package/dist/types/modules/excel/utils/passthrough-manager.d.ts +0 -77
|
@@ -17,10 +17,19 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.excelToPdf = excelToPdf;
|
|
20
|
+
exports.chartToPdf = chartToPdf;
|
|
21
|
+
// Chart runtime is accessed through the chart-host-registry slot so
|
|
22
|
+
// `@pkg/pdf` can do excel-to-PDF conversion without statically pulling
|
|
23
|
+
// ~1.2 MB of chart rendering code into every consumer's bundle.
|
|
24
|
+
// Consumers that convert workbooks with charts must call
|
|
25
|
+
// `installChartSupport()` from `@cj-tech-master/excelts/chart` before
|
|
26
|
+
// invoking `excelToPdf()`.
|
|
27
|
+
const chart_host_registry_1 = require("../excel/chart-host-registry.js");
|
|
20
28
|
const enums_1 = require("../excel/enums.js");
|
|
21
29
|
const cell_format_1 = require("../excel/utils/cell-format.js");
|
|
22
30
|
const host_registry_1 = require("../formula/host-registry.js");
|
|
23
31
|
const utils_base_1 = require("../../utils/utils.base.js");
|
|
32
|
+
const document_builder_1 = require("./builder/document-builder");
|
|
24
33
|
const pdf_exporter_1 = require("./render/pdf-exporter");
|
|
25
34
|
const types_1 = require("./types");
|
|
26
35
|
// =============================================================================
|
|
@@ -46,24 +55,132 @@ async function excelToPdf(workbook, options) {
|
|
|
46
55
|
// who don't import it fall back to whatever cached results the XLSX
|
|
47
56
|
// shipped with (safe for workbooks last saved by Excel itself).
|
|
48
57
|
(0, host_registry_1.tryInvokeFormulaEngine)(workbook);
|
|
49
|
-
const pdfWorkbook = excelWorkbookToPdf(workbook);
|
|
58
|
+
const pdfWorkbook = await excelWorkbookToPdf(workbook);
|
|
50
59
|
return (0, pdf_exporter_1.exportPdf)(pdfWorkbook, options);
|
|
51
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Render a single {@link Chart} to a standalone one-page PDF.
|
|
63
|
+
*
|
|
64
|
+
* The output is a **zero-dependency deterministic preview**, not an
|
|
65
|
+
* Excel-pixel-perfect rendering. Use this for server-side reports,
|
|
66
|
+
* thumbnails, and CI artefacts where the goal is a recognisable chart
|
|
67
|
+
* without a headless Office dependency. When pixel-identical output
|
|
68
|
+
* matters (publication-grade reports, Excel/LibreOffice-compatible
|
|
69
|
+
* formatting), round-trip the `.xlsx` through
|
|
70
|
+
* `soffice --convert-to pdf` — the byte-preserving round-trip in this
|
|
71
|
+
* library makes that a safe handoff. See `src/modules/excel/README.md`
|
|
72
|
+
* → "Rendering scope" for the complete boundary list.
|
|
73
|
+
*
|
|
74
|
+
* Classic charts take the **vector** path: the chart is drawn directly
|
|
75
|
+
* onto the page via `drawChartPdf`, so text stays selectable and shapes
|
|
76
|
+
* remain resolution-independent. ChartEx charts whose layout IDs are in
|
|
77
|
+
* `VECTOR_PDF_CHART_EX_LAYOUT_IDS` also take the vector path via
|
|
78
|
+
* `drawChartExPdf`; unsupported layouts (if any) and charts where
|
|
79
|
+
* `forceRaster: true` is set fall through to the SVG → PNG → image-XObject
|
|
80
|
+
* raster pipeline.
|
|
81
|
+
*
|
|
82
|
+
* Lives in `excel-bridge.ts` because invoking the PDF builder from the
|
|
83
|
+
* chart module would cross the Layer 4 → Layer 5 import boundary
|
|
84
|
+
* documented in `AGENTS.md`. Consumers import it from
|
|
85
|
+
* `@cj-tech-master/excelts/pdf` alongside `excelToPdf`.
|
|
86
|
+
*/
|
|
87
|
+
async function chartToPdf(chart, options = {}) {
|
|
88
|
+
const width = options.width ?? 520;
|
|
89
|
+
const height = options.height ?? 360;
|
|
90
|
+
const margin = options.margin ?? 36;
|
|
91
|
+
const pageWidth = options.pageWidth ?? Math.max(width + margin * 2, 400);
|
|
92
|
+
const pageHeight = options.pageHeight ?? Math.max(height + margin * 2, 300);
|
|
93
|
+
const doc = new document_builder_1.PdfDocumentBuilder();
|
|
94
|
+
if (options.title || options.author) {
|
|
95
|
+
doc.setMetadata({
|
|
96
|
+
title: options.title,
|
|
97
|
+
author: options.author
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const page = doc.addPage({ width: pageWidth, height: pageHeight });
|
|
101
|
+
const isChartEx = chart.chartExModel !== undefined;
|
|
102
|
+
// ChartEx charts whose every series has a layoutId in
|
|
103
|
+
// VECTOR_PDF_CHART_EX_LAYOUT_IDS take the vector route alongside
|
|
104
|
+
// classic charts. As of the regionMap port this covers every ChartEx
|
|
105
|
+
// layout the builder currently emits. Anything else — or any chart
|
|
106
|
+
// the caller explicitly asks to rasterise via `forceRaster` — falls
|
|
107
|
+
// through to the SVG → PNG → image-XObject pipeline.
|
|
108
|
+
const chartExModel = chart.chartExModel;
|
|
109
|
+
const chartExVectorable = isChartEx &&
|
|
110
|
+
chartExModel !== undefined &&
|
|
111
|
+
(0, chart_host_registry_1.getChartSupport)().canRenderChartExAsVectorPdf(chartExModel);
|
|
112
|
+
const useRaster = options.forceRaster === true || (isChartEx && !chartExVectorable);
|
|
113
|
+
if (!useRaster) {
|
|
114
|
+
if (isChartEx && chartExModel !== undefined) {
|
|
115
|
+
(0, chart_host_registry_1.getChartSupport)().drawChartExPdf(page, chartExModel, {
|
|
116
|
+
x: margin,
|
|
117
|
+
y: pageHeight - margin - height,
|
|
118
|
+
width,
|
|
119
|
+
height
|
|
120
|
+
}, { title: options.title, regionMap: options.regionMap });
|
|
121
|
+
return doc.build();
|
|
122
|
+
}
|
|
123
|
+
// Vector path for classic charts.
|
|
124
|
+
const model = chart.chartModel;
|
|
125
|
+
if (!model) {
|
|
126
|
+
throw new Error("chartToPdf: Chart has neither a classic model nor a ChartEx model to render");
|
|
127
|
+
}
|
|
128
|
+
(0, chart_host_registry_1.getChartSupport)().drawChartPdf(page, model, {
|
|
129
|
+
x: margin,
|
|
130
|
+
y: pageHeight - margin - height,
|
|
131
|
+
width,
|
|
132
|
+
height
|
|
133
|
+
});
|
|
134
|
+
return doc.build();
|
|
135
|
+
}
|
|
136
|
+
// Raster path: produce a PNG, then embed it on the page. Uses scale
|
|
137
|
+
// 2× by default so the PDF viewer shows crisp text even when zoomed
|
|
138
|
+
// into a 150 % magnification. Callers who need larger prints can
|
|
139
|
+
// bump `rasterScale`; anything above 4 rapidly grows the PDF size.
|
|
140
|
+
const scale = options.rasterScale ?? 2;
|
|
141
|
+
const pngBytes = isChartEx
|
|
142
|
+
? await (0, chart_host_registry_1.getChartSupport)().renderChartExPng(chart.chartExModel, { width, height, scale })
|
|
143
|
+
: await (0, chart_host_registry_1.getChartSupport)().renderChartPng(chart.chartModel, { width, height, scale });
|
|
144
|
+
page.drawImage({
|
|
145
|
+
data: pngBytes,
|
|
146
|
+
format: "png",
|
|
147
|
+
x: margin,
|
|
148
|
+
y: pageHeight - margin - height,
|
|
149
|
+
width,
|
|
150
|
+
height
|
|
151
|
+
});
|
|
152
|
+
return doc.build();
|
|
153
|
+
}
|
|
52
154
|
/**
|
|
53
155
|
* Convert an Excel Workbook to the internal PdfWorkbook data structure.
|
|
156
|
+
*
|
|
157
|
+
* Async because two conversion paths hand off work that may be off-thread:
|
|
158
|
+
* - Non-whitelisted ChartEx layouts are rasterised to PNG at collection
|
|
159
|
+
* time via `renderChartExPng` (so the exporter never blocks on chart
|
|
160
|
+
* rendering).
|
|
161
|
+
* - Chartsheets follow the same per-chart rasterisation rule.
|
|
162
|
+
*
|
|
163
|
+
* Worksheets and chartsheets are merged into a single `sheets` array in
|
|
164
|
+
* tab order (`orderNo`), matching what Excel / LibreOffice would print.
|
|
165
|
+
* Chartsheets without an orderNo fall to the end, mirroring how Excel
|
|
166
|
+
* treats sheets with missing tab positions.
|
|
54
167
|
*/
|
|
55
|
-
function excelWorkbookToPdf(workbook) {
|
|
168
|
+
async function excelWorkbookToPdf(workbook) {
|
|
169
|
+
const worksheetResults = await Promise.all(workbook.worksheets.map(ws => convertSheet(ws, workbook)));
|
|
170
|
+
const chartsheetResults = await Promise.all(workbook.chartsheets.map(cs => convertChartsheet(cs)));
|
|
171
|
+
const combined = [...worksheetResults, ...chartsheetResults];
|
|
172
|
+
combined.sort((a, b) => (a.orderNo ?? Number.POSITIVE_INFINITY) - (b.orderNo ?? Number.POSITIVE_INFINITY));
|
|
56
173
|
return {
|
|
57
174
|
title: workbook.title || undefined,
|
|
58
175
|
creator: workbook.creator || undefined,
|
|
59
176
|
subject: workbook.subject || undefined,
|
|
60
|
-
sheets:
|
|
177
|
+
sheets: combined
|
|
61
178
|
};
|
|
62
179
|
}
|
|
63
180
|
// =============================================================================
|
|
64
181
|
// Sheet Conversion
|
|
65
182
|
// =============================================================================
|
|
66
|
-
function convertSheet(ws, workbook) {
|
|
183
|
+
async function convertSheet(ws, workbook) {
|
|
67
184
|
const dimensions = ws.dimensions;
|
|
68
185
|
const hasData = dimensions && dimensions.model.top > 0 && dimensions.model.left > 0;
|
|
69
186
|
const bounds = hasData
|
|
@@ -141,12 +258,32 @@ function convertSheet(ws, workbook) {
|
|
|
141
258
|
// Convert row/col breaks
|
|
142
259
|
const rowBreaks = ws.rowBreaks?.map((b) => b.id);
|
|
143
260
|
const colBreaks = ws.colBreaks?.map((b) => b.id);
|
|
144
|
-
// Convert images
|
|
261
|
+
// Convert images and charts. Both are floating objects anchored to
|
|
262
|
+
// cells, and both need to participate in bounds expansion so the
|
|
263
|
+
// layout engine allocates pages that cover their anchor rows/cols.
|
|
145
264
|
const images = collectImages(ws, workbook);
|
|
146
|
-
|
|
265
|
+
const charts = await collectCharts(ws);
|
|
266
|
+
const sparklineCharts = collectSparklineCharts(ws);
|
|
267
|
+
// Merge sparkline micro-charts with regular charts
|
|
268
|
+
const allCharts = charts
|
|
269
|
+
? sparklineCharts
|
|
270
|
+
? [...charts, ...sparklineCharts]
|
|
271
|
+
: charts
|
|
272
|
+
: sparklineCharts || undefined;
|
|
273
|
+
const anchoredRanges = [];
|
|
147
274
|
if (images) {
|
|
148
275
|
for (const img of images) {
|
|
149
|
-
|
|
276
|
+
anchoredRanges.push(img.range);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (allCharts) {
|
|
280
|
+
for (const ch of allCharts) {
|
|
281
|
+
anchoredRanges.push(ch.range);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (anchoredRanges.length > 0) {
|
|
285
|
+
for (const range of anchoredRanges) {
|
|
286
|
+
const tl = range.tl;
|
|
150
287
|
const tlCol = (tl.nativeCol ?? tl.col ?? 0) + 1; // 0-indexed → 1-indexed
|
|
151
288
|
const tlRow = (tl.nativeRow ?? tl.row ?? 0) + 1;
|
|
152
289
|
if (bounds.top === 0 && bounds.left === 0) {
|
|
@@ -160,8 +297,8 @@ function convertSheet(ws, workbook) {
|
|
|
160
297
|
bounds.bottom = tlRow;
|
|
161
298
|
}
|
|
162
299
|
// Also extend to bottom-right anchor if present
|
|
163
|
-
if (
|
|
164
|
-
const br =
|
|
300
|
+
if (range.br) {
|
|
301
|
+
const br = range.br;
|
|
165
302
|
const brCol = (br.nativeCol ?? br.col ?? 0) + 1;
|
|
166
303
|
const brRow = (br.nativeRow ?? br.row ?? 0) + 1;
|
|
167
304
|
if (brCol > bounds.right) {
|
|
@@ -189,8 +326,10 @@ function convertSheet(ws, workbook) {
|
|
|
189
326
|
}
|
|
190
327
|
}
|
|
191
328
|
return {
|
|
329
|
+
kind: "worksheet",
|
|
192
330
|
name: ws.name,
|
|
193
331
|
state: ws.state ?? "visible",
|
|
332
|
+
orderNo: ws.orderNo,
|
|
194
333
|
bounds,
|
|
195
334
|
columns,
|
|
196
335
|
rows,
|
|
@@ -198,7 +337,8 @@ function convertSheet(ws, workbook) {
|
|
|
198
337
|
pageSetup,
|
|
199
338
|
rowBreaks,
|
|
200
339
|
colBreaks,
|
|
201
|
-
images
|
|
340
|
+
images,
|
|
341
|
+
charts: allCharts
|
|
202
342
|
};
|
|
203
343
|
}
|
|
204
344
|
// =============================================================================
|
|
@@ -439,10 +579,542 @@ function collectImages(ws, workbook) {
|
|
|
439
579
|
}
|
|
440
580
|
: undefined,
|
|
441
581
|
ext: wsImage.range.ext
|
|
442
|
-
? {
|
|
443
|
-
|
|
582
|
+
? {
|
|
583
|
+
width: wsImage.range.ext.width,
|
|
584
|
+
height: wsImage.range.ext.height
|
|
585
|
+
}
|
|
586
|
+
: undefined,
|
|
587
|
+
// Images historically store ext as pixels — the layout engine
|
|
588
|
+
// converts px→pt at assignment time (px × 0.75 = pt).
|
|
589
|
+
extUnit: wsImage.range.ext ? "px" : undefined
|
|
444
590
|
}
|
|
445
591
|
});
|
|
446
592
|
}
|
|
447
593
|
return images.length > 0 ? images : undefined;
|
|
448
594
|
}
|
|
595
|
+
// =============================================================================
|
|
596
|
+
// Chart Collection
|
|
597
|
+
// =============================================================================
|
|
598
|
+
/**
|
|
599
|
+
* Gather every embedded chart on a worksheet and wrap it in a
|
|
600
|
+
* {@link PdfSheetChart} the layout engine can place.
|
|
601
|
+
*
|
|
602
|
+
* - **Classic charts** and **whitelisted ChartEx layouts** get a
|
|
603
|
+
* `drawVector` closure pinned over the chart model. The closure is
|
|
604
|
+
* invoked later by the PDF exporter against a drawing surface adapted
|
|
605
|
+
* over the page's content stream (see `render/chart-surface.ts`), so
|
|
606
|
+
* the chart ends up as real PDF geometry — selectable text, crisp
|
|
607
|
+
* shapes at any zoom.
|
|
608
|
+
* - **ChartEx layouts outside the whitelist** are rasterised up-front
|
|
609
|
+
* via `renderChartExPng` and attached as a raster payload. The
|
|
610
|
+
* exporter then treats the PNG as an image XObject. The raster size
|
|
611
|
+
* is derived from the anchor extent (with a sensible fallback), and
|
|
612
|
+
* the PDF viewer stretches the bitmap to the final rect.
|
|
613
|
+
*
|
|
614
|
+
* Pivot charts inherit the classic path — they are regular `Chart`
|
|
615
|
+
* objects with a `pivotSource` tag, and their model renders like any
|
|
616
|
+
* other classic chart.
|
|
617
|
+
*/
|
|
618
|
+
async function collectCharts(ws) {
|
|
619
|
+
const wsCharts = ws.getCharts?.();
|
|
620
|
+
if (!wsCharts || !Array.isArray(wsCharts) || wsCharts.length === 0) {
|
|
621
|
+
return undefined;
|
|
622
|
+
}
|
|
623
|
+
const charts = [];
|
|
624
|
+
for (const chart of wsCharts) {
|
|
625
|
+
const range = chartAnchorRange(chart);
|
|
626
|
+
if (!range) {
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
const classicModel = chart.chartModel;
|
|
630
|
+
const chartExModel = chart.chartExModel;
|
|
631
|
+
if (classicModel) {
|
|
632
|
+
// Classic chart → vector path.
|
|
633
|
+
const drawVector = (surface, rect) => {
|
|
634
|
+
(0, chart_host_registry_1.getChartSupport)().drawChartPdf(surface, classicModel, {
|
|
635
|
+
x: rect.x,
|
|
636
|
+
y: rect.y,
|
|
637
|
+
width: rect.width,
|
|
638
|
+
height: rect.height
|
|
639
|
+
});
|
|
640
|
+
};
|
|
641
|
+
charts.push({ range, drawVector });
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
if (chartExModel) {
|
|
645
|
+
// Hierarchical ChartEx (treemap/sunburst) marks its dims with
|
|
646
|
+
// `_skipCache` to prevent the XLSX writer from emitting flat
|
|
647
|
+
// cache levels (which confuses Excel). For PDF rendering we need
|
|
648
|
+
// the data in-memory, so temporarily lift the flag, fill caches
|
|
649
|
+
// from the worksheet, then restore it.
|
|
650
|
+
ensureChartExCachesFilled(chartExModel, ws);
|
|
651
|
+
if ((0, chart_host_registry_1.getChartSupport)().canRenderChartExAsVectorPdf(chartExModel)) {
|
|
652
|
+
// Whitelisted ChartEx layout → vector path.
|
|
653
|
+
const drawVector = (surface, rect) => {
|
|
654
|
+
(0, chart_host_registry_1.getChartSupport)().drawChartExPdf(surface, chartExModel, { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
|
|
655
|
+
};
|
|
656
|
+
charts.push({ range, drawVector });
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
// Non-whitelisted ChartEx layout → raster path.
|
|
660
|
+
const { widthPx, heightPx } = estimateChartPixelSize(range);
|
|
661
|
+
const png = await (0, chart_host_registry_1.getChartSupport)().renderChartExPng(chartExModel, {
|
|
662
|
+
width: widthPx,
|
|
663
|
+
height: heightPx,
|
|
664
|
+
scale: 2
|
|
665
|
+
});
|
|
666
|
+
charts.push({
|
|
667
|
+
range,
|
|
668
|
+
raster: { data: png, format: "png" }
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
// Chart has neither model — likely a placeholder or unparsed
|
|
674
|
+
// `rawXml` shape. Rasterise nothing, skip silently; the cells
|
|
675
|
+
// underneath remain visible.
|
|
676
|
+
}
|
|
677
|
+
return charts.length > 0 ? charts : undefined;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Convert worksheet sparkline groups into micro-chart entries that flow
|
|
681
|
+
* through the same chart rendering pipeline. Each sparkline becomes a
|
|
682
|
+
* `PdfSheetChart` anchored to its `cellRef` cell (one cell wide, one
|
|
683
|
+
* row tall) with a `drawVector` callback that paints the sparkline's
|
|
684
|
+
* geometry (line polyline or column bars) directly into the PDF page.
|
|
685
|
+
*/
|
|
686
|
+
function collectSparklineCharts(ws) {
|
|
687
|
+
const groups = ws.getSparklineGroups?.();
|
|
688
|
+
if (!groups || groups.length === 0) {
|
|
689
|
+
return undefined;
|
|
690
|
+
}
|
|
691
|
+
const charts = [];
|
|
692
|
+
for (const group of groups) {
|
|
693
|
+
for (const sparkline of group.sparklines) {
|
|
694
|
+
const { dataRef, cellRef } = sparkline;
|
|
695
|
+
if (!cellRef) {
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
// Parse cellRef (e.g. "N3") to get row/col
|
|
699
|
+
const cellMatch = cellRef.match(/^([A-Z]+)(\d+)$/i);
|
|
700
|
+
if (!cellMatch) {
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
const col = colLetterToNumber(cellMatch[1]);
|
|
704
|
+
const row = parseInt(cellMatch[2], 10);
|
|
705
|
+
// Resolve data values from the worksheet
|
|
706
|
+
const values = resolveSparklineData(ws, dataRef);
|
|
707
|
+
if (values.length === 0) {
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
// Build anchor: the sparkline occupies exactly one cell
|
|
711
|
+
const range = {
|
|
712
|
+
tl: { col: col - 1, row: row - 1, nativeCol: col - 1, nativeRow: row - 1 },
|
|
713
|
+
br: { col, row, nativeCol: col, nativeRow: row }
|
|
714
|
+
};
|
|
715
|
+
const drawVector = (surface, rect) => {
|
|
716
|
+
drawSparklinePdf(surface, group, values, rect);
|
|
717
|
+
};
|
|
718
|
+
charts.push({ range, drawVector });
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return charts.length > 0 ? charts : undefined;
|
|
722
|
+
}
|
|
723
|
+
/** Convert column letter(s) to 1-based number. */
|
|
724
|
+
function colLetterToNumber(letters) {
|
|
725
|
+
let n = 0;
|
|
726
|
+
for (let i = 0; i < letters.length; i++) {
|
|
727
|
+
n = n * 26 + (letters.charCodeAt(i) & 0x1f);
|
|
728
|
+
}
|
|
729
|
+
return n;
|
|
730
|
+
}
|
|
731
|
+
/** Resolve sparkline data reference to numeric values. */
|
|
732
|
+
function resolveSparklineData(ws, dataRef) {
|
|
733
|
+
if (!dataRef) {
|
|
734
|
+
return [];
|
|
735
|
+
}
|
|
736
|
+
// dataRef is like "Sheet1!B3:M3" or "'Regional KPIs'!B3:M3"
|
|
737
|
+
// Strip sheet prefix — sparklines always reference the same workbook
|
|
738
|
+
const bangIdx = dataRef.lastIndexOf("!");
|
|
739
|
+
const rangeStr = bangIdx >= 0 ? dataRef.slice(bangIdx + 1) : dataRef;
|
|
740
|
+
// Determine the source worksheet
|
|
741
|
+
let sourceWs = ws;
|
|
742
|
+
if (bangIdx >= 0) {
|
|
743
|
+
let sheetName = dataRef.slice(0, bangIdx);
|
|
744
|
+
// Remove surrounding quotes
|
|
745
|
+
if (sheetName.startsWith("'") && sheetName.endsWith("'")) {
|
|
746
|
+
sheetName = sheetName.slice(1, -1).replace(/''/g, "'");
|
|
747
|
+
}
|
|
748
|
+
const found = ws.workbook?.getWorksheet?.(sheetName);
|
|
749
|
+
if (found) {
|
|
750
|
+
sourceWs = found;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
// Parse range (e.g. "$B$3:$M$3" or "A1:K1")
|
|
754
|
+
const clean = rangeStr.replace(/\$/g, "");
|
|
755
|
+
const parts = clean.split(":");
|
|
756
|
+
if (parts.length !== 2) {
|
|
757
|
+
return [];
|
|
758
|
+
}
|
|
759
|
+
const startMatch = parts[0].match(/^([A-Z]+)(\d+)$/i);
|
|
760
|
+
const endMatch = parts[1].match(/^([A-Z]+)(\d+)$/i);
|
|
761
|
+
if (!startMatch || !endMatch) {
|
|
762
|
+
return [];
|
|
763
|
+
}
|
|
764
|
+
const startCol = colLetterToNumber(startMatch[1]);
|
|
765
|
+
const startRow = parseInt(startMatch[2], 10);
|
|
766
|
+
const endCol = colLetterToNumber(endMatch[1]);
|
|
767
|
+
const endRow = parseInt(endMatch[2], 10);
|
|
768
|
+
const values = [];
|
|
769
|
+
if (startRow === endRow) {
|
|
770
|
+
// Horizontal range
|
|
771
|
+
for (let c = startCol; c <= endCol; c++) {
|
|
772
|
+
const cell = sourceWs.getCell(startRow, c);
|
|
773
|
+
const v = typeof cell.value === "number" ? cell.value : (cell.result ?? NaN);
|
|
774
|
+
values.push(typeof v === "number" ? v : NaN);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
// Vertical range
|
|
779
|
+
for (let r = startRow; r <= endRow; r++) {
|
|
780
|
+
const cell = sourceWs.getCell(r, startCol);
|
|
781
|
+
const v = typeof cell.value === "number" ? cell.value : (cell.result ?? NaN);
|
|
782
|
+
values.push(typeof v === "number" ? v : NaN);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return values;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Draw a single sparkline into a PDF rect. Mirrors the logic of
|
|
789
|
+
* `renderSparklineSvg` but emits PDF drawing primitives via the
|
|
790
|
+
* chart surface.
|
|
791
|
+
*/
|
|
792
|
+
function drawSparklinePdf(surface, group, values, rect) {
|
|
793
|
+
const { x, y, width, height } = rect;
|
|
794
|
+
if (width <= 0 || height <= 0 || values.length === 0) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
const padding = 2;
|
|
798
|
+
const innerX = x + padding;
|
|
799
|
+
const innerY = y + padding;
|
|
800
|
+
const innerW = width - padding * 2;
|
|
801
|
+
const innerH = height - padding * 2;
|
|
802
|
+
if (innerW <= 0 || innerH <= 0) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
// Compute axis range
|
|
806
|
+
const finiteValues = values.filter(v => Number.isFinite(v));
|
|
807
|
+
if (finiteValues.length === 0) {
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
let min = Math.min(...finiteValues);
|
|
811
|
+
let max = Math.max(...finiteValues);
|
|
812
|
+
if (group.minAxisType === "custom" && group.manualMin !== undefined) {
|
|
813
|
+
min = group.manualMin;
|
|
814
|
+
}
|
|
815
|
+
if (group.maxAxisType === "custom" && group.manualMax !== undefined) {
|
|
816
|
+
max = group.manualMax;
|
|
817
|
+
}
|
|
818
|
+
if (min === max) {
|
|
819
|
+
min -= 1;
|
|
820
|
+
max += 1;
|
|
821
|
+
}
|
|
822
|
+
const span = max - min;
|
|
823
|
+
const rtl = group.rightToLeft === true;
|
|
824
|
+
const n = values.length;
|
|
825
|
+
const xAt = (i) => {
|
|
826
|
+
const t = n <= 1 ? 0.5 : i / (n - 1);
|
|
827
|
+
const shifted = rtl ? 1 - t : t;
|
|
828
|
+
return innerX + shifted * innerW;
|
|
829
|
+
};
|
|
830
|
+
// PDF y-up: higher values → higher y
|
|
831
|
+
const yAt = (v) => {
|
|
832
|
+
if (!Number.isFinite(v)) {
|
|
833
|
+
return innerY;
|
|
834
|
+
}
|
|
835
|
+
const t = (v - min) / span;
|
|
836
|
+
return innerY + t * innerH;
|
|
837
|
+
};
|
|
838
|
+
const lineColor = resolveSpkColor(group.colorSeries) ?? { r: 0.22, g: 0.38, b: 0.57 };
|
|
839
|
+
const negColor = resolveSpkColor(group.colorNegative) ?? { r: 0.82, g: 0, b: 0 };
|
|
840
|
+
if (group.type === "column" || group.type === "stacked") {
|
|
841
|
+
const barW = Math.max(1, (innerW / Math.max(n, 1)) * 0.8);
|
|
842
|
+
for (let i = 0; i < n; i++) {
|
|
843
|
+
const v = values[i];
|
|
844
|
+
if (!Number.isFinite(v) || v === 0) {
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
const cx = xAt(i);
|
|
848
|
+
const bx = cx - barW / 2;
|
|
849
|
+
const color = v < 0 && group.negative === true ? negColor : lineColor;
|
|
850
|
+
let barY;
|
|
851
|
+
let barH;
|
|
852
|
+
if (group.type === "stacked") {
|
|
853
|
+
const half = innerH / 2;
|
|
854
|
+
if (v >= 0) {
|
|
855
|
+
barY = innerY + half;
|
|
856
|
+
barH = half;
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
barY = innerY;
|
|
860
|
+
barH = half;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
const base = min <= 0 && max >= 0 ? yAt(0) : innerY;
|
|
865
|
+
const top = yAt(v);
|
|
866
|
+
barY = Math.min(base, top);
|
|
867
|
+
barH = Math.abs(top - base);
|
|
868
|
+
}
|
|
869
|
+
surface.drawRect({ x: bx, y: barY, width: barW, height: Math.max(barH, 0.5), fill: color });
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
// Line sparkline
|
|
874
|
+
const points = [];
|
|
875
|
+
for (let i = 0; i < n; i++) {
|
|
876
|
+
if (Number.isFinite(values[i])) {
|
|
877
|
+
points.push({ px: xAt(i), py: yAt(values[i]) });
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if (points.length >= 2) {
|
|
881
|
+
for (let i = 1; i < points.length; i++) {
|
|
882
|
+
surface.drawLine({
|
|
883
|
+
x1: points[i - 1].px,
|
|
884
|
+
y1: points[i - 1].py,
|
|
885
|
+
x2: points[i].px,
|
|
886
|
+
y2: points[i].py,
|
|
887
|
+
color: lineColor,
|
|
888
|
+
lineWidth: group.lineWeight ? group.lineWeight * 0.75 : 0.75
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
// Markers
|
|
893
|
+
if (group.markers && surface.drawCircle) {
|
|
894
|
+
const mkColor = resolveSpkColor(group.colorMarkers) ?? lineColor;
|
|
895
|
+
for (const p of points) {
|
|
896
|
+
surface.drawCircle({ cx: p.px, cy: p.py, r: 1.2, fill: mkColor });
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
/** Resolve a SparklineColor to a PdfColor-like {r,g,b}. */
|
|
902
|
+
function resolveSpkColor(c) {
|
|
903
|
+
if (!c) {
|
|
904
|
+
return undefined;
|
|
905
|
+
}
|
|
906
|
+
if (c.rgb) {
|
|
907
|
+
const hex = c.rgb.replace(/^#/, "").replace(/^FF/i, "");
|
|
908
|
+
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
909
|
+
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
910
|
+
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
911
|
+
if (Number.isFinite(r) && Number.isFinite(g) && Number.isFinite(b)) {
|
|
912
|
+
return { r, g, b };
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return undefined;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Translate a `Chart.range` into the PDF layer's anchor shape. Returns
|
|
919
|
+
* `undefined` for charts that ExcelTS could not anchor to any cell
|
|
920
|
+
* (extremely rare — usually indicates a corrupt drawing relationship).
|
|
921
|
+
*/
|
|
922
|
+
function chartAnchorRange(chart) {
|
|
923
|
+
const r = chart.range;
|
|
924
|
+
if (!r?.tl) {
|
|
925
|
+
return undefined;
|
|
926
|
+
}
|
|
927
|
+
const tl = r.tl;
|
|
928
|
+
const br = r.br;
|
|
929
|
+
return {
|
|
930
|
+
tl: {
|
|
931
|
+
col: tl.col ?? 0,
|
|
932
|
+
row: tl.row ?? 0,
|
|
933
|
+
nativeCol: tl.nativeCol,
|
|
934
|
+
nativeRow: tl.nativeRow,
|
|
935
|
+
nativeColOff: tl.nativeColOff,
|
|
936
|
+
nativeRowOff: tl.nativeRowOff
|
|
937
|
+
},
|
|
938
|
+
br: br
|
|
939
|
+
? {
|
|
940
|
+
col: br.col ?? 0,
|
|
941
|
+
row: br.row ?? 0,
|
|
942
|
+
nativeCol: br.nativeCol,
|
|
943
|
+
nativeRow: br.nativeRow,
|
|
944
|
+
nativeColOff: br.nativeColOff,
|
|
945
|
+
nativeRowOff: br.nativeRowOff
|
|
946
|
+
}
|
|
947
|
+
: undefined,
|
|
948
|
+
// Chart anchors store ext as EMU (`cx`, `cy`). Pass the values
|
|
949
|
+
// through unchanged; the layout engine converts EMU→pt for charts
|
|
950
|
+
// (×1/9525) and px→pt for images (×0.75) based on `extUnit`.
|
|
951
|
+
ext: r.ext ? { width: r.ext.cx, height: r.ext.cy } : undefined,
|
|
952
|
+
extUnit: r.ext ? "emu" : undefined
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Ensure a ChartEx model's data caches are populated for rendering.
|
|
957
|
+
*
|
|
958
|
+
* Hierarchical charts (treemap/sunburst) set `_skipCache` on their
|
|
959
|
+
* string/numeric dimensions so the XLSX writer doesn't emit flat cache
|
|
960
|
+
* levels (Excel rejects them). For PDF/image rendering the data must be
|
|
961
|
+
* in-memory. This helper temporarily lifts the flag, calls
|
|
962
|
+
* `fillChartExCaches`, then restores it so subsequent XLSX writes are
|
|
963
|
+
* unaffected.
|
|
964
|
+
*/
|
|
965
|
+
function ensureChartExCachesFilled(model, ws) {
|
|
966
|
+
const data = model.chartSpace?.chartData?.data;
|
|
967
|
+
if (!data) {
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
// Check if any dimension is missing cache data
|
|
971
|
+
const needsFill = data.some(entry => {
|
|
972
|
+
const strNeedsData = entry.strDim && (!entry.strDim.levels || entry.strDim.levels.length === 0);
|
|
973
|
+
const numNeedsData = entry.numDim && (!entry.numDim.levels || entry.numDim.levels.length === 0);
|
|
974
|
+
return strNeedsData || numNeedsData;
|
|
975
|
+
});
|
|
976
|
+
if (!needsFill) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
// Temporarily lift _skipCache flags
|
|
980
|
+
const skipped = [];
|
|
981
|
+
for (const entry of data) {
|
|
982
|
+
const str = entry.strDim;
|
|
983
|
+
if (str?.["_skipCache"]) {
|
|
984
|
+
skipped.push(str);
|
|
985
|
+
delete str["_skipCache"];
|
|
986
|
+
}
|
|
987
|
+
const num = entry.numDim;
|
|
988
|
+
if (num?.["_skipCache"]) {
|
|
989
|
+
skipped.push(num);
|
|
990
|
+
delete num["_skipCache"];
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
try {
|
|
994
|
+
(0, chart_host_registry_1.getChartSupport)().fillChartExCaches(model, ws.workbook, ws);
|
|
995
|
+
}
|
|
996
|
+
catch {
|
|
997
|
+
// Best-effort — rendering will proceed with whatever data is available.
|
|
998
|
+
}
|
|
999
|
+
// Restore _skipCache
|
|
1000
|
+
for (const dim of skipped) {
|
|
1001
|
+
dim["_skipCache"] = true;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Pick a PNG rasterisation size for a non-vectorable ChartEx layout.
|
|
1006
|
+
*
|
|
1007
|
+
* Strategy: use the anchor extent (EMU → pt → px at 96 dpi) when
|
|
1008
|
+
* available; otherwise fall back to a reasonable default that survives
|
|
1009
|
+
* half-page stretching without obvious artefacts. The exporter's
|
|
1010
|
+
* `rasterScale` is applied separately in `collectCharts`.
|
|
1011
|
+
*/
|
|
1012
|
+
function estimateChartPixelSize(range) {
|
|
1013
|
+
if (range.ext && range.extUnit === "emu") {
|
|
1014
|
+
const widthPt = range.ext.width / 9525;
|
|
1015
|
+
const heightPt = range.ext.height / 9525;
|
|
1016
|
+
// 1 pt = 1/72 in ≈ 96/72 px at 96 dpi
|
|
1017
|
+
return {
|
|
1018
|
+
widthPx: Math.max(120, Math.round(widthPt * (96 / 72))),
|
|
1019
|
+
heightPx: Math.max(80, Math.round(heightPt * (96 / 72)))
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
return { widthPx: 640, heightPx: 420 };
|
|
1023
|
+
}
|
|
1024
|
+
// =============================================================================
|
|
1025
|
+
// Chartsheet Conversion
|
|
1026
|
+
// =============================================================================
|
|
1027
|
+
/**
|
|
1028
|
+
* Pixel dimensions used when rasterising a non-whitelisted ChartEx on a
|
|
1029
|
+
* chartsheet. Derived from Excel's own chartsheet canvas defaults
|
|
1030
|
+
* (A4 landscape minus default margins — see `CHARTSHEET_EMU_CX / CY`
|
|
1031
|
+
* in `xlsx.browser.ts`). 2× is applied by `renderChartExPng` via the
|
|
1032
|
+
* `scale` option so the PNG looks crisp at 150% zoom.
|
|
1033
|
+
*/
|
|
1034
|
+
const CHARTSHEET_RASTER_PX = { width: 1280, height: 720 };
|
|
1035
|
+
/**
|
|
1036
|
+
* Convert a {@link Chartsheet} into a {@link PdfChartsheetData}.
|
|
1037
|
+
*
|
|
1038
|
+
* A chartsheet is a "single chart fills the whole page" sheet type. Unlike
|
|
1039
|
+
* a cell-grid worksheet there is no row/column layout to reason about —
|
|
1040
|
+
* the chart just takes whatever content area the page margins leave.
|
|
1041
|
+
*
|
|
1042
|
+
* - **Classic chart** → vector `drawChartPdf` path (selectable text,
|
|
1043
|
+
* crisp at any zoom).
|
|
1044
|
+
* - **ChartEx whitelisted layout** → vector `drawChartExPdf` path.
|
|
1045
|
+
* - **ChartEx outside the whitelist** → rasterised to PNG up-front via
|
|
1046
|
+
* `renderChartExPng`; the PDF viewer stretches the bitmap to the final
|
|
1047
|
+
* page rect.
|
|
1048
|
+
* - **No chart attached** → the chartsheet still produces a blank page
|
|
1049
|
+
* (matches what Excel prints for a chartsheet whose chart was deleted
|
|
1050
|
+
* but the sheet kept).
|
|
1051
|
+
*/
|
|
1052
|
+
async function convertChartsheet(cs) {
|
|
1053
|
+
const classicModel = cs.chartModel;
|
|
1054
|
+
const chartExModel = cs.chartExModel;
|
|
1055
|
+
let chart = {};
|
|
1056
|
+
if (classicModel) {
|
|
1057
|
+
const model = classicModel;
|
|
1058
|
+
chart = {
|
|
1059
|
+
drawVector: (surface, rect) => {
|
|
1060
|
+
(0, chart_host_registry_1.getChartSupport)().drawChartPdf(surface, model, {
|
|
1061
|
+
x: rect.x,
|
|
1062
|
+
y: rect.y,
|
|
1063
|
+
width: rect.width,
|
|
1064
|
+
height: rect.height
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
else if (chartExModel) {
|
|
1070
|
+
if ((0, chart_host_registry_1.getChartSupport)().canRenderChartExAsVectorPdf(chartExModel)) {
|
|
1071
|
+
const model = chartExModel;
|
|
1072
|
+
chart = {
|
|
1073
|
+
drawVector: (surface, rect) => {
|
|
1074
|
+
(0, chart_host_registry_1.getChartSupport)().drawChartExPdf(surface, model, {
|
|
1075
|
+
x: rect.x,
|
|
1076
|
+
y: rect.y,
|
|
1077
|
+
width: rect.width,
|
|
1078
|
+
height: rect.height
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
const png = await (0, chart_host_registry_1.getChartSupport)().renderChartExPng(chartExModel, {
|
|
1085
|
+
width: CHARTSHEET_RASTER_PX.width,
|
|
1086
|
+
height: CHARTSHEET_RASTER_PX.height,
|
|
1087
|
+
scale: 2
|
|
1088
|
+
});
|
|
1089
|
+
chart = { raster: { data: png, format: "png" } };
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
// Chartsheet orientation: explicit pageSetup wins. Excel's chartsheet
|
|
1093
|
+
// convention is landscape when unset (the CHARTSHEET_EMU_CX/CY pair in
|
|
1094
|
+
// xlsx.browser.ts is wider than tall), so we inherit that default.
|
|
1095
|
+
const explicitOrientation = cs.pageSetup?.orientation;
|
|
1096
|
+
const orientation = explicitOrientation === "portrait" || explicitOrientation === "landscape"
|
|
1097
|
+
? explicitOrientation
|
|
1098
|
+
: "landscape";
|
|
1099
|
+
// Capture the native pageSetup for callers / exporter heuristics.
|
|
1100
|
+
// Chartsheet's `CT_CsPageSetup` is a subset of worksheet's `CT_PageSetup`;
|
|
1101
|
+
// the fields we surface here are the ones the PDF renderer knows how
|
|
1102
|
+
// to interpret. Unknown fields are silently dropped.
|
|
1103
|
+
const ps = cs.pageSetup;
|
|
1104
|
+
const pageSetup = ps
|
|
1105
|
+
? {
|
|
1106
|
+
orientation: ps.orientation,
|
|
1107
|
+
paperSize: ps.paperSize,
|
|
1108
|
+
showGridLines: false
|
|
1109
|
+
}
|
|
1110
|
+
: undefined;
|
|
1111
|
+
return {
|
|
1112
|
+
kind: "chartsheet",
|
|
1113
|
+
name: cs.name,
|
|
1114
|
+
state: cs.state,
|
|
1115
|
+
orderNo: cs.model.orderNo,
|
|
1116
|
+
orientation,
|
|
1117
|
+
chart,
|
|
1118
|
+
pageSetup
|
|
1119
|
+
};
|
|
1120
|
+
}
|