@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
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared validation context.
|
|
3
|
+
*
|
|
4
|
+
* Checkers share XML parsing work through this context. Relationships,
|
|
5
|
+
* content types, and parsed XML DOMs are parsed at most once and cached.
|
|
6
|
+
* Every checker consumes from the same cache so they all see identical
|
|
7
|
+
* parse results (this matters for "rels malformed" propagation — the
|
|
8
|
+
* malformed entry is reported once, and every downstream checker simply
|
|
9
|
+
* sees the empty parse result).
|
|
10
|
+
*/
|
|
11
|
+
import { attrByLocalName, findChildrenLocal, tryParseXml } from "./xml-utils.js";
|
|
12
|
+
const textDecoder = new TextDecoder();
|
|
13
|
+
// -----------------------------------------------------------------------------
|
|
14
|
+
// Context
|
|
15
|
+
// -----------------------------------------------------------------------------
|
|
16
|
+
export class ValidationContext {
|
|
17
|
+
constructor(entries, reporter) {
|
|
18
|
+
this.textCache = new Map();
|
|
19
|
+
this.domCache = new Map();
|
|
20
|
+
this.relsCache = new Map();
|
|
21
|
+
this.entries = entries;
|
|
22
|
+
this.reporter = reporter;
|
|
23
|
+
}
|
|
24
|
+
/** `true` if `path` points to a file (not a directory) in the package. */
|
|
25
|
+
has(path) {
|
|
26
|
+
const entry = this.entries.get(path);
|
|
27
|
+
return !!entry && entry.type !== "directory";
|
|
28
|
+
}
|
|
29
|
+
/** Iterate every file (skip directories). */
|
|
30
|
+
*files() {
|
|
31
|
+
for (const entry of this.entries) {
|
|
32
|
+
if (entry[1].type !== "directory") {
|
|
33
|
+
yield entry;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Decode a part as UTF-8 text. Cached. */
|
|
38
|
+
readText(path) {
|
|
39
|
+
const cached = this.textCache.get(path);
|
|
40
|
+
if (cached !== undefined) {
|
|
41
|
+
return cached;
|
|
42
|
+
}
|
|
43
|
+
const entry = this.entries.get(path);
|
|
44
|
+
if (!entry || entry.type === "directory") {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const text = textDecoder.decode(entry.data);
|
|
48
|
+
this.textCache.set(path, text);
|
|
49
|
+
return text;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parse a part as XML DOM. Cached. Returns `undefined` if the part is
|
|
53
|
+
* missing or malformed. Callers that need to distinguish those cases
|
|
54
|
+
* should check `has(path)` first.
|
|
55
|
+
*/
|
|
56
|
+
readDom(path, onMalformed) {
|
|
57
|
+
if (this.domCache.has(path)) {
|
|
58
|
+
return this.domCache.get(path);
|
|
59
|
+
}
|
|
60
|
+
const text = this.readText(path);
|
|
61
|
+
if (text === undefined) {
|
|
62
|
+
this.domCache.set(path, undefined);
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const dom = tryParseXml(text, err => {
|
|
66
|
+
onMalformed?.(err);
|
|
67
|
+
});
|
|
68
|
+
this.domCache.set(path, dom);
|
|
69
|
+
return dom;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read and cache the content-types table. On first call, parse
|
|
73
|
+
* `[Content_Types].xml`; subsequent calls return the cache.
|
|
74
|
+
* Reports malformed-XML problems via the reporter but never throws.
|
|
75
|
+
*/
|
|
76
|
+
readContentTypes() {
|
|
77
|
+
if (this.contentTypes) {
|
|
78
|
+
return this.contentTypes;
|
|
79
|
+
}
|
|
80
|
+
const path = "[Content_Types].xml";
|
|
81
|
+
const dom = this.readDom(path, err => {
|
|
82
|
+
this.reporter.error("content-types-malformed", `Content types XML parse error: ${err.message}`, path);
|
|
83
|
+
});
|
|
84
|
+
const data = {
|
|
85
|
+
defaults: new Map(),
|
|
86
|
+
overrides: new Map(),
|
|
87
|
+
parseOk: false,
|
|
88
|
+
duplicateOverrides: []
|
|
89
|
+
};
|
|
90
|
+
if (!dom) {
|
|
91
|
+
this.contentTypes = data;
|
|
92
|
+
return data;
|
|
93
|
+
}
|
|
94
|
+
const root = dom.root;
|
|
95
|
+
// Accept namespaced <Types> just in case.
|
|
96
|
+
const looksLikeTypes = root.name === "Types" || root.name.endsWith(":Types");
|
|
97
|
+
if (!looksLikeTypes) {
|
|
98
|
+
this.reporter.error("content-types-malformed", `Content types root element is <${root.name}>, expected <Types>`, path);
|
|
99
|
+
this.contentTypes = data;
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
102
|
+
for (const el of findChildrenLocal(root, "Default")) {
|
|
103
|
+
const extRaw = attrByLocalName(el, "Extension");
|
|
104
|
+
const ct = attrByLocalName(el, "ContentType");
|
|
105
|
+
if (extRaw && ct) {
|
|
106
|
+
data.defaults.set(extRaw.toLowerCase(), ct);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const el of findChildrenLocal(root, "Override")) {
|
|
110
|
+
const partName = attrByLocalName(el, "PartName");
|
|
111
|
+
const ct = attrByLocalName(el, "ContentType");
|
|
112
|
+
if (!partName || !ct) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const key = partName.startsWith("/") ? partName.slice(1) : partName;
|
|
116
|
+
if (data.overrides.has(key)) {
|
|
117
|
+
data.duplicateOverrides.push(partName);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
data.overrides.set(key, ct);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
data.parseOk = true;
|
|
124
|
+
this.contentTypes = data;
|
|
125
|
+
return data;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Read and cache a relationships file. Every .rels in the package is
|
|
129
|
+
* parsed lazily on first request. Malformed files are reported once
|
|
130
|
+
* and return an empty relationships array.
|
|
131
|
+
*/
|
|
132
|
+
readRels(relsPath) {
|
|
133
|
+
const cached = this.relsCache.get(relsPath);
|
|
134
|
+
if (cached) {
|
|
135
|
+
return cached;
|
|
136
|
+
}
|
|
137
|
+
const data = {
|
|
138
|
+
rels: [],
|
|
139
|
+
byId: new Map(),
|
|
140
|
+
parseOk: false,
|
|
141
|
+
malformedEntries: []
|
|
142
|
+
};
|
|
143
|
+
if (!this.has(relsPath)) {
|
|
144
|
+
this.relsCache.set(relsPath, data);
|
|
145
|
+
return data;
|
|
146
|
+
}
|
|
147
|
+
const dom = this.readDom(relsPath, err => {
|
|
148
|
+
this.reporter.error("rels-malformed", `Relationships XML parse error: ${err.message}`, relsPath);
|
|
149
|
+
});
|
|
150
|
+
if (!dom) {
|
|
151
|
+
this.relsCache.set(relsPath, data);
|
|
152
|
+
return data;
|
|
153
|
+
}
|
|
154
|
+
const root = dom.root;
|
|
155
|
+
const looksLikeRelationships = root.name === "Relationships" || root.name.endsWith(":Relationships");
|
|
156
|
+
if (!looksLikeRelationships) {
|
|
157
|
+
this.reporter.error("rels-malformed", `Relationships root element is <${root.name}>, expected <Relationships>`, relsPath);
|
|
158
|
+
this.relsCache.set(relsPath, data);
|
|
159
|
+
return data;
|
|
160
|
+
}
|
|
161
|
+
for (const el of findChildrenLocal(root, "Relationship")) {
|
|
162
|
+
const id = attrByLocalName(el, "Id");
|
|
163
|
+
const type = attrByLocalName(el, "Type");
|
|
164
|
+
const target = attrByLocalName(el, "Target");
|
|
165
|
+
const targetMode = attrByLocalName(el, "TargetMode");
|
|
166
|
+
if (!id || !type || target === undefined) {
|
|
167
|
+
data.malformedEntries.push({
|
|
168
|
+
missingId: !id,
|
|
169
|
+
missingType: !type,
|
|
170
|
+
missingTarget: target === undefined,
|
|
171
|
+
id,
|
|
172
|
+
type
|
|
173
|
+
});
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const rel = { id, type, target, targetMode };
|
|
177
|
+
data.rels.push(rel);
|
|
178
|
+
// Note: duplicates are checked elsewhere; we keep the FIRST here.
|
|
179
|
+
if (!data.byId.has(id)) {
|
|
180
|
+
data.byId.set(id, rel);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
data.parseOk = true;
|
|
184
|
+
this.relsCache.set(relsPath, data);
|
|
185
|
+
return data;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** Get the root element of a DOM; returns undefined for missing DOM. */
|
|
189
|
+
export function domRoot(dom) {
|
|
190
|
+
return dom?.root;
|
|
191
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point for the OOXML validator.
|
|
3
|
+
*
|
|
4
|
+
* Validates an xlsx package buffer against the OPC spec and Excel's
|
|
5
|
+
* known opening invariants. See `types.ts` for the full catalog of
|
|
6
|
+
* problem kinds.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const report = await validateXlsxBuffer(await wb.xlsx.writeBuffer());
|
|
10
|
+
* if (!report.ok) {
|
|
11
|
+
* console.error(report.problems);
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* The implementation is composed of independent checkers under
|
|
16
|
+
* `check-*.ts` — each can be unit-tested in isolation. The entry point
|
|
17
|
+
* orchestrates them with a shared `ValidationContext` that caches XML
|
|
18
|
+
* parsing across checks.
|
|
19
|
+
*/
|
|
20
|
+
import { extractAll } from "../../../archive/unzip/extract.js";
|
|
21
|
+
import { checkChart } from "./check-chart.js";
|
|
22
|
+
import { checkChartSidecars } from "./check-chart-sidecar.js";
|
|
23
|
+
import { checkChartsheet } from "./check-chartsheet.js";
|
|
24
|
+
import { checkContentTypes } from "./check-content-types.js";
|
|
25
|
+
import { checkDrawing } from "./check-drawing.js";
|
|
26
|
+
import { checkPivot } from "./check-pivot.js";
|
|
27
|
+
import { checkRelationships, checkRootRelationships } from "./check-relationships.js";
|
|
28
|
+
import { checkStructure, checkXmlWellFormed } from "./check-structure.js";
|
|
29
|
+
import { checkStyles } from "./check-styles.js";
|
|
30
|
+
import { checkTables } from "./check-table.js";
|
|
31
|
+
import { checkWorkbook } from "./check-workbook.js";
|
|
32
|
+
import { checkWorksheets } from "./check-worksheet.js";
|
|
33
|
+
import { ValidationContext } from "./context.js";
|
|
34
|
+
import { isXmlLike } from "./path-utils.js";
|
|
35
|
+
import { Reporter } from "./reporter.js";
|
|
36
|
+
/**
|
|
37
|
+
* Validate an xlsx package. Returns a report with every detected
|
|
38
|
+
* problem; `ok === true` when no error-severity problems were found.
|
|
39
|
+
*
|
|
40
|
+
* This function never throws — malformed input is surfaced as a
|
|
41
|
+
* `xml-malformed` or similar problem kind. The only exception is if
|
|
42
|
+
* `extractAll` fails to unzip the buffer (not a valid ZIP at all), in
|
|
43
|
+
* which case the underlying archive error propagates.
|
|
44
|
+
*/
|
|
45
|
+
export async function validateXlsxBuffer(xlsxBuffer, options = {}) {
|
|
46
|
+
const { checkXmlWellFormed: optCheckXmlWellFormed = true, checkRelationshipTargets = true, checkContentTypesOverrides = true, checkWorksheetControlWiring = true, checkChartStructure = true, checkStylesIntegrity = true, maxProblems, includeWarnings = false } = options;
|
|
47
|
+
const entries = await extractAll(xlsxBuffer);
|
|
48
|
+
const reporter = new Reporter({ maxProblems, includeWarnings });
|
|
49
|
+
const ctx = new ValidationContext(entries, reporter);
|
|
50
|
+
// Order matters: later checks rely on earlier ones NOT firing false
|
|
51
|
+
// positives when structural invariants are broken. Structure first.
|
|
52
|
+
checkStructure(ctx);
|
|
53
|
+
if (optCheckXmlWellFormed) {
|
|
54
|
+
checkXmlWellFormed(ctx);
|
|
55
|
+
}
|
|
56
|
+
if (checkContentTypesOverrides) {
|
|
57
|
+
checkContentTypes(ctx);
|
|
58
|
+
}
|
|
59
|
+
checkRootRelationships(ctx);
|
|
60
|
+
if (checkRelationshipTargets) {
|
|
61
|
+
checkRelationships(ctx);
|
|
62
|
+
}
|
|
63
|
+
checkWorkbook(ctx);
|
|
64
|
+
if (checkWorksheetControlWiring) {
|
|
65
|
+
checkWorksheets(ctx);
|
|
66
|
+
}
|
|
67
|
+
if (checkChartStructure) {
|
|
68
|
+
checkChart(ctx);
|
|
69
|
+
checkDrawing(ctx);
|
|
70
|
+
checkChartsheet(ctx);
|
|
71
|
+
checkPivot(ctx);
|
|
72
|
+
checkTables(ctx);
|
|
73
|
+
checkChartSidecars(ctx);
|
|
74
|
+
}
|
|
75
|
+
if (checkStylesIntegrity) {
|
|
76
|
+
checkStyles(ctx);
|
|
77
|
+
}
|
|
78
|
+
const stats = computeStats(entries);
|
|
79
|
+
return {
|
|
80
|
+
ok: !reporter.hasErrors,
|
|
81
|
+
problems: reporter.problems,
|
|
82
|
+
stats
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function computeStats(entries) {
|
|
86
|
+
let entryCount = 0;
|
|
87
|
+
let xmlLikeCount = 0;
|
|
88
|
+
let relsCount = 0;
|
|
89
|
+
for (const [, entry] of entries) {
|
|
90
|
+
if (entry.type === "directory") {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
entryCount++;
|
|
94
|
+
if (isXmlLike(entry.path)) {
|
|
95
|
+
xmlLikeCount++;
|
|
96
|
+
}
|
|
97
|
+
if (entry.path.endsWith(".rels")) {
|
|
98
|
+
relsCount++;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return { entryCount, xmlLikeCount, relsCount };
|
|
102
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path helpers shared across all validator checkers.
|
|
3
|
+
*
|
|
4
|
+
* All paths are handled as **forward-slash POSIX strings** because that is
|
|
5
|
+
* how OPC part names are defined. We never touch the host's path separator.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Strip a single leading `/` if present. OPC `PartName` values start with
|
|
9
|
+
* `/` by spec, but zip entries do not.
|
|
10
|
+
*/
|
|
11
|
+
export function stripLeadingSlash(p) {
|
|
12
|
+
return p.startsWith("/") ? p.slice(1) : p;
|
|
13
|
+
}
|
|
14
|
+
/** `.xml`, `.rels`, or `.vml` — the payloads we parse as XML. */
|
|
15
|
+
export function isXmlLike(pathName) {
|
|
16
|
+
return pathName.endsWith(".xml") || pathName.endsWith(".rels") || pathName.endsWith(".vml");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Directory in which a relationships part's **source** part lives. OPC
|
|
20
|
+
* resolves rel Targets relative to the source part's directory, NOT the
|
|
21
|
+
* `.rels` file's directory. Examples:
|
|
22
|
+
*
|
|
23
|
+
* | .rels path | source dir |
|
|
24
|
+
* |-----------------------------------------|---------------------|
|
|
25
|
+
* | `_rels/.rels` | `` |
|
|
26
|
+
* | `xl/_rels/workbook.xml.rels` | `xl` |
|
|
27
|
+
* | `xl/worksheets/_rels/sheet1.xml.rels` | `xl/worksheets` |
|
|
28
|
+
*/
|
|
29
|
+
export function getRelsSourceDir(relsPath) {
|
|
30
|
+
if (relsPath === "_rels/.rels") {
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
const marker = "/_rels/";
|
|
34
|
+
const idx = relsPath.indexOf(marker);
|
|
35
|
+
if (idx === -1) {
|
|
36
|
+
return relsPath.includes("/") ? relsPath.slice(0, relsPath.lastIndexOf("/")) : "";
|
|
37
|
+
}
|
|
38
|
+
return relsPath.slice(0, idx);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Basename without directory, e.g. `xl/foo/bar.xml` → `bar.xml`.
|
|
42
|
+
*/
|
|
43
|
+
export function posixBasename(p) {
|
|
44
|
+
const idx = p.lastIndexOf("/");
|
|
45
|
+
return idx === -1 ? p : p.slice(idx + 1);
|
|
46
|
+
}
|
|
47
|
+
/** Extension without the leading dot, lowercase. `""` when missing. */
|
|
48
|
+
export function getExtension(p) {
|
|
49
|
+
const base = posixBasename(p);
|
|
50
|
+
const idx = base.lastIndexOf(".");
|
|
51
|
+
return idx === -1 ? "" : base.slice(idx + 1).toLowerCase();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolve a relationship Target against a .rels path. Handles absolute
|
|
55
|
+
* targets starting with `/` (relative to package root), `../` traversal,
|
|
56
|
+
* `./`, and plain relative segments. Never returns a leading slash.
|
|
57
|
+
*
|
|
58
|
+
* We do NOT use `node:path` so this module is usable in browsers.
|
|
59
|
+
*/
|
|
60
|
+
export function resolveRelTarget(relsPath, target) {
|
|
61
|
+
// Absolute-in-package targets start with "/".
|
|
62
|
+
if (target.startsWith("/")) {
|
|
63
|
+
return normalizeSegments(target.split("/"));
|
|
64
|
+
}
|
|
65
|
+
const baseDir = getRelsSourceDir(relsPath);
|
|
66
|
+
const segments = [];
|
|
67
|
+
if (baseDir) {
|
|
68
|
+
segments.push(...baseDir.split("/"));
|
|
69
|
+
}
|
|
70
|
+
segments.push(...target.split("/"));
|
|
71
|
+
return normalizeSegments(segments);
|
|
72
|
+
}
|
|
73
|
+
function normalizeSegments(segments) {
|
|
74
|
+
const out = [];
|
|
75
|
+
let escaped = false;
|
|
76
|
+
for (const seg of segments) {
|
|
77
|
+
if (seg === "" || seg === ".") {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (seg === "..") {
|
|
81
|
+
if (out.length === 0) {
|
|
82
|
+
// Record traversal past the package root — caller's job to flag it.
|
|
83
|
+
escaped = true;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
out.pop();
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
out.push(seg);
|
|
91
|
+
}
|
|
92
|
+
const joined = out.join("/");
|
|
93
|
+
return escaped ? `../${joined}` : joined;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* `false` when a resolved rel target escapes the package root. Targets
|
|
97
|
+
* that escape are malicious or accidentally produced by broken
|
|
98
|
+
* serialisers and always indicate a corrupt package.
|
|
99
|
+
*/
|
|
100
|
+
export function isSafeResolvedPath(resolved) {
|
|
101
|
+
return !(resolved === ".." || resolved.startsWith("../") || resolved.includes("/../"));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Derive the .rels path for a given source part. Symmetric with
|
|
105
|
+
* `getRelsSourceDir`. Examples:
|
|
106
|
+
*
|
|
107
|
+
* | source part | rels path |
|
|
108
|
+
* |--------------------------------|----------------------------------------|
|
|
109
|
+
* | `xl/workbook.xml` | `xl/_rels/workbook.xml.rels` |
|
|
110
|
+
* | `xl/worksheets/sheet1.xml` | `xl/worksheets/_rels/sheet1.xml.rels` |
|
|
111
|
+
*/
|
|
112
|
+
export function relsPathForPart(partPath) {
|
|
113
|
+
const base = posixBasename(partPath);
|
|
114
|
+
const dir = partPath.length > base.length ? partPath.slice(0, partPath.length - base.length - 1) : "";
|
|
115
|
+
return dir ? `${dir}/_rels/${base}.rels` : `_rels/${base}.rels`;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Inverse of {@link relsPathForPart}: source part for a given rels file.
|
|
119
|
+
* Returns undefined for the root rels (which has no conventional source).
|
|
120
|
+
*/
|
|
121
|
+
export function sourcePartForRels(relsPath) {
|
|
122
|
+
if (relsPath === "_rels/.rels") {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const base = posixBasename(relsPath);
|
|
126
|
+
if (!base.endsWith(".rels")) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
const srcDir = getRelsSourceDir(relsPath);
|
|
130
|
+
const sourceName = base.slice(0, -".rels".length);
|
|
131
|
+
return srcDir ? `${srcDir}/${sourceName}` : sourceName;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Part name satisfies OPC PartName grammar — not empty, uses only safe
|
|
135
|
+
* characters, does not end with `/` and does not contain `.` or `..`
|
|
136
|
+
* segments. We do not validate the full grammar but cover the cases that
|
|
137
|
+
* break Excel in practice.
|
|
138
|
+
*/
|
|
139
|
+
export function isLegalPartName(partName) {
|
|
140
|
+
if (!partName) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
if (partName.endsWith("/")) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
if (/[\\:*?"<>|]/.test(partName)) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
const segments = partName.split("/");
|
|
150
|
+
for (const seg of segments) {
|
|
151
|
+
if (seg === "" || seg === "." || seg === "..") {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Problem reporter shared by all checkers.
|
|
3
|
+
*
|
|
4
|
+
* Two responsibilities:
|
|
5
|
+
* 1. Filter warnings when `includeWarnings` is `false`.
|
|
6
|
+
* 2. Short-circuit after `maxProblems` is reached.
|
|
7
|
+
*
|
|
8
|
+
* The reporter does not sort or dedupe — checkers are expected to emit at
|
|
9
|
+
* most one problem per logical issue. Callers get problems in encounter
|
|
10
|
+
* order, which is stable across runs for the same input.
|
|
11
|
+
*/
|
|
12
|
+
export class Reporter {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.problems = [];
|
|
15
|
+
this.errorCount = 0;
|
|
16
|
+
this.maxProblems = options.maxProblems;
|
|
17
|
+
this.includeWarnings = options.includeWarnings ?? false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `true` once the configured `maxProblems` cap is reached. Checkers
|
|
21
|
+
* should consult this at the top of their per-part loops to avoid
|
|
22
|
+
* doing unnecessary work.
|
|
23
|
+
*/
|
|
24
|
+
get capped() {
|
|
25
|
+
return this.maxProblems !== undefined && this.problems.length >= this.maxProblems;
|
|
26
|
+
}
|
|
27
|
+
get hasErrors() {
|
|
28
|
+
return this.errorCount > 0;
|
|
29
|
+
}
|
|
30
|
+
/** Report an error-severity problem. */
|
|
31
|
+
error(kind, message, file) {
|
|
32
|
+
this.push({ kind, severity: "error", message, file });
|
|
33
|
+
this.errorCount += this.capped ? 0 : 1;
|
|
34
|
+
}
|
|
35
|
+
/** Report a warning-severity problem. Only recorded if includeWarnings. */
|
|
36
|
+
warning(kind, message, file) {
|
|
37
|
+
if (!this.includeWarnings) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.push({ kind, severity: "warning", message, file });
|
|
41
|
+
}
|
|
42
|
+
push(problem) {
|
|
43
|
+
if (this.maxProblems !== undefined && this.problems.length >= this.maxProblems) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.problems.push(problem);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Convenience alias for the legacy `severity` argument used in the old
|
|
51
|
+
* flat API. Kept for internal checker code that wants to produce a
|
|
52
|
+
* problem with a runtime-chosen severity.
|
|
53
|
+
*/
|
|
54
|
+
export function reportWithSeverity(reporter, severity, kind, message, file) {
|
|
55
|
+
if (severity === "error") {
|
|
56
|
+
reporter.error(kind, message, file);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
reporter.warning(kind, message, file);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the OOXML validator.
|
|
3
|
+
*
|
|
4
|
+
* The validator's job is to detect xlsx packages that Excel will refuse to
|
|
5
|
+
* open (or silently repair). Each check emits zero or more `Problem` entries
|
|
6
|
+
* tagged by `kind`; callers can branch on `kind` for structured handling.
|
|
7
|
+
*
|
|
8
|
+
* Problem kinds are grouped by subsystem to make ad-hoc extension easy.
|
|
9
|
+
* New kinds MUST be added to the union below so consumers can enumerate them
|
|
10
|
+
* at the type level. Removing or renaming kinds is a breaking change.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XML helpers that tolerate namespace prefixes.
|
|
3
|
+
*
|
|
4
|
+
* OOXML serialisers are allowed to write `<drawing>` or `<x:drawing>` —
|
|
5
|
+
* both are legal in the same schema. All validator checks must therefore
|
|
6
|
+
* match on the **local name**, not the prefixed name. These helpers also
|
|
7
|
+
* tolerate namespaced attributes like `r:id` vs `ns0:id`.
|
|
8
|
+
*/
|
|
9
|
+
import { findChildren, parseXml, walk } from "../../../xml/dom.js";
|
|
10
|
+
/**
|
|
11
|
+
* Extract the local name from a tag name, i.e. the part after the last `:`.
|
|
12
|
+
* For `drawing` returns `drawing`; for `x:drawing` returns `drawing`.
|
|
13
|
+
*/
|
|
14
|
+
export function localName(name) {
|
|
15
|
+
const idx = name.lastIndexOf(":");
|
|
16
|
+
return idx === -1 ? name : name.slice(idx + 1);
|
|
17
|
+
}
|
|
18
|
+
/** Namespace-insensitive element-name equality. */
|
|
19
|
+
export function matchesLocal(name, target) {
|
|
20
|
+
return localName(name) === target;
|
|
21
|
+
}
|
|
22
|
+
/** Find first child element with matching **local** name. */
|
|
23
|
+
export function findChildLocal(el, local) {
|
|
24
|
+
for (const child of el.children) {
|
|
25
|
+
if (child.type === "element" && matchesLocal(child.name, local)) {
|
|
26
|
+
return child;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
/** Find all child elements with matching **local** name. */
|
|
32
|
+
export function findChildrenLocal(el, local) {
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const child of el.children) {
|
|
35
|
+
if (child.type === "element" && matchesLocal(child.name, local)) {
|
|
36
|
+
out.push(child);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
/** `true` when any descendant (or self) has matching local name. */
|
|
42
|
+
export function hasDescendantLocal(root, local) {
|
|
43
|
+
if (matchesLocal(root.name, local)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
let found = false;
|
|
47
|
+
walk(root, child => {
|
|
48
|
+
if (!found && matchesLocal(child.name, local)) {
|
|
49
|
+
found = true;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return found;
|
|
53
|
+
}
|
|
54
|
+
/** Collect all descendants (including self) matching local name. */
|
|
55
|
+
export function collectDescendantsLocal(root, local) {
|
|
56
|
+
const out = [];
|
|
57
|
+
if (matchesLocal(root.name, local)) {
|
|
58
|
+
out.push(root);
|
|
59
|
+
}
|
|
60
|
+
walk(root, child => {
|
|
61
|
+
if (child !== root && matchesLocal(child.name, local)) {
|
|
62
|
+
out.push(child);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Read an attribute by local name. The OOXML convention is to use
|
|
69
|
+
* namespaced attributes like `r:id` but some serialisers strip or
|
|
70
|
+
* renumber the prefix. We match by suffix `:<local>` or exact `local`.
|
|
71
|
+
*/
|
|
72
|
+
export function attrByLocalName(el, local) {
|
|
73
|
+
const direct = el.attributes[local];
|
|
74
|
+
if (direct !== undefined) {
|
|
75
|
+
return direct;
|
|
76
|
+
}
|
|
77
|
+
for (const key in el.attributes) {
|
|
78
|
+
const idx = key.lastIndexOf(":");
|
|
79
|
+
if (idx !== -1 && key.slice(idx + 1) === local) {
|
|
80
|
+
return el.attributes[key];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Parse an XML string into a DOM tree. Returns `undefined` and records the
|
|
87
|
+
* failure as a malformed XML problem via `onMalformed`. We don't throw
|
|
88
|
+
* because validators must continue after a parse failure.
|
|
89
|
+
*/
|
|
90
|
+
export function tryParseXml(xml, onMalformed) {
|
|
91
|
+
try {
|
|
92
|
+
return parseXml(xml);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
onMalformed(err instanceof Error ? err : new Error(String(err)));
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Re-export commonly used primitives so checkers only need one import.
|
|
100
|
+
export { findChildren };
|