@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,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Word-to-PDF Bridge
|
|
4
|
+
*
|
|
5
|
+
* Converts a Word document (DocxDocument) to PDF.
|
|
6
|
+
* Like excel-bridge.ts, this is the ONLY file in the PDF module that imports
|
|
7
|
+
* from @word.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { readDocx } from "excelts/word";
|
|
12
|
+
* import { docxToPdf } from "excelts/pdf";
|
|
13
|
+
*
|
|
14
|
+
* const doc = await readDocx(docxBytes);
|
|
15
|
+
* const pdfBytes = await docxToPdf(doc);
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Note: This is a simple flow-based renderer. For high-fidelity output,
|
|
19
|
+
* consider using Microsoft Word or LibreOffice.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.docxToPdf = docxToPdf;
|
|
23
|
+
const document_builder_1 = require("./builder/document-builder");
|
|
24
|
+
/**
|
|
25
|
+
* Convert a DocxDocument to PDF bytes.
|
|
26
|
+
*
|
|
27
|
+
* @param doc - The DOCX document model (from readDocx or DocumentBuilder.build()).
|
|
28
|
+
* @param options - PDF rendering options.
|
|
29
|
+
* @returns Promise of PDF bytes.
|
|
30
|
+
*/
|
|
31
|
+
async function docxToPdf(doc, options) {
|
|
32
|
+
const opts = {
|
|
33
|
+
pageWidth: options?.pageWidth ?? 612,
|
|
34
|
+
pageHeight: options?.pageHeight ?? 792,
|
|
35
|
+
marginTop: options?.marginTop ?? 72,
|
|
36
|
+
marginBottom: options?.marginBottom ?? 72,
|
|
37
|
+
marginLeft: options?.marginLeft ?? 72,
|
|
38
|
+
marginRight: options?.marginRight ?? 72,
|
|
39
|
+
defaultFont: options?.defaultFont ?? "Times-Roman",
|
|
40
|
+
defaultFontSize: options?.defaultFontSize ?? 11
|
|
41
|
+
};
|
|
42
|
+
// Use section properties if available
|
|
43
|
+
const sectProps = doc.sectionProperties;
|
|
44
|
+
if (sectProps?.pageSize && !options?.pageWidth) {
|
|
45
|
+
opts.pageWidth = twipsToPt(sectProps.pageSize.width);
|
|
46
|
+
opts.pageHeight = twipsToPt(sectProps.pageSize.height);
|
|
47
|
+
if (sectProps.pageSize.orientation === "landscape") {
|
|
48
|
+
[opts.pageWidth, opts.pageHeight] = [opts.pageHeight, opts.pageWidth];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (sectProps?.margins && !options?.marginTop) {
|
|
52
|
+
opts.marginTop = twipsToPt(sectProps.margins.top);
|
|
53
|
+
opts.marginBottom = twipsToPt(sectProps.margins.bottom);
|
|
54
|
+
opts.marginLeft = twipsToPt(sectProps.margins.left);
|
|
55
|
+
opts.marginRight = twipsToPt(sectProps.margins.right);
|
|
56
|
+
}
|
|
57
|
+
const builder = new document_builder_1.PdfDocumentBuilder();
|
|
58
|
+
if (doc.coreProperties?.title || doc.coreProperties?.creator) {
|
|
59
|
+
builder.setMetadata({
|
|
60
|
+
title: doc.coreProperties?.title,
|
|
61
|
+
author: doc.coreProperties?.creator,
|
|
62
|
+
subject: doc.coreProperties?.subject
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const state = {
|
|
66
|
+
builder,
|
|
67
|
+
opts,
|
|
68
|
+
doc,
|
|
69
|
+
rIdToImage: buildImageMap(doc),
|
|
70
|
+
currentPage: null,
|
|
71
|
+
cursorY: 0,
|
|
72
|
+
currentPageIndex: 0
|
|
73
|
+
};
|
|
74
|
+
newPage(state);
|
|
75
|
+
for (const item of doc.body) {
|
|
76
|
+
renderBodyContent(state, item);
|
|
77
|
+
}
|
|
78
|
+
return builder.build();
|
|
79
|
+
}
|
|
80
|
+
function newPage(state) {
|
|
81
|
+
state.currentPage = state.builder.addPage({
|
|
82
|
+
width: state.opts.pageWidth,
|
|
83
|
+
height: state.opts.pageHeight
|
|
84
|
+
});
|
|
85
|
+
state.cursorY = state.opts.pageHeight - state.opts.marginTop;
|
|
86
|
+
state.currentPageIndex++;
|
|
87
|
+
}
|
|
88
|
+
function ensureSpace(state, needed) {
|
|
89
|
+
if (state.cursorY - needed < state.opts.marginBottom) {
|
|
90
|
+
newPage(state);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function renderBodyContent(state, item) {
|
|
94
|
+
if (!("type" in item)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
switch (item.type) {
|
|
98
|
+
case "paragraph":
|
|
99
|
+
renderParagraphPdf(state, item);
|
|
100
|
+
break;
|
|
101
|
+
case "table":
|
|
102
|
+
renderTablePdf(state, item);
|
|
103
|
+
break;
|
|
104
|
+
case "math":
|
|
105
|
+
renderTextAtCursor(state, "[equation]", { italic: true });
|
|
106
|
+
break;
|
|
107
|
+
case "chart":
|
|
108
|
+
renderTextAtCursor(state, `[${item.chart.type} chart]`, { italic: true });
|
|
109
|
+
break;
|
|
110
|
+
default:
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function renderParagraphPdf(state, para) {
|
|
115
|
+
const props = para.properties;
|
|
116
|
+
const spacing = props?.spacing;
|
|
117
|
+
if (spacing?.before) {
|
|
118
|
+
state.cursorY -= twipsToPt(spacing.before);
|
|
119
|
+
}
|
|
120
|
+
const text = collectText(para);
|
|
121
|
+
if (!text.trim()) {
|
|
122
|
+
state.cursorY -= state.opts.defaultFontSize * 1.2;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// Determine font size and weight based on style
|
|
126
|
+
let fontSize = state.opts.defaultFontSize;
|
|
127
|
+
let bold = false;
|
|
128
|
+
const styleId = props?.style?.toLowerCase() ?? "";
|
|
129
|
+
if (styleId === "heading1" || styleId === "title") {
|
|
130
|
+
fontSize = 24;
|
|
131
|
+
bold = true;
|
|
132
|
+
}
|
|
133
|
+
else if (styleId === "heading2") {
|
|
134
|
+
fontSize = 18;
|
|
135
|
+
bold = true;
|
|
136
|
+
}
|
|
137
|
+
else if (styleId === "heading3") {
|
|
138
|
+
fontSize = 14;
|
|
139
|
+
bold = true;
|
|
140
|
+
}
|
|
141
|
+
else if (styleId === "heading4") {
|
|
142
|
+
fontSize = 12;
|
|
143
|
+
bold = true;
|
|
144
|
+
}
|
|
145
|
+
let leftIndent = 0;
|
|
146
|
+
if (props?.indent?.left !== undefined) {
|
|
147
|
+
leftIndent = twipsToPt(props.indent.left);
|
|
148
|
+
}
|
|
149
|
+
const x = state.opts.marginLeft + leftIndent;
|
|
150
|
+
const availableWidth = state.opts.pageWidth - state.opts.marginLeft - state.opts.marginRight - leftIndent;
|
|
151
|
+
const lineHeight = fontSize * 1.2;
|
|
152
|
+
const estimatedLines = Math.max(1, Math.ceil((text.length * fontSize * 0.5) / availableWidth));
|
|
153
|
+
ensureSpace(state, estimatedLines * lineHeight);
|
|
154
|
+
// Simple approach: render entire paragraph as one text block
|
|
155
|
+
state.currentPage.drawText(text, {
|
|
156
|
+
x,
|
|
157
|
+
y: state.cursorY - fontSize,
|
|
158
|
+
fontSize,
|
|
159
|
+
bold,
|
|
160
|
+
maxWidth: availableWidth,
|
|
161
|
+
lineHeight: 1.2
|
|
162
|
+
});
|
|
163
|
+
state.cursorY -= estimatedLines * lineHeight;
|
|
164
|
+
if (spacing?.after) {
|
|
165
|
+
state.cursorY -= twipsToPt(spacing.after);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
state.cursorY -= 6;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function collectText(para) {
|
|
172
|
+
let text = "";
|
|
173
|
+
for (const child of para.children) {
|
|
174
|
+
const run = childToRun(child);
|
|
175
|
+
if (run) {
|
|
176
|
+
text += runToText(run);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return text;
|
|
180
|
+
}
|
|
181
|
+
function childToRun(child) {
|
|
182
|
+
if ("content" in child && !("type" in child)) {
|
|
183
|
+
return child;
|
|
184
|
+
}
|
|
185
|
+
if ("type" in child) {
|
|
186
|
+
const typed = child;
|
|
187
|
+
if (typed.type === "hyperlink" && typed.children) {
|
|
188
|
+
for (const c of typed.children) {
|
|
189
|
+
if ("content" in c && !("type" in c)) {
|
|
190
|
+
return c;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else if (typed.type === "insertedRun" ||
|
|
195
|
+
typed.type === "deletedRun" ||
|
|
196
|
+
typed.type === "movedFromRun" ||
|
|
197
|
+
typed.type === "movedToRun") {
|
|
198
|
+
return typed.run;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
function runToText(run) {
|
|
204
|
+
let text = "";
|
|
205
|
+
for (const c of run.content) {
|
|
206
|
+
switch (c.type) {
|
|
207
|
+
case "text":
|
|
208
|
+
text += c.text;
|
|
209
|
+
break;
|
|
210
|
+
case "tab":
|
|
211
|
+
text += "\t";
|
|
212
|
+
break;
|
|
213
|
+
case "break":
|
|
214
|
+
case "carriageReturn":
|
|
215
|
+
text += "\n";
|
|
216
|
+
break;
|
|
217
|
+
case "noBreakHyphen":
|
|
218
|
+
text += "\u2011";
|
|
219
|
+
break;
|
|
220
|
+
case "symbol":
|
|
221
|
+
try {
|
|
222
|
+
text += String.fromCodePoint(parseInt(c.char, 16));
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
// Invalid symbol code - skip
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
case "field":
|
|
229
|
+
if (c.cachedValue) {
|
|
230
|
+
text += c.cachedValue;
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return text;
|
|
236
|
+
}
|
|
237
|
+
function renderTablePdf(state, table) {
|
|
238
|
+
const pageWidth = state.opts.pageWidth - state.opts.marginLeft - state.opts.marginRight;
|
|
239
|
+
const numCols = Math.max(...table.rows.map(r => r.cells.length));
|
|
240
|
+
const defaultColWidth = pageWidth / numCols;
|
|
241
|
+
const rowHeight = 20;
|
|
242
|
+
for (const row of table.rows) {
|
|
243
|
+
ensureSpace(state, rowHeight);
|
|
244
|
+
let x = state.opts.marginLeft;
|
|
245
|
+
const rowTop = state.cursorY;
|
|
246
|
+
const rowBottom = state.cursorY - rowHeight;
|
|
247
|
+
for (const cell of row.cells) {
|
|
248
|
+
const span = cell.properties?.gridSpan ?? 1;
|
|
249
|
+
const cellWidth = defaultColWidth * span;
|
|
250
|
+
state.currentPage.drawRect({
|
|
251
|
+
x,
|
|
252
|
+
y: rowBottom,
|
|
253
|
+
width: cellWidth,
|
|
254
|
+
height: rowHeight,
|
|
255
|
+
stroke: { r: 0, g: 0, b: 0 },
|
|
256
|
+
lineWidth: 0.5
|
|
257
|
+
});
|
|
258
|
+
const cellText = getCellText(cell);
|
|
259
|
+
if (cellText) {
|
|
260
|
+
state.currentPage.drawText(cellText, {
|
|
261
|
+
x: x + 4,
|
|
262
|
+
y: rowTop - 14,
|
|
263
|
+
fontSize: 10,
|
|
264
|
+
maxWidth: cellWidth - 8
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
x += cellWidth;
|
|
268
|
+
}
|
|
269
|
+
state.cursorY = rowBottom;
|
|
270
|
+
}
|
|
271
|
+
state.cursorY -= 6;
|
|
272
|
+
}
|
|
273
|
+
function getCellText(cell) {
|
|
274
|
+
let text = "";
|
|
275
|
+
for (const item of cell.content) {
|
|
276
|
+
if ("type" in item && item.type === "paragraph") {
|
|
277
|
+
text += collectText(item) + " ";
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return text.trim();
|
|
281
|
+
}
|
|
282
|
+
function twipsToPt(twips) {
|
|
283
|
+
return twips / 20;
|
|
284
|
+
}
|
|
285
|
+
function renderTextAtCursor(state, text, opts) {
|
|
286
|
+
const fontSize = opts?.fontSize ?? state.opts.defaultFontSize;
|
|
287
|
+
ensureSpace(state, fontSize * 1.2);
|
|
288
|
+
state.currentPage.drawText(text, {
|
|
289
|
+
x: state.opts.marginLeft,
|
|
290
|
+
y: state.cursorY - fontSize,
|
|
291
|
+
fontSize,
|
|
292
|
+
bold: opts?.bold,
|
|
293
|
+
italic: opts?.italic
|
|
294
|
+
});
|
|
295
|
+
state.cursorY -= fontSize * 1.2;
|
|
296
|
+
}
|
|
297
|
+
function buildImageMap(doc) {
|
|
298
|
+
const map = new Map();
|
|
299
|
+
if (doc.images) {
|
|
300
|
+
for (const img of doc.images) {
|
|
301
|
+
if (img.rId) {
|
|
302
|
+
map.set(img.rId, img);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return map;
|
|
307
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DOCX Module - Constants
|
|
4
|
+
*
|
|
5
|
+
* XML namespaces, relationship types, content types, and other constants
|
|
6
|
+
* for the OOXML WordprocessingML format.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PartPath = exports.DEFAULT_COLUMN_SPACE = exports.DEFAULT_HEADER_FOOTER_MARGIN = exports.DEFAULT_MARGIN = exports.A4_PAGE_HEIGHT = exports.A4_PAGE_WIDTH = exports.DEFAULT_PAGE_HEIGHT = exports.DEFAULT_PAGE_WIDTH = exports.STD_DOC_ATTRIBUTES = exports.IMAGE_CONTENT_TYPES = exports.ContentType = exports.RelType = exports.DOCUMENT_NAMESPACES = exports.URI_PIC = exports.NS_PKG_RELS = exports.NS_CONTENT_TYPES = exports.NS_XSI = exports.NS_CUSTOM = exports.NS_VT = exports.NS_EP = exports.NS_CP = exports.NS_DCMITYPE = exports.NS_DCTERMS = exports.NS_DC = exports.GUID_SVG = exports.NS_ASVG = exports.NS_W10 = exports.NS_WP14 = exports.NS_WPC = exports.NS_WPS = exports.NS_WPI = exports.NS_WPG = exports.NS_W15 = exports.NS_W14 = exports.NS_M = exports.NS_O = exports.NS_V = exports.NS_MC = exports.NS_PIC = exports.NS_A = exports.NS_WP = exports.NS_R = exports.NS_W = void 0;
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// XML Namespaces
|
|
12
|
+
// =============================================================================
|
|
13
|
+
/** WordprocessingML main namespace (w:). */
|
|
14
|
+
exports.NS_W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
15
|
+
/** Relationships namespace (r:). */
|
|
16
|
+
exports.NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
17
|
+
/** DrawingML Word Processing Drawing namespace (wp:). */
|
|
18
|
+
exports.NS_WP = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
19
|
+
/** DrawingML main namespace (a:). */
|
|
20
|
+
exports.NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
21
|
+
/** DrawingML picture namespace (pic:). */
|
|
22
|
+
exports.NS_PIC = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
23
|
+
/** Markup compatibility namespace (mc:). */
|
|
24
|
+
exports.NS_MC = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
25
|
+
/** VML namespace (v:). */
|
|
26
|
+
exports.NS_V = "urn:schemas-microsoft-com:vml";
|
|
27
|
+
/** Office VML extensions (o:). */
|
|
28
|
+
exports.NS_O = "urn:schemas-microsoft-com:office:office";
|
|
29
|
+
/** Math namespace (m:). */
|
|
30
|
+
exports.NS_M = "http://schemas.openxmlformats.org/officeDocument/2006/math";
|
|
31
|
+
/** Word 2010 extensions (w14:). */
|
|
32
|
+
exports.NS_W14 = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
33
|
+
/** Word 2013 extensions (w15:). */
|
|
34
|
+
exports.NS_W15 = "http://schemas.microsoft.com/office/word/2012/wordml";
|
|
35
|
+
/** Word Processing Group (wpg:). */
|
|
36
|
+
exports.NS_WPG = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
|
|
37
|
+
/** Word Processing Ink (wpi:). */
|
|
38
|
+
exports.NS_WPI = "http://schemas.microsoft.com/office/word/2010/wordprocessingInk";
|
|
39
|
+
/** Word Processing Shape (wps:). */
|
|
40
|
+
exports.NS_WPS = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
|
41
|
+
/** Word Processing Canvas (wpc:). */
|
|
42
|
+
exports.NS_WPC = "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas";
|
|
43
|
+
/** Word Processing Drawing 2010 (wp14:). */
|
|
44
|
+
exports.NS_WP14 = "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing";
|
|
45
|
+
/** Office Word (w10:). */
|
|
46
|
+
exports.NS_W10 = "urn:schemas-microsoft-com:office:word";
|
|
47
|
+
/** SVG extension (asvg:). */
|
|
48
|
+
exports.NS_ASVG = "http://schemas.microsoft.com/office/drawing/2016/SVG/main";
|
|
49
|
+
/** SVG extension GUID for a:ext. */
|
|
50
|
+
exports.GUID_SVG = "{96DAC541-7B7A-43D3-8B79-37D633B846F1}";
|
|
51
|
+
/** Dublin Core elements (dc:). */
|
|
52
|
+
exports.NS_DC = "http://purl.org/dc/elements/1.1/";
|
|
53
|
+
/** Dublin Core terms (dcterms:). */
|
|
54
|
+
exports.NS_DCTERMS = "http://purl.org/dc/terms/";
|
|
55
|
+
/** Dublin Core DCMI type (dcmitype:). */
|
|
56
|
+
exports.NS_DCMITYPE = "http://purl.org/dc/dcmitype/";
|
|
57
|
+
/** Core properties namespace (cp:). */
|
|
58
|
+
exports.NS_CP = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties";
|
|
59
|
+
/** Extended properties namespace. */
|
|
60
|
+
exports.NS_EP = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
|
|
61
|
+
/** Doc props VTypes namespace (vt:). */
|
|
62
|
+
exports.NS_VT = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes";
|
|
63
|
+
/** Custom properties namespace. */
|
|
64
|
+
exports.NS_CUSTOM = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties";
|
|
65
|
+
/** XML Schema instance namespace (xsi:). */
|
|
66
|
+
exports.NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
|
|
67
|
+
/** Content Types namespace. */
|
|
68
|
+
exports.NS_CONTENT_TYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
69
|
+
/** Package relationships namespace. */
|
|
70
|
+
exports.NS_PKG_RELS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
71
|
+
/** DrawingML picture URI for graphicData. */
|
|
72
|
+
exports.URI_PIC = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
73
|
+
// =============================================================================
|
|
74
|
+
// Namespace Attributes (for document.xml root)
|
|
75
|
+
// =============================================================================
|
|
76
|
+
/** Standard namespace attributes for w:document root element. */
|
|
77
|
+
exports.DOCUMENT_NAMESPACES = {
|
|
78
|
+
"xmlns:wpc": exports.NS_WPC,
|
|
79
|
+
"xmlns:mc": exports.NS_MC,
|
|
80
|
+
"xmlns:o": exports.NS_O,
|
|
81
|
+
"xmlns:r": exports.NS_R,
|
|
82
|
+
"xmlns:m": exports.NS_M,
|
|
83
|
+
"xmlns:v": exports.NS_V,
|
|
84
|
+
"xmlns:wp": exports.NS_WP,
|
|
85
|
+
"xmlns:w10": exports.NS_W10,
|
|
86
|
+
"xmlns:w": exports.NS_W,
|
|
87
|
+
"xmlns:w14": exports.NS_W14,
|
|
88
|
+
"xmlns:w15": exports.NS_W15,
|
|
89
|
+
"xmlns:wpg": exports.NS_WPG,
|
|
90
|
+
"xmlns:wpi": exports.NS_WPI,
|
|
91
|
+
"xmlns:wps": exports.NS_WPS,
|
|
92
|
+
"xmlns:wp14": exports.NS_WP14,
|
|
93
|
+
"mc:Ignorable": "w14 w15 wp14"
|
|
94
|
+
};
|
|
95
|
+
// =============================================================================
|
|
96
|
+
// Relationship Types
|
|
97
|
+
// =============================================================================
|
|
98
|
+
const REL_BASE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
99
|
+
const PKG_BASE = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
100
|
+
/** OOXML relationship type URIs. */
|
|
101
|
+
exports.RelType = {
|
|
102
|
+
OfficeDocument: `${REL_BASE}/officeDocument`,
|
|
103
|
+
CoreProperties: `${PKG_BASE}/metadata/core-properties`,
|
|
104
|
+
ExtendedProperties: `${REL_BASE}/extended-properties`,
|
|
105
|
+
CustomProperties: `${REL_BASE}/custom-properties`,
|
|
106
|
+
Styles: `${REL_BASE}/styles`,
|
|
107
|
+
Settings: `${REL_BASE}/settings`,
|
|
108
|
+
FontTable: `${REL_BASE}/fontTable`,
|
|
109
|
+
Numbering: `${REL_BASE}/numbering`,
|
|
110
|
+
Footnotes: `${REL_BASE}/footnotes`,
|
|
111
|
+
Endnotes: `${REL_BASE}/endnotes`,
|
|
112
|
+
Header: `${REL_BASE}/header`,
|
|
113
|
+
Footer: `${REL_BASE}/footer`,
|
|
114
|
+
Image: `${REL_BASE}/image`,
|
|
115
|
+
Hyperlink: `${REL_BASE}/hyperlink`,
|
|
116
|
+
Theme: `${REL_BASE}/theme`,
|
|
117
|
+
Comments: `${REL_BASE}/comments`,
|
|
118
|
+
CommentsExtended: `${REL_BASE}/commentsExtended`,
|
|
119
|
+
WebSettings: `${REL_BASE}/webSettings`,
|
|
120
|
+
Glossary: `${REL_BASE}/glossaryDocument`,
|
|
121
|
+
Font: `${REL_BASE}/font`,
|
|
122
|
+
Chart: `${REL_BASE}/chart`,
|
|
123
|
+
Diagram: `${REL_BASE}/diagramData`,
|
|
124
|
+
CustomXml: `${REL_BASE}/customXml`,
|
|
125
|
+
CustomXmlProps: `${REL_BASE}/customXmlProps`,
|
|
126
|
+
VbaProject: `${REL_BASE}/vbaProject`,
|
|
127
|
+
People: `${REL_BASE}/people`,
|
|
128
|
+
DigitalSignature: `${REL_BASE}/digital-signature/signature`
|
|
129
|
+
};
|
|
130
|
+
// =============================================================================
|
|
131
|
+
// Content Types
|
|
132
|
+
// =============================================================================
|
|
133
|
+
/** OOXML content type strings. */
|
|
134
|
+
exports.ContentType = {
|
|
135
|
+
Relationships: "application/vnd.openxmlformats-package.relationships+xml",
|
|
136
|
+
Xml: "application/xml",
|
|
137
|
+
Document: "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
|
|
138
|
+
Styles: "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",
|
|
139
|
+
Settings: "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",
|
|
140
|
+
FontTable: "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml",
|
|
141
|
+
Numbering: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
|
|
142
|
+
Footnotes: "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",
|
|
143
|
+
Endnotes: "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",
|
|
144
|
+
Header: "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
|
|
145
|
+
Footer: "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",
|
|
146
|
+
Theme: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
147
|
+
CoreProperties: "application/vnd.openxmlformats-package.core-properties+xml",
|
|
148
|
+
ExtendedProperties: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
|
|
149
|
+
CustomProperties: "application/vnd.openxmlformats-officedocument.custom-properties+xml",
|
|
150
|
+
Comments: "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
|
151
|
+
CommentsExtended: "application/vnd.ms-word.commentsExtended+xml",
|
|
152
|
+
People: "application/vnd.ms-word.people+xml",
|
|
153
|
+
WebSettings: "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml",
|
|
154
|
+
Png: "image/png",
|
|
155
|
+
Jpeg: "image/jpeg",
|
|
156
|
+
Gif: "image/gif",
|
|
157
|
+
Bmp: "image/bmp",
|
|
158
|
+
Tiff: "image/tiff",
|
|
159
|
+
Svg: "image/svg+xml",
|
|
160
|
+
Webp: "image/webp",
|
|
161
|
+
Emf: "image/x-emf",
|
|
162
|
+
Wmf: "image/x-wmf",
|
|
163
|
+
ObfuscatedFont: "application/vnd.openxmlformats-officedocument.obfuscatedFont",
|
|
164
|
+
Chart: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
165
|
+
CustomXml: "application/xml",
|
|
166
|
+
VbaProject: "application/vnd.ms-office.vbaProject"
|
|
167
|
+
};
|
|
168
|
+
/** Map from image file extension to content type. */
|
|
169
|
+
exports.IMAGE_CONTENT_TYPES = {
|
|
170
|
+
png: exports.ContentType.Png,
|
|
171
|
+
jpeg: exports.ContentType.Jpeg,
|
|
172
|
+
jpg: exports.ContentType.Jpeg,
|
|
173
|
+
gif: exports.ContentType.Gif,
|
|
174
|
+
bmp: exports.ContentType.Bmp,
|
|
175
|
+
tiff: exports.ContentType.Tiff,
|
|
176
|
+
tif: exports.ContentType.Tiff,
|
|
177
|
+
svg: exports.ContentType.Svg,
|
|
178
|
+
webp: exports.ContentType.Webp,
|
|
179
|
+
emf: exports.ContentType.Emf,
|
|
180
|
+
wmf: exports.ContentType.Wmf
|
|
181
|
+
};
|
|
182
|
+
// =============================================================================
|
|
183
|
+
// Standard XML Declaration
|
|
184
|
+
// =============================================================================
|
|
185
|
+
/** Standard XML declaration attributes. */
|
|
186
|
+
exports.STD_DOC_ATTRIBUTES = {
|
|
187
|
+
version: "1.0",
|
|
188
|
+
encoding: "UTF-8",
|
|
189
|
+
standalone: "yes"
|
|
190
|
+
};
|
|
191
|
+
// =============================================================================
|
|
192
|
+
// Default Section Properties (Letter size, 1 inch margins)
|
|
193
|
+
// =============================================================================
|
|
194
|
+
/** Default page size: US Letter (8.5" x 11") in twips. */
|
|
195
|
+
exports.DEFAULT_PAGE_WIDTH = 12240; // 8.5 inches
|
|
196
|
+
exports.DEFAULT_PAGE_HEIGHT = 15840; // 11 inches
|
|
197
|
+
/** A4 page size in twips. */
|
|
198
|
+
exports.A4_PAGE_WIDTH = 11906; // 210mm
|
|
199
|
+
exports.A4_PAGE_HEIGHT = 16838; // 297mm
|
|
200
|
+
/** Default margins: 1 inch all around. */
|
|
201
|
+
exports.DEFAULT_MARGIN = 1440; // 1 inch in twips
|
|
202
|
+
exports.DEFAULT_HEADER_FOOTER_MARGIN = 720; // 0.5 inch
|
|
203
|
+
/** Default column space. */
|
|
204
|
+
exports.DEFAULT_COLUMN_SPACE = 720;
|
|
205
|
+
// =============================================================================
|
|
206
|
+
// Part Paths
|
|
207
|
+
// =============================================================================
|
|
208
|
+
/** Standard DOCX part file paths within the ZIP package. */
|
|
209
|
+
exports.PartPath = {
|
|
210
|
+
ContentTypes: "[Content_Types].xml",
|
|
211
|
+
PackageRels: "_rels/.rels",
|
|
212
|
+
Document: "word/document.xml",
|
|
213
|
+
DocumentRels: "word/_rels/document.xml.rels",
|
|
214
|
+
Styles: "word/styles.xml",
|
|
215
|
+
Settings: "word/settings.xml",
|
|
216
|
+
FontTable: "word/fontTable.xml",
|
|
217
|
+
Numbering: "word/numbering.xml",
|
|
218
|
+
Footnotes: "word/footnotes.xml",
|
|
219
|
+
Endnotes: "word/endnotes.xml",
|
|
220
|
+
Comments: "word/comments.xml",
|
|
221
|
+
CommentsExtended: "word/commentsExtended.xml",
|
|
222
|
+
People: "word/people.xml",
|
|
223
|
+
WebSettings: "word/webSettings.xml",
|
|
224
|
+
Theme: "word/theme/theme1.xml",
|
|
225
|
+
CoreProps: "docProps/core.xml",
|
|
226
|
+
AppProps: "docProps/app.xml",
|
|
227
|
+
CustomProps: "docProps/custom.xml",
|
|
228
|
+
Thumbnail: "docProps/thumbnail.jpeg",
|
|
229
|
+
header: (n) => `word/header${n}.xml`,
|
|
230
|
+
headerRels: (n) => `word/_rels/header${n}.xml.rels`,
|
|
231
|
+
footer: (n) => `word/footer${n}.xml`,
|
|
232
|
+
footerRels: (n) => `word/_rels/footer${n}.xml.rels`,
|
|
233
|
+
media: (name) => `word/media/${name}`
|
|
234
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DOCX Module - Content Types Generator
|
|
4
|
+
*
|
|
5
|
+
* Generates [Content_Types].xml for the DOCX package.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ContentTypesManager = void 0;
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
/**
|
|
11
|
+
* Generates the [Content_Types].xml part.
|
|
12
|
+
*/
|
|
13
|
+
class ContentTypesManager {
|
|
14
|
+
constructor() {
|
|
15
|
+
this._defaults = new Map();
|
|
16
|
+
this._overrides = [];
|
|
17
|
+
// Always include rels and xml defaults
|
|
18
|
+
this._defaults.set("rels", constants_1.ContentType.Relationships);
|
|
19
|
+
this._defaults.set("xml", constants_1.ContentType.Xml);
|
|
20
|
+
}
|
|
21
|
+
/** Add a default content type for a file extension. */
|
|
22
|
+
addDefault(extension, contentType) {
|
|
23
|
+
this._defaults.set(extension, contentType);
|
|
24
|
+
}
|
|
25
|
+
/** Add an override content type for a specific part. */
|
|
26
|
+
addOverride(partName, contentType) {
|
|
27
|
+
this._overrides.push({
|
|
28
|
+
partName: partName.startsWith("/") ? partName : `/${partName}`,
|
|
29
|
+
contentType
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Add image extension defaults from a set of used extensions. */
|
|
33
|
+
addImageDefaults(extensions) {
|
|
34
|
+
for (const ext of extensions) {
|
|
35
|
+
const ct = constants_1.IMAGE_CONTENT_TYPES[ext.toLowerCase()];
|
|
36
|
+
if (ct) {
|
|
37
|
+
this._defaults.set(ext.toLowerCase(), ct);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Render the [Content_Types].xml to a sink. */
|
|
42
|
+
render(xml) {
|
|
43
|
+
xml.openXml(constants_1.STD_DOC_ATTRIBUTES);
|
|
44
|
+
xml.openNode("Types", { xmlns: constants_1.NS_CONTENT_TYPES });
|
|
45
|
+
// Defaults sorted by extension
|
|
46
|
+
const sortedDefaults = [...this._defaults.entries()].sort((a, b) => a[0].localeCompare(b[0]));
|
|
47
|
+
for (const [ext, ct] of sortedDefaults) {
|
|
48
|
+
xml.leafNode("Default", { Extension: ext, ContentType: ct });
|
|
49
|
+
}
|
|
50
|
+
// Overrides in order
|
|
51
|
+
for (const override of this._overrides) {
|
|
52
|
+
xml.leafNode("Override", { PartName: override.partName, ContentType: override.contentType });
|
|
53
|
+
}
|
|
54
|
+
xml.closeNode();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ContentTypesManager = ContentTypesManager;
|