@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,782 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCX Module - HTML Renderer
|
|
3
|
+
*
|
|
4
|
+
* Converts a DocxDocument model to semantic HTML5.
|
|
5
|
+
* Supports paragraphs, runs with formatting, tables, lists, images, hyperlinks,
|
|
6
|
+
* headings, comments, footnotes/endnotes, and more.
|
|
7
|
+
*/
|
|
8
|
+
import { resolveThemeColor } from "./document.js";
|
|
9
|
+
import { bytesToBase64 } from "./internal-utils.js";
|
|
10
|
+
/**
|
|
11
|
+
* Convert a DocxDocument to HTML.
|
|
12
|
+
*/
|
|
13
|
+
export function renderToHtml(doc, options) {
|
|
14
|
+
const opts = {
|
|
15
|
+
includeStyles: options?.includeStyles ?? true,
|
|
16
|
+
fullDocument: options?.fullDocument ?? true,
|
|
17
|
+
title: options?.title ?? doc.coreProperties?.title ?? "Document",
|
|
18
|
+
imageMode: options?.imageMode ?? "dataUrl",
|
|
19
|
+
includeComments: options?.includeComments ?? false,
|
|
20
|
+
includeNotes: options?.includeNotes ?? true,
|
|
21
|
+
classPrefix: options?.classPrefix ?? "docx-"
|
|
22
|
+
};
|
|
23
|
+
const state = {
|
|
24
|
+
options: opts,
|
|
25
|
+
doc,
|
|
26
|
+
imageMap: new Map(),
|
|
27
|
+
rIdToImage: new Map(),
|
|
28
|
+
warnings: [],
|
|
29
|
+
listStack: [],
|
|
30
|
+
html: [],
|
|
31
|
+
footnoteRefs: new Map(),
|
|
32
|
+
endnoteRefs: new Map()
|
|
33
|
+
};
|
|
34
|
+
// Build image map
|
|
35
|
+
if (doc.images) {
|
|
36
|
+
for (const img of doc.images) {
|
|
37
|
+
if (img.rId) {
|
|
38
|
+
state.rIdToImage.set(img.rId, img);
|
|
39
|
+
}
|
|
40
|
+
if (opts.imageMode === "dataUrl") {
|
|
41
|
+
state.imageMap.set(img.fileName, imageToDataUrl(img));
|
|
42
|
+
}
|
|
43
|
+
else if (opts.imageMode === "filename") {
|
|
44
|
+
state.imageMap.set(img.fileName, img.fileName);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (opts.fullDocument) {
|
|
49
|
+
state.html.push("<!DOCTYPE html>");
|
|
50
|
+
state.html.push(`<html lang="en">`);
|
|
51
|
+
state.html.push("<head>");
|
|
52
|
+
state.html.push(`<meta charset="UTF-8">`);
|
|
53
|
+
state.html.push(`<title>${escapeHtml(opts.title)}</title>`);
|
|
54
|
+
if (opts.includeStyles) {
|
|
55
|
+
state.html.push(`<style>${generateCss(opts.classPrefix, doc.theme)}</style>`);
|
|
56
|
+
}
|
|
57
|
+
state.html.push("</head>");
|
|
58
|
+
state.html.push("<body>");
|
|
59
|
+
}
|
|
60
|
+
state.html.push(`<div class="${opts.classPrefix}document">`);
|
|
61
|
+
// Render body content
|
|
62
|
+
for (const item of doc.body) {
|
|
63
|
+
renderBodyContent(state, item);
|
|
64
|
+
}
|
|
65
|
+
closeOpenLists(state);
|
|
66
|
+
// Footnotes
|
|
67
|
+
if (opts.includeNotes && doc.footnotes && doc.footnotes.length > 0) {
|
|
68
|
+
state.html.push(`<hr class="${opts.classPrefix}footnote-separator"/>`);
|
|
69
|
+
state.html.push(`<aside class="${opts.classPrefix}footnotes">`);
|
|
70
|
+
state.html.push("<h2>Footnotes</h2>");
|
|
71
|
+
state.html.push("<ol>");
|
|
72
|
+
for (const note of doc.footnotes) {
|
|
73
|
+
if (note.id <= 0) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
state.html.push(`<li id="footnote-${note.id}">`);
|
|
77
|
+
for (const p of note.content) {
|
|
78
|
+
renderBodyContent(state, p);
|
|
79
|
+
}
|
|
80
|
+
state.html.push("</li>");
|
|
81
|
+
}
|
|
82
|
+
state.html.push("</ol>");
|
|
83
|
+
state.html.push("</aside>");
|
|
84
|
+
}
|
|
85
|
+
// Endnotes
|
|
86
|
+
if (opts.includeNotes && doc.endnotes && doc.endnotes.length > 0) {
|
|
87
|
+
state.html.push(`<hr class="${opts.classPrefix}endnote-separator"/>`);
|
|
88
|
+
state.html.push(`<aside class="${opts.classPrefix}endnotes">`);
|
|
89
|
+
state.html.push("<h2>Endnotes</h2>");
|
|
90
|
+
state.html.push("<ol>");
|
|
91
|
+
for (const note of doc.endnotes) {
|
|
92
|
+
if (note.id <= 0) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
state.html.push(`<li id="endnote-${note.id}">`);
|
|
96
|
+
for (const p of note.content) {
|
|
97
|
+
renderBodyContent(state, p);
|
|
98
|
+
}
|
|
99
|
+
state.html.push("</li>");
|
|
100
|
+
}
|
|
101
|
+
state.html.push("</ol>");
|
|
102
|
+
state.html.push("</aside>");
|
|
103
|
+
}
|
|
104
|
+
state.html.push("</div>");
|
|
105
|
+
if (opts.fullDocument) {
|
|
106
|
+
state.html.push("</body>");
|
|
107
|
+
state.html.push("</html>");
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
html: state.html.join("\n"),
|
|
111
|
+
warnings: state.warnings,
|
|
112
|
+
images: state.imageMap
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// =============================================================================
|
|
116
|
+
// Body Content
|
|
117
|
+
// =============================================================================
|
|
118
|
+
function renderBodyContent(state, item) {
|
|
119
|
+
if (!("type" in item)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
switch (item.type) {
|
|
123
|
+
case "paragraph":
|
|
124
|
+
renderParagraph(state, item);
|
|
125
|
+
break;
|
|
126
|
+
case "table":
|
|
127
|
+
closeOpenLists(state);
|
|
128
|
+
renderTable(state, item);
|
|
129
|
+
break;
|
|
130
|
+
case "floatingImage":
|
|
131
|
+
closeOpenLists(state);
|
|
132
|
+
renderFloatingImageHtml(state, item);
|
|
133
|
+
break;
|
|
134
|
+
case "textBox":
|
|
135
|
+
closeOpenLists(state);
|
|
136
|
+
renderTextBoxHtml(state, item);
|
|
137
|
+
break;
|
|
138
|
+
case "sdt":
|
|
139
|
+
renderSdtHtml(state, item);
|
|
140
|
+
break;
|
|
141
|
+
case "math":
|
|
142
|
+
closeOpenLists(state);
|
|
143
|
+
state.warnings.push("Math content not fully supported in HTML output");
|
|
144
|
+
state.html.push(`<span class="${state.options.classPrefix}math" aria-label="equation">[equation]</span>`);
|
|
145
|
+
break;
|
|
146
|
+
case "tableOfContents":
|
|
147
|
+
// Render TOC as placeholder - user would regenerate
|
|
148
|
+
closeOpenLists(state);
|
|
149
|
+
state.html.push(`<nav class="${state.options.classPrefix}toc">`);
|
|
150
|
+
if (item.cachedParagraphs) {
|
|
151
|
+
for (const p of item.cachedParagraphs) {
|
|
152
|
+
renderBodyContent(state, p);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
state.html.push("</nav>");
|
|
156
|
+
break;
|
|
157
|
+
case "drawingShape":
|
|
158
|
+
closeOpenLists(state);
|
|
159
|
+
state.warnings.push("DrawingML shapes rendered as placeholder");
|
|
160
|
+
state.html.push(`<div class="${state.options.classPrefix}shape">[${item.shapeType}]</div>`);
|
|
161
|
+
break;
|
|
162
|
+
case "chart":
|
|
163
|
+
closeOpenLists(state);
|
|
164
|
+
state.html.push(`<figure class="${state.options.classPrefix}chart">`);
|
|
165
|
+
if (item.chart.title) {
|
|
166
|
+
state.html.push(`<figcaption>${escapeHtml(item.chart.title)}</figcaption>`);
|
|
167
|
+
}
|
|
168
|
+
state.html.push(`<div class="${state.options.classPrefix}chart-placeholder">[${item.chart.type} chart: ${item.chart.series.length} series]</div>`);
|
|
169
|
+
state.html.push("</figure>");
|
|
170
|
+
break;
|
|
171
|
+
case "checkBox":
|
|
172
|
+
closeOpenLists(state);
|
|
173
|
+
state.html.push(`<input type="checkbox" ${item.checked ? "checked" : ""} disabled />`);
|
|
174
|
+
break;
|
|
175
|
+
case "opaqueDrawing":
|
|
176
|
+
// Skip opaque drawings in HTML
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// =============================================================================
|
|
181
|
+
// Paragraph
|
|
182
|
+
// =============================================================================
|
|
183
|
+
function renderParagraph(state, para) {
|
|
184
|
+
const props = para.properties;
|
|
185
|
+
const prefix = state.options.classPrefix;
|
|
186
|
+
// Check if this is a list item
|
|
187
|
+
if (props?.numbering) {
|
|
188
|
+
const listInfo = getListInfo(state.doc, props.numbering.numId, props.numbering.level);
|
|
189
|
+
if (listInfo) {
|
|
190
|
+
openListIfNeeded(state, props.numbering.numId, props.numbering.level, listInfo.format);
|
|
191
|
+
state.html.push(`<li>`);
|
|
192
|
+
renderParagraphInline(state, para);
|
|
193
|
+
state.html.push("</li>");
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
closeOpenLists(state);
|
|
198
|
+
// Determine tag based on style/outline
|
|
199
|
+
let tag = "p";
|
|
200
|
+
if (props?.style) {
|
|
201
|
+
const styleId = props.style.toLowerCase();
|
|
202
|
+
if (styleId === "heading1" || styleId === "heading 1" || styleId === "title") {
|
|
203
|
+
tag = "h1";
|
|
204
|
+
}
|
|
205
|
+
else if (styleId === "heading2" || styleId === "heading 2") {
|
|
206
|
+
tag = "h2";
|
|
207
|
+
}
|
|
208
|
+
else if (styleId === "heading3" || styleId === "heading 3") {
|
|
209
|
+
tag = "h3";
|
|
210
|
+
}
|
|
211
|
+
else if (styleId === "heading4" || styleId === "heading 4") {
|
|
212
|
+
tag = "h4";
|
|
213
|
+
}
|
|
214
|
+
else if (styleId === "heading5" || styleId === "heading 5") {
|
|
215
|
+
tag = "h5";
|
|
216
|
+
}
|
|
217
|
+
else if (styleId === "heading6" || styleId === "heading 6") {
|
|
218
|
+
tag = "h6";
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (props?.outlineLevel !== undefined && props.outlineLevel >= 0 && props.outlineLevel < 6) {
|
|
222
|
+
tag = `h${props.outlineLevel + 1}`;
|
|
223
|
+
}
|
|
224
|
+
// Build inline style
|
|
225
|
+
const styles = [];
|
|
226
|
+
if (props?.alignment) {
|
|
227
|
+
const alignMap = {
|
|
228
|
+
left: "left",
|
|
229
|
+
right: "right",
|
|
230
|
+
center: "center",
|
|
231
|
+
both: "justify",
|
|
232
|
+
justify: "justify",
|
|
233
|
+
distribute: "justify"
|
|
234
|
+
};
|
|
235
|
+
const ta = alignMap[props.alignment];
|
|
236
|
+
if (ta) {
|
|
237
|
+
styles.push(`text-align:${ta}`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (props?.indent) {
|
|
241
|
+
if (props.indent.left !== undefined) {
|
|
242
|
+
styles.push(`margin-left:${twipsToPx(props.indent.left)}px`);
|
|
243
|
+
}
|
|
244
|
+
if (props.indent.right !== undefined) {
|
|
245
|
+
styles.push(`margin-right:${twipsToPx(props.indent.right)}px`);
|
|
246
|
+
}
|
|
247
|
+
if (props.indent.firstLine !== undefined) {
|
|
248
|
+
styles.push(`text-indent:${twipsToPx(props.indent.firstLine)}px`);
|
|
249
|
+
}
|
|
250
|
+
if (props.indent.hanging !== undefined) {
|
|
251
|
+
styles.push(`text-indent:-${twipsToPx(props.indent.hanging)}px`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (props?.spacing) {
|
|
255
|
+
if (props.spacing.before !== undefined) {
|
|
256
|
+
styles.push(`margin-top:${twipsToPx(props.spacing.before)}px`);
|
|
257
|
+
}
|
|
258
|
+
if (props.spacing.after !== undefined) {
|
|
259
|
+
styles.push(`margin-bottom:${twipsToPx(props.spacing.after)}px`);
|
|
260
|
+
}
|
|
261
|
+
if (props.spacing.line !== undefined) {
|
|
262
|
+
styles.push(`line-height:${props.spacing.line / 240}`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (props?.shading?.fill) {
|
|
266
|
+
styles.push(`background-color:#${props.shading.fill}`);
|
|
267
|
+
}
|
|
268
|
+
if (props?.bidi) {
|
|
269
|
+
styles.push(`direction:rtl`);
|
|
270
|
+
}
|
|
271
|
+
const styleAttr = styles.length > 0 ? ` style="${styles.join(";")}"` : "";
|
|
272
|
+
const classAttr = props?.style ? ` class="${prefix}style-${escapeClassName(props.style)}"` : "";
|
|
273
|
+
state.html.push(`<${tag}${classAttr}${styleAttr}>`);
|
|
274
|
+
renderParagraphInline(state, para);
|
|
275
|
+
state.html.push(`</${tag}>`);
|
|
276
|
+
}
|
|
277
|
+
function renderParagraphInline(state, para) {
|
|
278
|
+
for (const child of para.children) {
|
|
279
|
+
renderParagraphChild(state, child);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function renderParagraphChild(state, child) {
|
|
283
|
+
if ("type" in child) {
|
|
284
|
+
switch (child.type) {
|
|
285
|
+
case "hyperlink":
|
|
286
|
+
renderHyperlinkHtml(state, child);
|
|
287
|
+
return;
|
|
288
|
+
case "bookmarkStart":
|
|
289
|
+
state.html.push(`<a id="bookmark-${child.id}" data-name="${escapeHtml(child.name)}"></a>`);
|
|
290
|
+
return;
|
|
291
|
+
case "bookmarkEnd":
|
|
292
|
+
return;
|
|
293
|
+
case "commentRangeStart":
|
|
294
|
+
case "commentRangeEnd":
|
|
295
|
+
case "commentReference":
|
|
296
|
+
return;
|
|
297
|
+
case "insertedRun":
|
|
298
|
+
state.html.push(`<ins data-author="${escapeHtml(child.revision.author)}" data-date="${escapeHtml(child.revision.date ?? "")}">`);
|
|
299
|
+
renderRun(state, child.run);
|
|
300
|
+
state.html.push("</ins>");
|
|
301
|
+
return;
|
|
302
|
+
case "deletedRun":
|
|
303
|
+
state.html.push(`<del data-author="${escapeHtml(child.revision.author)}" data-date="${escapeHtml(child.revision.date ?? "")}">`);
|
|
304
|
+
renderRun(state, child.run);
|
|
305
|
+
state.html.push("</del>");
|
|
306
|
+
return;
|
|
307
|
+
case "movedFromRun":
|
|
308
|
+
state.html.push(`<del class="${state.options.classPrefix}move-from">`);
|
|
309
|
+
renderRun(state, child.run);
|
|
310
|
+
state.html.push("</del>");
|
|
311
|
+
return;
|
|
312
|
+
case "movedToRun":
|
|
313
|
+
state.html.push(`<ins class="${state.options.classPrefix}move-to">`);
|
|
314
|
+
renderRun(state, child.run);
|
|
315
|
+
state.html.push("</ins>");
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// Run (no type discriminator)
|
|
320
|
+
if ("content" in child && !("type" in child)) {
|
|
321
|
+
renderRun(state, child);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function renderHyperlinkHtml(state, link) {
|
|
325
|
+
let href = "";
|
|
326
|
+
if (link.url) {
|
|
327
|
+
href = link.url;
|
|
328
|
+
}
|
|
329
|
+
else if (link.anchor) {
|
|
330
|
+
href = `#bookmark-${link.anchor}`;
|
|
331
|
+
}
|
|
332
|
+
const attrs = [];
|
|
333
|
+
if (href) {
|
|
334
|
+
attrs.push(`href="${escapeHtml(href)}"`);
|
|
335
|
+
}
|
|
336
|
+
if (link.tooltip) {
|
|
337
|
+
attrs.push(`title="${escapeHtml(link.tooltip)}"`);
|
|
338
|
+
}
|
|
339
|
+
state.html.push(`<a ${attrs.join(" ")}>`);
|
|
340
|
+
for (const ch of link.children) {
|
|
341
|
+
renderParagraphChild(state, ch);
|
|
342
|
+
}
|
|
343
|
+
state.html.push("</a>");
|
|
344
|
+
}
|
|
345
|
+
// =============================================================================
|
|
346
|
+
// Run
|
|
347
|
+
// =============================================================================
|
|
348
|
+
function renderRun(state, run) {
|
|
349
|
+
const rPr = run.properties;
|
|
350
|
+
// Build tag stack based on formatting
|
|
351
|
+
const tags = [];
|
|
352
|
+
const styles = [];
|
|
353
|
+
if (rPr) {
|
|
354
|
+
if (rPr.bold) {
|
|
355
|
+
tags.push("strong");
|
|
356
|
+
}
|
|
357
|
+
if (rPr.italic) {
|
|
358
|
+
tags.push("em");
|
|
359
|
+
}
|
|
360
|
+
if (rPr.underline) {
|
|
361
|
+
const uStyle = typeof rPr.underline === "object" ? rPr.underline.style : rPr.underline;
|
|
362
|
+
if (uStyle !== "none") {
|
|
363
|
+
tags.push("u");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (rPr.strike) {
|
|
367
|
+
tags.push("s");
|
|
368
|
+
}
|
|
369
|
+
if (rPr.vertAlign === "superscript") {
|
|
370
|
+
tags.push("sup");
|
|
371
|
+
}
|
|
372
|
+
else if (rPr.vertAlign === "subscript") {
|
|
373
|
+
tags.push("sub");
|
|
374
|
+
}
|
|
375
|
+
if (rPr.smallCaps) {
|
|
376
|
+
styles.push("font-variant:small-caps");
|
|
377
|
+
}
|
|
378
|
+
if (rPr.caps) {
|
|
379
|
+
styles.push("text-transform:uppercase");
|
|
380
|
+
}
|
|
381
|
+
if (rPr.color) {
|
|
382
|
+
const color = resolveColor(rPr.color, state.doc.theme);
|
|
383
|
+
if (color) {
|
|
384
|
+
styles.push(`color:#${color}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (rPr.highlight && rPr.highlight !== "none") {
|
|
388
|
+
styles.push(`background-color:${highlightToColor(rPr.highlight)}`);
|
|
389
|
+
}
|
|
390
|
+
if (rPr.shading?.fill) {
|
|
391
|
+
styles.push(`background-color:#${rPr.shading.fill}`);
|
|
392
|
+
}
|
|
393
|
+
if (rPr.size !== undefined) {
|
|
394
|
+
// size is half-points
|
|
395
|
+
styles.push(`font-size:${rPr.size / 2}pt`);
|
|
396
|
+
}
|
|
397
|
+
if (rPr.font) {
|
|
398
|
+
const fontName = typeof rPr.font === "string" ? rPr.font : (rPr.font.ascii ?? rPr.font.eastAsia);
|
|
399
|
+
if (fontName) {
|
|
400
|
+
styles.push(`font-family:"${fontName}"`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// Outermost <span> if styles, inner tags for semantic markup
|
|
405
|
+
if (styles.length > 0) {
|
|
406
|
+
state.html.push(`<span style="${styles.join(";")}">`);
|
|
407
|
+
}
|
|
408
|
+
for (const t of tags) {
|
|
409
|
+
state.html.push(`<${t}>`);
|
|
410
|
+
}
|
|
411
|
+
// Render run content
|
|
412
|
+
for (const content of run.content) {
|
|
413
|
+
renderRunContentHtml(state, content);
|
|
414
|
+
}
|
|
415
|
+
// Close tags in reverse
|
|
416
|
+
for (let i = tags.length - 1; i >= 0; i--) {
|
|
417
|
+
state.html.push(`</${tags[i]}>`);
|
|
418
|
+
}
|
|
419
|
+
if (styles.length > 0) {
|
|
420
|
+
state.html.push("</span>");
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function renderRunContentHtml(state, content) {
|
|
424
|
+
switch (content.type) {
|
|
425
|
+
case "text":
|
|
426
|
+
state.html.push(escapeHtml(content.text));
|
|
427
|
+
break;
|
|
428
|
+
case "break":
|
|
429
|
+
if (content.breakType === "page") {
|
|
430
|
+
state.html.push(`<span class="${state.options.classPrefix}page-break" style="page-break-before:always"></span>`);
|
|
431
|
+
}
|
|
432
|
+
else if (content.breakType === "column") {
|
|
433
|
+
state.html.push(`<span class="${state.options.classPrefix}column-break"></span>`);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
state.html.push("<br>");
|
|
437
|
+
}
|
|
438
|
+
break;
|
|
439
|
+
case "tab":
|
|
440
|
+
state.html.push('<span class="docx-tab" style="display:inline-block;min-width:2em"></span>');
|
|
441
|
+
break;
|
|
442
|
+
case "ptab":
|
|
443
|
+
state.html.push('<span class="docx-ptab"></span>');
|
|
444
|
+
break;
|
|
445
|
+
case "carriageReturn":
|
|
446
|
+
state.html.push("<br>");
|
|
447
|
+
break;
|
|
448
|
+
case "noBreakHyphen":
|
|
449
|
+
state.html.push("\u2011");
|
|
450
|
+
break;
|
|
451
|
+
case "softHyphen":
|
|
452
|
+
state.html.push("\u00AD");
|
|
453
|
+
break;
|
|
454
|
+
case "symbol":
|
|
455
|
+
// Convert hex char code to Unicode
|
|
456
|
+
try {
|
|
457
|
+
const code = parseInt(content.char, 16);
|
|
458
|
+
state.html.push(`<span style="font-family:${escapeHtml(content.font)}">${String.fromCodePoint(code)}</span>`);
|
|
459
|
+
}
|
|
460
|
+
catch {
|
|
461
|
+
state.html.push(escapeHtml(content.char));
|
|
462
|
+
}
|
|
463
|
+
break;
|
|
464
|
+
case "footnoteRef": {
|
|
465
|
+
const num = state.footnoteRefs.size + 1;
|
|
466
|
+
state.footnoteRefs.set(content.id, num);
|
|
467
|
+
state.html.push(`<sup><a href="#footnote-${content.id}" id="footnote-ref-${content.id}">${num}</a></sup>`);
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
case "endnoteRef": {
|
|
471
|
+
const num = state.endnoteRefs.size + 1;
|
|
472
|
+
state.endnoteRefs.set(content.id, num);
|
|
473
|
+
state.html.push(`<sup><a href="#endnote-${content.id}" id="endnote-ref-${content.id}">${num}</a></sup>`);
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
case "image":
|
|
477
|
+
renderInlineImageHtml(state, content);
|
|
478
|
+
break;
|
|
479
|
+
case "field":
|
|
480
|
+
// Use cached value if present
|
|
481
|
+
if (content.cachedValue) {
|
|
482
|
+
state.html.push(escapeHtml(content.cachedValue));
|
|
483
|
+
}
|
|
484
|
+
break;
|
|
485
|
+
case "ruby":
|
|
486
|
+
state.html.push("<ruby>");
|
|
487
|
+
for (const r of content.baseText) {
|
|
488
|
+
renderRun(state, r);
|
|
489
|
+
}
|
|
490
|
+
state.html.push("<rt>");
|
|
491
|
+
for (const r of content.rubyText) {
|
|
492
|
+
renderRun(state, r);
|
|
493
|
+
}
|
|
494
|
+
state.html.push("</rt></ruby>");
|
|
495
|
+
break;
|
|
496
|
+
case "lastRenderedPageBreak":
|
|
497
|
+
case "annotationReference":
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function renderInlineImageHtml(state, img) {
|
|
502
|
+
const imgDef = state.rIdToImage.get(img.rId);
|
|
503
|
+
if (!imgDef) {
|
|
504
|
+
state.warnings.push(`Image rId ${img.rId} not found`);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const src = state.imageMap.get(imgDef.fileName) ?? imgDef.fileName;
|
|
508
|
+
const w = emuToPx(img.width);
|
|
509
|
+
const h = emuToPx(img.height);
|
|
510
|
+
state.html.push(`<img src="${escapeHtml(src)}" width="${w}" height="${h}"${img.altText ? ` alt="${escapeHtml(img.altText)}"` : ""}/>`);
|
|
511
|
+
}
|
|
512
|
+
function renderFloatingImageHtml(state, img) {
|
|
513
|
+
const imgDef = state.rIdToImage.get(img.rId);
|
|
514
|
+
if (!imgDef) {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const src = state.imageMap.get(imgDef.fileName) ?? imgDef.fileName;
|
|
518
|
+
const w = emuToPx(img.width);
|
|
519
|
+
const h = emuToPx(img.height);
|
|
520
|
+
const style = img.wrap?.style === "square" ? "float:right;margin:10px" : "display:block;margin:10px 0";
|
|
521
|
+
state.html.push(`<img src="${escapeHtml(src)}" width="${w}" height="${h}" style="${style}"${img.altText ? ` alt="${escapeHtml(img.altText)}"` : ""}/>`);
|
|
522
|
+
}
|
|
523
|
+
// =============================================================================
|
|
524
|
+
// Table
|
|
525
|
+
// =============================================================================
|
|
526
|
+
function renderTable(state, table) {
|
|
527
|
+
const prefix = state.options.classPrefix;
|
|
528
|
+
state.html.push(`<table class="${prefix}table">`);
|
|
529
|
+
for (const row of table.rows) {
|
|
530
|
+
renderTableRow(state, row);
|
|
531
|
+
}
|
|
532
|
+
state.html.push("</table>");
|
|
533
|
+
}
|
|
534
|
+
function renderTableRow(state, row) {
|
|
535
|
+
const isHeader = row.properties?.tableHeader;
|
|
536
|
+
state.html.push(`<tr>`);
|
|
537
|
+
for (const cell of row.cells) {
|
|
538
|
+
renderTableCell(state, cell, isHeader ?? false);
|
|
539
|
+
}
|
|
540
|
+
state.html.push("</tr>");
|
|
541
|
+
}
|
|
542
|
+
function renderTableCell(state, cell, isHeader) {
|
|
543
|
+
const tag = isHeader ? "th" : "td";
|
|
544
|
+
const attrs = [];
|
|
545
|
+
const props = cell.properties;
|
|
546
|
+
if (props?.gridSpan && props.gridSpan > 1) {
|
|
547
|
+
attrs.push(`colspan="${props.gridSpan}"`);
|
|
548
|
+
}
|
|
549
|
+
if (props?.verticalMerge === "restart") {
|
|
550
|
+
// For rowspan detection, we would need to scan ahead; omitted for simplicity
|
|
551
|
+
}
|
|
552
|
+
const styles = [];
|
|
553
|
+
if (props?.shading?.fill) {
|
|
554
|
+
styles.push(`background-color:#${props.shading.fill}`);
|
|
555
|
+
}
|
|
556
|
+
if (props?.width) {
|
|
557
|
+
if (props.width.type === "dxa") {
|
|
558
|
+
styles.push(`width:${twipsToPx(props.width.value)}px`);
|
|
559
|
+
}
|
|
560
|
+
else if (props.width.type === "pct") {
|
|
561
|
+
styles.push(`width:${props.width.value / 50}%`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (props?.borders) {
|
|
565
|
+
for (const side of ["top", "right", "bottom", "left"]) {
|
|
566
|
+
const border = props.borders[side];
|
|
567
|
+
if (border) {
|
|
568
|
+
const bstyle = borderToCss(border);
|
|
569
|
+
if (bstyle) {
|
|
570
|
+
styles.push(`border-${side}:${bstyle}`);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (props?.verticalAlign) {
|
|
576
|
+
const vaMap = {
|
|
577
|
+
top: "top",
|
|
578
|
+
center: "middle",
|
|
579
|
+
bottom: "bottom"
|
|
580
|
+
};
|
|
581
|
+
const va = vaMap[props.verticalAlign];
|
|
582
|
+
if (va) {
|
|
583
|
+
styles.push(`vertical-align:${va}`);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (styles.length > 0) {
|
|
587
|
+
attrs.push(`style="${styles.join(";")}"`);
|
|
588
|
+
}
|
|
589
|
+
state.html.push(`<${tag}${attrs.length > 0 ? " " + attrs.join(" ") : ""}>`);
|
|
590
|
+
for (const item of cell.content) {
|
|
591
|
+
renderBodyContent(state, item);
|
|
592
|
+
}
|
|
593
|
+
closeOpenLists(state);
|
|
594
|
+
state.html.push(`</${tag}>`);
|
|
595
|
+
}
|
|
596
|
+
// =============================================================================
|
|
597
|
+
// TextBox
|
|
598
|
+
// =============================================================================
|
|
599
|
+
function renderTextBoxHtml(state, textBox) {
|
|
600
|
+
const prefix = state.options.classPrefix;
|
|
601
|
+
state.html.push(`<aside class="${prefix}textbox">`);
|
|
602
|
+
for (const p of textBox.content) {
|
|
603
|
+
renderParagraph(state, p);
|
|
604
|
+
}
|
|
605
|
+
state.html.push("</aside>");
|
|
606
|
+
}
|
|
607
|
+
// =============================================================================
|
|
608
|
+
// SDT
|
|
609
|
+
// =============================================================================
|
|
610
|
+
function renderSdtHtml(state, sdt) {
|
|
611
|
+
for (const child of sdt.content) {
|
|
612
|
+
if ("type" in child) {
|
|
613
|
+
if (child.type === "paragraph") {
|
|
614
|
+
renderParagraph(state, child);
|
|
615
|
+
}
|
|
616
|
+
else if (child.type === "table") {
|
|
617
|
+
renderTable(state, child);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
else if ("content" in child) {
|
|
621
|
+
// Run
|
|
622
|
+
state.html.push(`<span class="${state.options.classPrefix}sdt">`);
|
|
623
|
+
renderRun(state, child);
|
|
624
|
+
state.html.push("</span>");
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
// =============================================================================
|
|
629
|
+
// List Management
|
|
630
|
+
// =============================================================================
|
|
631
|
+
function getListInfo(doc, numId, level) {
|
|
632
|
+
const instance = doc.numberingInstances?.find(n => n.numId === numId);
|
|
633
|
+
if (!instance) {
|
|
634
|
+
return undefined;
|
|
635
|
+
}
|
|
636
|
+
const abstractNum = doc.abstractNumberings?.find(a => a.abstractNumId === instance.abstractNumId);
|
|
637
|
+
if (!abstractNum) {
|
|
638
|
+
return undefined;
|
|
639
|
+
}
|
|
640
|
+
const levelDef = abstractNum.levels.find(l => l.level === level);
|
|
641
|
+
if (!levelDef) {
|
|
642
|
+
return undefined;
|
|
643
|
+
}
|
|
644
|
+
return { format: levelDef.format };
|
|
645
|
+
}
|
|
646
|
+
function openListIfNeeded(state, numId, level, format) {
|
|
647
|
+
// Close lists that are too deep
|
|
648
|
+
while (state.listStack.length > 0) {
|
|
649
|
+
const top = state.listStack[state.listStack.length - 1];
|
|
650
|
+
if (top.level > level || (top.level === level && top.numId !== numId)) {
|
|
651
|
+
state.html.push(top.format === "bullet" ? "</ul>" : "</ol>");
|
|
652
|
+
state.listStack.pop();
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
break;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
// Open new lists if needed
|
|
659
|
+
const currentLevel = state.listStack.length > 0 ? state.listStack[state.listStack.length - 1].level : -1;
|
|
660
|
+
if (currentLevel < level || state.listStack.length === 0) {
|
|
661
|
+
while (state.listStack.length === 0 ||
|
|
662
|
+
state.listStack[state.listStack.length - 1].level < level) {
|
|
663
|
+
const newLevel = state.listStack.length === 0 ? 0 : state.listStack[state.listStack.length - 1].level + 1;
|
|
664
|
+
const tag = format === "bullet" ? "ul" : "ol";
|
|
665
|
+
state.html.push(`<${tag}>`);
|
|
666
|
+
state.listStack.push({ numId, level: newLevel, format });
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
function closeOpenLists(state) {
|
|
671
|
+
while (state.listStack.length > 0) {
|
|
672
|
+
const top = state.listStack.pop();
|
|
673
|
+
state.html.push(top.format === "bullet" ? "</ul>" : "</ol>");
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// =============================================================================
|
|
677
|
+
// Helpers
|
|
678
|
+
// =============================================================================
|
|
679
|
+
function escapeHtml(s) {
|
|
680
|
+
return s
|
|
681
|
+
.replace(/&/g, "&")
|
|
682
|
+
.replace(/</g, "<")
|
|
683
|
+
.replace(/>/g, ">")
|
|
684
|
+
.replace(/"/g, """)
|
|
685
|
+
.replace(/'/g, "'");
|
|
686
|
+
}
|
|
687
|
+
function escapeClassName(s) {
|
|
688
|
+
return s.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
689
|
+
}
|
|
690
|
+
function twipsToPx(twips) {
|
|
691
|
+
// 1 twip = 1/1440 inch, assuming 96 DPI => 1 inch = 96 px
|
|
692
|
+
return Math.round((twips / 1440) * 96);
|
|
693
|
+
}
|
|
694
|
+
function emuToPx(emu) {
|
|
695
|
+
// 1 inch = 914400 EMU, 96 DPI
|
|
696
|
+
return Math.round((emu / 914400) * 96);
|
|
697
|
+
}
|
|
698
|
+
function imageToDataUrl(img) {
|
|
699
|
+
const mime = {
|
|
700
|
+
png: "image/png",
|
|
701
|
+
jpeg: "image/jpeg",
|
|
702
|
+
jpg: "image/jpeg",
|
|
703
|
+
gif: "image/gif",
|
|
704
|
+
bmp: "image/bmp",
|
|
705
|
+
svg: "image/svg+xml",
|
|
706
|
+
webp: "image/webp",
|
|
707
|
+
tiff: "image/tiff"
|
|
708
|
+
};
|
|
709
|
+
const mediaType = mime[img.mediaType] ?? "application/octet-stream";
|
|
710
|
+
const base64 = bytesToBase64(img.data);
|
|
711
|
+
return `data:${mediaType};base64,${base64}`;
|
|
712
|
+
}
|
|
713
|
+
function resolveColor(color, theme) {
|
|
714
|
+
if (typeof color === "string") {
|
|
715
|
+
return color === "auto" ? undefined : color;
|
|
716
|
+
}
|
|
717
|
+
if (typeof color === "object" && color !== null) {
|
|
718
|
+
if (typeof color.value === "string") {
|
|
719
|
+
return color.value === "auto" ? undefined : color.value;
|
|
720
|
+
}
|
|
721
|
+
if (color.themeColor && theme) {
|
|
722
|
+
return resolveThemeColor(color, theme);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return undefined;
|
|
726
|
+
}
|
|
727
|
+
function highlightToColor(highlight) {
|
|
728
|
+
const map = {
|
|
729
|
+
black: "#000000",
|
|
730
|
+
blue: "#0000FF",
|
|
731
|
+
cyan: "#00FFFF",
|
|
732
|
+
green: "#00FF00",
|
|
733
|
+
magenta: "#FF00FF",
|
|
734
|
+
red: "#FF0000",
|
|
735
|
+
yellow: "#FFFF00",
|
|
736
|
+
white: "#FFFFFF",
|
|
737
|
+
darkBlue: "#000080",
|
|
738
|
+
darkCyan: "#008080",
|
|
739
|
+
darkGreen: "#008000",
|
|
740
|
+
darkMagenta: "#800080",
|
|
741
|
+
darkRed: "#800000",
|
|
742
|
+
darkYellow: "#808000",
|
|
743
|
+
darkGray: "#808080",
|
|
744
|
+
lightGray: "#C0C0C0"
|
|
745
|
+
};
|
|
746
|
+
return map[highlight] ?? "transparent";
|
|
747
|
+
}
|
|
748
|
+
function borderToCss(border) {
|
|
749
|
+
if (border.style === "none" || border.style === "nil") {
|
|
750
|
+
return "none";
|
|
751
|
+
}
|
|
752
|
+
const sizePt = border.size !== undefined ? border.size / 8 : 0.5;
|
|
753
|
+
const styleMap = {
|
|
754
|
+
single: "solid",
|
|
755
|
+
double: "double",
|
|
756
|
+
dashed: "dashed",
|
|
757
|
+
dotted: "dotted",
|
|
758
|
+
thick: "solid"
|
|
759
|
+
};
|
|
760
|
+
const cssStyle = styleMap[border.style] ?? "solid";
|
|
761
|
+
const color = border.color === "auto" || !border.color ? "#000" : `#${border.color}`;
|
|
762
|
+
return `${sizePt}pt ${cssStyle} ${color}`;
|
|
763
|
+
}
|
|
764
|
+
function generateCss(prefix, theme) {
|
|
765
|
+
return `
|
|
766
|
+
.${prefix}document { font-family: 'Calibri', 'Segoe UI', sans-serif; line-height: 1.15; max-width: 8.5in; margin: 1in auto; padding: 0 1in; }
|
|
767
|
+
.${prefix}document p { margin: 0 0 8pt 0; }
|
|
768
|
+
.${prefix}document h1, .${prefix}document h2, .${prefix}document h3 { margin-top: 12pt; margin-bottom: 8pt; font-weight: 600; }
|
|
769
|
+
.${prefix}table { border-collapse: collapse; margin: 8pt 0; }
|
|
770
|
+
.${prefix}table th, .${prefix}table td { padding: 4pt 8pt; }
|
|
771
|
+
.${prefix}textbox { border: 1px solid #ccc; padding: 8pt; margin: 8pt 0; }
|
|
772
|
+
.${prefix}footnotes, .${prefix}endnotes { font-size: 0.9em; margin-top: 2em; }
|
|
773
|
+
.${prefix}footnote-separator, .${prefix}endnote-separator { width: 30%; margin-left: 0; border: none; border-top: 1px solid #000; margin-top: 2em; }
|
|
774
|
+
.${prefix}tab { display: inline-block; min-width: 36pt; }
|
|
775
|
+
.${prefix}chart { margin: 12pt 0; }
|
|
776
|
+
.${prefix}move-from { text-decoration: line-through; color: #a00; }
|
|
777
|
+
.${prefix}move-to { text-decoration: underline; color: #0a0; }
|
|
778
|
+
ins { text-decoration: underline; color: #060; }
|
|
779
|
+
del { text-decoration: line-through; color: #600; }
|
|
780
|
+
ruby rt { font-size: 0.5em; }
|
|
781
|
+
`.trim();
|
|
782
|
+
}
|