@cj-tech-master/excelts 9.5.4 → 9.5.5
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/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/browser/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/browser/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/browser/modules/archive/fs/archive-file.d.ts +8 -5
- package/dist/browser/modules/archive/fs/archive-file.js +78 -16
- package/dist/browser/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/browser/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/browser/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +0 -12
- package/dist/browser/modules/excel/chart/chart.d.ts +1 -5
- package/dist/browser/modules/excel/chart/chart.js +1 -7
- package/dist/browser/modules/excel/chart/types.d.ts +0 -6
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/browser/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +40 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/browser/modules/excel/utils/string-buf.d.ts +5 -26
- package/dist/browser/modules/excel/utils/string-buf.js +4 -81
- package/dist/browser/modules/excel/workbook.browser.js +135 -25
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +19 -9
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/browser/modules/excel/xlsx/xlsx.d.ts +10 -2
- package/dist/browser/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/browser/modules/pdf/excel-bridge.d.ts +30 -1
- package/dist/browser/modules/pdf/excel-bridge.js +32 -0
- package/dist/browser/modules/pdf/font/metrics.d.ts +3 -52
- package/dist/browser/modules/pdf/font/metrics.js +3 -237
- package/dist/browser/modules/pdf/index.d.ts +1 -1
- package/dist/browser/modules/pdf/index.js +1 -1
- package/dist/browser/modules/pdf/render-layout-to-pdf.d.ts +66 -0
- package/dist/browser/modules/pdf/render-layout-to-pdf.js +647 -0
- package/dist/browser/modules/pdf/word-bridge.d.ts +80 -12
- package/dist/browser/modules/pdf/word-bridge.js +122 -274
- package/dist/browser/modules/stream/index.base.d.ts +2 -0
- package/dist/browser/modules/stream/index.base.js +2 -1
- package/dist/browser/modules/stream/internal/sink-adapter.d.ts +65 -0
- package/dist/browser/modules/stream/internal/sink-adapter.js +198 -0
- package/dist/browser/modules/stream/pull-stream.d.ts +19 -2
- package/dist/browser/modules/stream/pull-stream.js +51 -5
- package/dist/browser/modules/stream/types.d.ts +13 -1
- package/dist/browser/modules/word/advanced/diff.d.ts +61 -0
- package/dist/browser/modules/word/advanced/diff.js +167 -0
- package/dist/browser/modules/word/advanced/drawing-shapes.d.ts +269 -0
- package/dist/browser/modules/word/advanced/drawing-shapes.js +268 -0
- package/dist/browser/modules/word/advanced/field-engine.d.ts +43 -0
- package/dist/browser/modules/word/advanced/field-engine.js +1225 -0
- package/dist/browser/modules/word/advanced/glossary.d.ts +86 -0
- package/dist/browser/modules/word/advanced/glossary.js +79 -0
- package/dist/browser/modules/word/advanced/math-convert.d.ts +30 -0
- package/dist/browser/modules/word/advanced/math-convert.js +595 -0
- package/dist/browser/modules/word/advanced/ole-objects.d.ts +115 -0
- package/dist/browser/modules/word/advanced/ole-objects.js +271 -0
- package/dist/browser/modules/word/advanced/style-map.d.ts +105 -0
- package/dist/browser/modules/word/advanced/style-map.js +322 -0
- package/dist/browser/modules/word/advanced/validation.d.ts +56 -0
- package/dist/browser/modules/word/advanced/validation.js +1065 -0
- package/dist/browser/modules/word/advanced/vba-project.d.ts +91 -0
- package/dist/browser/modules/word/advanced/vba-project.js +265 -0
- package/dist/browser/modules/word/bridge/excel-bridge.d.ts +127 -0
- package/dist/browser/modules/word/bridge/excel-bridge.js +980 -0
- package/dist/browser/modules/word/builder/document-handle.d.ts +151 -0
- package/dist/browser/modules/word/builder/document-handle.js +664 -0
- package/dist/browser/modules/word/builder/paragraph-builders.d.ts +61 -0
- package/dist/browser/modules/word/builder/paragraph-builders.js +90 -0
- package/dist/browser/modules/word/builder/run-builders.d.ts +374 -0
- package/dist/browser/modules/word/builder/run-builders.js +600 -0
- package/dist/browser/modules/word/builder/table-builders.d.ts +23 -0
- package/dist/browser/modules/word/builder/table-builders.js +45 -0
- package/dist/browser/modules/word/constants.d.ts +39 -1
- package/dist/browser/modules/word/constants.js +109 -1
- package/dist/browser/modules/word/convert/conversion-ir.d.ts +210 -0
- package/dist/browser/modules/word/convert/conversion-ir.js +31 -0
- package/dist/browser/modules/word/convert/docx-to-semantic.d.ts +39 -0
- package/dist/browser/modules/word/convert/docx-to-semantic.js +499 -0
- package/dist/browser/modules/word/convert/flat-opc.d.ts +44 -0
- package/dist/browser/modules/word/convert/flat-opc.js +385 -0
- package/dist/browser/modules/word/convert/html/html-import.d.ts +50 -0
- package/dist/browser/modules/word/convert/html/html-import.js +1907 -0
- package/dist/{types/modules/word → browser/modules/word/convert/html}/html-renderer.d.ts +14 -1
- package/dist/{esm/modules/word → browser/modules/word/convert/html}/html-renderer.js +420 -69
- package/dist/browser/modules/word/convert/html/html.d.ts +15 -0
- package/dist/browser/modules/word/convert/html/html.js +15 -0
- package/dist/browser/modules/word/convert/markdown/markdown-import.d.ts +68 -0
- package/dist/browser/modules/word/convert/markdown/markdown-import.js +1325 -0
- package/dist/browser/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
- package/dist/browser/modules/word/convert/markdown/markdown-renderer.js +634 -0
- package/dist/browser/modules/word/convert/markdown/markdown.d.ts +15 -0
- package/dist/browser/modules/word/convert/markdown/markdown.js +15 -0
- package/dist/browser/modules/word/convert/odt/odt.d.ts +41 -0
- package/dist/browser/modules/word/convert/odt/odt.js +1932 -0
- package/dist/browser/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
- package/dist/browser/modules/word/core/color-utils.js +43 -0
- package/dist/browser/modules/word/core/internal-utils.d.ts +90 -0
- package/dist/browser/modules/word/core/internal-utils.js +209 -0
- package/dist/browser/modules/word/core/mapper.d.ts +44 -0
- package/dist/browser/modules/word/core/mapper.js +427 -0
- package/dist/browser/modules/word/core/opc-paths.d.ts +33 -0
- package/dist/browser/modules/word/core/opc-paths.js +48 -0
- package/dist/browser/modules/word/core/text-utils.d.ts +38 -0
- package/dist/browser/modules/word/core/text-utils.js +202 -0
- package/dist/browser/modules/word/core/walker.d.ts +119 -0
- package/dist/browser/modules/word/core/walker.js +570 -0
- package/dist/browser/modules/word/crypto.d.ts +14 -9
- package/dist/browser/modules/word/crypto.js +13 -7
- package/dist/browser/modules/word/document-io.d.ts +59 -27
- package/dist/browser/modules/word/document-io.js +80 -197
- package/dist/browser/modules/word/errors.d.ts +44 -1
- package/dist/browser/modules/word/errors.js +54 -2
- package/dist/browser/modules/word/excel.d.ts +14 -0
- package/dist/browser/modules/word/excel.js +13 -0
- package/dist/browser/modules/word/font/font-embed.d.ts +112 -0
- package/dist/browser/modules/word/font/font-embed.js +646 -0
- package/dist/{esm/modules/word → browser/modules/word/font}/font-obfuscation.js +4 -9
- package/dist/browser/modules/word/font/hyphenation.d.ts +65 -0
- package/dist/browser/modules/word/font/hyphenation.js +4210 -0
- package/dist/browser/modules/word/font/text-shaping.d.ts +58 -0
- package/dist/browser/modules/word/font/text-shaping.js +635 -0
- package/dist/browser/modules/word/html.d.ts +7 -6
- package/dist/browser/modules/word/html.js +6 -5
- package/dist/browser/modules/word/incremental-edit.d.ts +123 -0
- package/dist/browser/modules/word/incremental-edit.js +361 -0
- package/dist/browser/modules/word/index.base.d.ts +194 -10
- package/dist/browser/modules/word/index.base.js +138 -29
- package/dist/browser/modules/word/layout/layout-constants.d.ts +17 -0
- package/dist/browser/modules/word/layout/layout-constants.js +17 -0
- package/dist/browser/modules/word/layout/layout-full.d.ts +53 -0
- package/dist/browser/modules/word/layout/layout-full.js +1696 -0
- package/dist/browser/modules/word/layout/layout-model.d.ts +344 -0
- package/dist/browser/modules/word/layout/layout-model.js +16 -0
- package/dist/browser/modules/word/layout/layout.d.ts +63 -0
- package/dist/browser/modules/word/layout/layout.js +1167 -0
- package/dist/browser/modules/word/layout/render-page.d.ts +57 -0
- package/dist/browser/modules/word/layout/render-page.js +1238 -0
- package/dist/browser/modules/word/markdown.d.ts +14 -0
- package/dist/browser/modules/word/markdown.js +13 -0
- package/dist/browser/modules/word/patcher.d.ts +62 -0
- package/dist/browser/modules/word/patcher.js +537 -0
- package/dist/browser/modules/word/query/compat.d.ts +25 -0
- package/dist/browser/modules/word/query/compat.js +58 -0
- package/dist/browser/modules/word/query/data-binding.d.ts +22 -0
- package/dist/browser/modules/word/query/data-binding.js +392 -0
- package/dist/browser/modules/word/query/form-fields.d.ts +41 -0
- package/dist/browser/modules/word/query/form-fields.js +268 -0
- package/dist/browser/modules/word/query/format-search.d.ts +99 -0
- package/dist/browser/modules/word/query/format-search.js +329 -0
- package/dist/browser/modules/word/query/mail-merge.d.ts +25 -0
- package/dist/browser/modules/word/query/mail-merge.js +111 -0
- package/dist/browser/modules/word/query/merge.d.ts +50 -0
- package/dist/browser/modules/word/query/merge.js +617 -0
- package/dist/browser/modules/word/query/replace.d.ts +47 -0
- package/dist/browser/modules/word/query/replace.js +301 -0
- package/dist/browser/modules/word/query/revisions.d.ts +67 -0
- package/dist/browser/modules/word/query/revisions.js +879 -0
- package/dist/browser/modules/word/query/search.d.ts +129 -0
- package/dist/browser/modules/word/query/search.js +346 -0
- package/dist/browser/modules/word/query/split.d.ts +44 -0
- package/dist/browser/modules/word/query/split.js +135 -0
- package/dist/browser/modules/word/query/style-resolve.d.ts +104 -0
- package/dist/browser/modules/word/query/style-resolve.js +368 -0
- package/dist/browser/modules/word/reader/chart-parser.d.ts +20 -0
- package/dist/browser/modules/word/reader/chart-parser.js +810 -0
- package/dist/browser/modules/word/reader/comments-parser.d.ts +26 -0
- package/dist/browser/modules/word/reader/comments-parser.js +92 -0
- package/dist/browser/modules/word/reader/doc-props-parsers.d.ts +15 -0
- package/dist/browser/modules/word/reader/doc-props-parsers.js +190 -0
- package/dist/browser/modules/word/reader/docx-reader.d.ts +27 -0
- package/dist/browser/modules/word/reader/docx-reader.js +2557 -0
- package/dist/browser/modules/word/reader/drawing-helpers.d.ts +27 -0
- package/dist/browser/modules/word/reader/drawing-helpers.js +84 -0
- package/dist/browser/modules/word/reader/form-field-parser.d.ts +21 -0
- package/dist/browser/modules/word/reader/form-field-parser.js +82 -0
- package/dist/browser/modules/word/reader/image-parsers.d.ts +11 -0
- package/dist/browser/modules/word/reader/image-parsers.js +291 -0
- package/dist/browser/modules/word/reader/math-parser.d.ts +12 -0
- package/dist/browser/modules/word/reader/math-parser.js +422 -0
- package/dist/browser/modules/word/reader/metadata-parsers.d.ts +17 -0
- package/dist/browser/modules/word/reader/metadata-parsers.js +87 -0
- package/dist/browser/modules/word/reader/numbering-parser.d.ts +13 -0
- package/dist/browser/modules/word/reader/numbering-parser.js +166 -0
- package/dist/browser/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
- package/dist/browser/modules/word/reader/paragraph-section-parsers.js +503 -0
- package/dist/browser/modules/word/reader/parse-utils.d.ts +91 -0
- package/dist/browser/modules/word/reader/parse-utils.js +249 -0
- package/dist/browser/modules/word/reader/properties-parsers.d.ts +21 -0
- package/dist/browser/modules/word/reader/properties-parsers.js +332 -0
- package/dist/browser/modules/word/reader/reader-context.d.ts +69 -0
- package/dist/browser/modules/word/reader/reader-context.js +61 -0
- package/dist/browser/modules/word/reader/sdt-helpers.d.ts +29 -0
- package/dist/browser/modules/word/reader/sdt-helpers.js +111 -0
- package/dist/browser/modules/word/reader/settings-parser.d.ts +8 -0
- package/dist/browser/modules/word/reader/settings-parser.js +263 -0
- package/dist/browser/modules/word/reader/styles-parser.d.ts +12 -0
- package/dist/browser/modules/word/reader/styles-parser.js +147 -0
- package/dist/browser/modules/word/reader/table-properties-parsers.d.ts +12 -0
- package/dist/browser/modules/word/reader/table-properties-parsers.js +234 -0
- package/dist/browser/modules/word/reader/theme-parser.d.ts +8 -0
- package/dist/browser/modules/word/reader/theme-parser.js +167 -0
- package/dist/browser/modules/word/reader/watermark-parser.d.ts +15 -0
- package/dist/browser/modules/word/reader/watermark-parser.js +110 -0
- package/dist/browser/modules/word/security/cfb-reader.d.ts +37 -0
- package/dist/browser/modules/word/security/cfb-reader.js +410 -0
- package/dist/browser/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
- package/dist/browser/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/browser/modules/word/security/document-protection.d.ts +93 -0
- package/dist/browser/modules/word/security/document-protection.js +201 -0
- package/dist/{types/modules/word → browser/modules/word/security}/encryption.d.ts +51 -4
- package/dist/browser/modules/word/security/encryption.js +602 -0
- package/dist/browser/modules/word/security/policy.d.ts +80 -0
- package/dist/browser/modules/word/security/policy.js +102 -0
- package/dist/browser/modules/word/template/template-chart.d.ts +56 -0
- package/dist/browser/modules/word/template/template-chart.js +167 -0
- package/dist/browser/modules/word/template/template-datasource.d.ts +154 -0
- package/dist/browser/modules/word/template/template-datasource.js +541 -0
- package/dist/browser/modules/word/template/template-engine.d.ts +121 -0
- package/dist/browser/modules/word/template/template-engine.js +1435 -0
- package/dist/browser/modules/word/types.d.ts +224 -25
- package/dist/browser/modules/word/units.d.ts +26 -0
- package/dist/browser/modules/word/units.js +43 -14
- package/dist/browser/modules/word/{writers → writer}/chart-writer.js +164 -23
- package/dist/browser/modules/word/writer/checkbox-writer.d.ts +17 -0
- package/dist/browser/modules/word/writer/checkbox-writer.js +79 -0
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/comment-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/browser/modules/word/writer/common-parts.d.ts +57 -0
- package/dist/browser/modules/word/writer/common-parts.js +101 -0
- package/dist/{types/modules/word → browser/modules/word/writer}/content-types.d.ts +2 -2
- package/dist/{esm/modules/word → browser/modules/word/writer}/content-types.js +14 -6
- package/dist/browser/modules/word/writer/document-writer.d.ts +24 -0
- package/dist/browser/modules/word/writer/document-writer.js +473 -0
- package/dist/browser/modules/word/writer/docx-packager.d.ts +35 -0
- package/dist/browser/modules/word/writer/docx-packager.js +1515 -0
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/footnote-writer.d.ts +3 -2
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/footnote-writer.js +13 -10
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/header-footer-writer.d.ts +3 -2
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/header-footer-writer.js +39 -21
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/image-writer.d.ts +1 -1
- package/dist/browser/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/browser/modules/word/writer/math-writer.d.ts +20 -0
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/math-writer.js +21 -1
- package/dist/browser/modules/word/{writers → writer}/numbering-writer.d.ts +1 -1
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/numbering-writer.js +11 -4
- package/dist/browser/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/paragraph-writer.js +73 -38
- package/dist/browser/modules/word/{writers → writer}/parts-writer.d.ts +3 -3
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/parts-writer.js +91 -12
- package/dist/browser/modules/word/writer/reference-scanners.d.ts +42 -0
- package/dist/browser/modules/word/writer/reference-scanners.js +111 -0
- package/dist/browser/modules/word/writer/relationships.d.ts +52 -0
- package/dist/browser/modules/word/writer/relationships.js +117 -0
- package/dist/browser/modules/word/writer/render-context.d.ts +124 -0
- package/dist/browser/modules/word/writer/render-context.js +46 -0
- package/dist/browser/modules/word/{writers → writer}/run-writer.d.ts +10 -1
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/run-writer.js +126 -24
- package/dist/browser/modules/word/writer/sdt-writer.d.ts +25 -0
- package/dist/browser/modules/word/writer/sdt-writer.js +189 -0
- package/dist/browser/modules/word/writer/stream-buf.d.ts +37 -0
- package/dist/browser/modules/word/writer/stream-buf.js +73 -0
- package/dist/browser/modules/word/writer/streaming-writer.d.ts +344 -0
- package/dist/browser/modules/word/writer/streaming-writer.js +1382 -0
- package/dist/browser/modules/word/writer/string-buf.d.ts +8 -0
- package/dist/browser/modules/word/writer/string-buf.js +7 -0
- package/dist/browser/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/browser/modules/word/{writers → writer}/table-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/browser/modules/xml/types.d.ts +22 -0
- package/dist/browser/utils/crypto.browser.d.ts +3 -1
- package/dist/browser/utils/crypto.browser.js +3 -1
- package/dist/browser/utils/crypto.d.ts +4 -1
- package/dist/browser/utils/crypto.js +4 -1
- package/dist/browser/utils/font-metrics.d.ts +63 -0
- package/dist/browser/utils/font-metrics.js +293 -0
- package/dist/browser/utils/string-buf.d.ts +42 -0
- package/dist/browser/utils/string-buf.js +89 -0
- package/dist/browser/utils/theme-colors.d.ts +55 -0
- package/dist/browser/utils/theme-colors.js +120 -0
- package/dist/cjs/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/cjs/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/cjs/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/cjs/modules/archive/fs/archive-file.js +78 -16
- package/dist/cjs/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/cjs/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/cjs/modules/excel/chart/chart.js +1 -7
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/cjs/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/cjs/modules/excel/utils/string-buf.js +5 -81
- package/dist/cjs/modules/excel/workbook.browser.js +135 -25
- package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/cjs/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/cjs/modules/pdf/excel-bridge.js +33 -0
- package/dist/cjs/modules/pdf/font/metrics.js +11 -244
- package/dist/cjs/modules/pdf/index.js +2 -1
- package/dist/cjs/modules/pdf/render-layout-to-pdf.js +651 -0
- package/dist/cjs/modules/pdf/word-bridge.js +155 -274
- package/dist/cjs/modules/stream/index.base.js +4 -2
- package/dist/cjs/modules/stream/internal/sink-adapter.js +202 -0
- package/dist/cjs/modules/stream/pull-stream.js +51 -5
- package/dist/cjs/modules/word/advanced/diff.js +170 -0
- package/dist/cjs/modules/word/advanced/drawing-shapes.js +279 -0
- package/dist/cjs/modules/word/advanced/field-engine.js +1229 -0
- package/dist/cjs/modules/word/advanced/glossary.js +87 -0
- package/dist/cjs/modules/word/advanced/math-convert.js +599 -0
- package/dist/cjs/modules/word/advanced/ole-objects.js +277 -0
- package/dist/cjs/modules/word/advanced/style-map.js +329 -0
- package/dist/cjs/modules/word/advanced/validation.js +1068 -0
- package/dist/cjs/modules/word/advanced/vba-project.js +274 -0
- package/dist/cjs/modules/word/bridge/excel-bridge.js +1020 -0
- package/dist/cjs/modules/word/builder/document-handle.js +667 -0
- package/dist/cjs/modules/word/builder/paragraph-builders.js +109 -0
- package/dist/cjs/modules/word/builder/run-builders.js +676 -0
- package/dist/cjs/modules/word/builder/table-builders.js +53 -0
- package/dist/cjs/modules/word/constants.js +111 -2
- package/dist/cjs/modules/word/convert/conversion-ir.js +34 -0
- package/dist/cjs/modules/word/convert/docx-to-semantic.js +502 -0
- package/dist/cjs/modules/word/convert/flat-opc.js +390 -0
- package/dist/cjs/modules/word/convert/html/html-import.js +1910 -0
- package/dist/cjs/modules/word/{html-renderer.js → convert/html/html-renderer.js} +420 -69
- package/dist/cjs/modules/word/convert/html/html.js +20 -0
- package/dist/cjs/modules/word/convert/markdown/markdown-import.js +1329 -0
- package/dist/cjs/modules/word/convert/markdown/markdown-renderer.js +637 -0
- package/dist/cjs/modules/word/convert/markdown/markdown.js +21 -0
- package/dist/cjs/modules/word/convert/odt/odt.js +1936 -0
- package/dist/cjs/modules/word/core/color-utils.js +47 -0
- package/dist/cjs/modules/word/core/internal-utils.js +219 -0
- package/dist/cjs/modules/word/core/mapper.js +430 -0
- package/dist/cjs/modules/word/core/opc-paths.js +53 -0
- package/dist/cjs/modules/word/core/text-utils.js +210 -0
- package/dist/cjs/modules/word/core/walker.js +577 -0
- package/dist/cjs/modules/word/crypto.js +19 -8
- package/dist/cjs/modules/word/document-io.js +117 -197
- package/dist/cjs/modules/word/errors.js +59 -13
- package/dist/cjs/modules/word/excel.js +22 -0
- package/dist/cjs/modules/word/font/font-embed.js +652 -0
- package/dist/cjs/modules/word/{font-obfuscation.js → font/font-obfuscation.js} +4 -9
- package/dist/cjs/modules/word/font/hyphenation.js +4216 -0
- package/dist/cjs/modules/word/font/text-shaping.js +640 -0
- package/dist/cjs/modules/word/html.js +9 -7
- package/dist/cjs/modules/word/incremental-edit.js +366 -0
- package/dist/cjs/modules/word/index.base.js +370 -137
- package/dist/cjs/modules/word/layout/layout-constants.js +20 -0
- package/dist/cjs/modules/word/layout/layout-full.js +1699 -0
- package/dist/cjs/modules/word/layout/layout-model.js +17 -0
- package/dist/cjs/modules/word/layout/layout.js +1170 -0
- package/dist/cjs/modules/word/layout/render-page.js +1243 -0
- package/dist/cjs/modules/word/markdown.js +19 -0
- package/dist/cjs/modules/word/patcher.js +539 -0
- package/dist/cjs/modules/word/query/compat.js +61 -0
- package/dist/cjs/modules/word/query/data-binding.js +395 -0
- package/dist/cjs/modules/word/query/form-fields.js +272 -0
- package/dist/cjs/modules/word/query/format-search.js +334 -0
- package/dist/cjs/modules/word/query/mail-merge.js +114 -0
- package/dist/cjs/modules/word/query/merge.js +620 -0
- package/dist/cjs/modules/word/query/replace.js +304 -0
- package/dist/cjs/modules/word/query/revisions.js +885 -0
- package/dist/cjs/modules/word/query/search.js +361 -0
- package/dist/cjs/modules/word/query/split.js +138 -0
- package/dist/cjs/modules/word/query/style-resolve.js +374 -0
- package/dist/cjs/modules/word/reader/chart-parser.js +814 -0
- package/dist/cjs/modules/word/reader/comments-parser.js +96 -0
- package/dist/cjs/modules/word/reader/doc-props-parsers.js +194 -0
- package/dist/cjs/modules/word/reader/docx-reader.js +2560 -0
- package/dist/cjs/modules/word/reader/drawing-helpers.js +90 -0
- package/dist/cjs/modules/word/reader/form-field-parser.js +85 -0
- package/dist/cjs/modules/word/reader/image-parsers.js +293 -0
- package/dist/cjs/modules/word/reader/math-parser.js +424 -0
- package/dist/cjs/modules/word/reader/metadata-parsers.js +93 -0
- package/dist/cjs/modules/word/reader/numbering-parser.js +168 -0
- package/dist/cjs/modules/word/reader/paragraph-section-parsers.js +505 -0
- package/dist/cjs/modules/word/reader/parse-utils.js +271 -0
- package/dist/cjs/modules/word/reader/properties-parsers.js +338 -0
- package/dist/cjs/modules/word/reader/reader-context.js +66 -0
- package/dist/cjs/modules/word/reader/sdt-helpers.js +114 -0
- package/dist/cjs/modules/word/reader/settings-parser.js +265 -0
- package/dist/cjs/modules/word/reader/styles-parser.js +149 -0
- package/dist/cjs/modules/word/reader/table-properties-parsers.js +237 -0
- package/dist/cjs/modules/word/reader/theme-parser.js +169 -0
- package/dist/cjs/modules/word/reader/watermark-parser.js +113 -0
- package/dist/cjs/modules/word/security/cfb-reader.js +414 -0
- package/dist/cjs/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/cjs/modules/word/security/document-protection.js +208 -0
- package/dist/cjs/modules/word/security/encryption.js +612 -0
- package/dist/cjs/modules/word/security/policy.js +106 -0
- package/dist/cjs/modules/word/template/template-chart.js +170 -0
- package/dist/cjs/modules/word/template/template-datasource.js +549 -0
- package/dist/cjs/modules/word/template/template-engine.js +1430 -0
- package/dist/cjs/modules/word/units.js +44 -14
- package/dist/cjs/modules/word/{writers → writer}/chart-writer.js +163 -22
- package/dist/cjs/modules/word/writer/checkbox-writer.js +82 -0
- package/dist/cjs/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/cjs/modules/word/writer/common-parts.js +104 -0
- package/dist/cjs/modules/word/{content-types.js → writer/content-types.js} +14 -6
- package/dist/cjs/modules/word/writer/document-writer.js +478 -0
- package/dist/cjs/modules/word/writer/docx-packager.js +1551 -0
- package/dist/cjs/modules/word/{writers → writer}/footnote-writer.js +13 -10
- package/dist/cjs/modules/word/{writers → writer}/header-footer-writer.js +38 -20
- package/dist/cjs/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/cjs/modules/word/{writers → writer}/math-writer.js +21 -1
- package/dist/cjs/modules/word/{writers → writer}/numbering-writer.js +11 -4
- package/dist/cjs/modules/word/{writers → writer}/paragraph-writer.js +72 -37
- package/dist/cjs/modules/word/{writers → writer}/parts-writer.js +91 -12
- package/dist/cjs/modules/word/writer/reference-scanners.js +120 -0
- package/dist/cjs/modules/word/writer/relationships.js +124 -0
- package/dist/cjs/modules/word/writer/render-context.js +51 -0
- package/dist/cjs/modules/word/{writers → writer}/run-writer.js +127 -24
- package/dist/cjs/modules/word/writer/sdt-writer.js +192 -0
- package/dist/cjs/modules/word/writer/stream-buf.js +76 -0
- package/dist/cjs/modules/word/writer/streaming-writer.js +1387 -0
- package/dist/cjs/modules/word/writer/string-buf.js +11 -0
- package/dist/cjs/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/cjs/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/cjs/utils/crypto.browser.js +3 -1
- package/dist/cjs/utils/crypto.js +4 -1
- package/dist/cjs/utils/font-metrics.js +303 -0
- package/dist/cjs/utils/string-buf.js +92 -0
- package/dist/cjs/utils/theme-colors.js +126 -0
- package/dist/esm/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/esm/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/esm/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/esm/modules/archive/fs/archive-file.js +78 -16
- package/dist/esm/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/esm/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/esm/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/esm/modules/excel/chart/chart.js +1 -7
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/esm/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/esm/modules/excel/utils/string-buf.js +4 -81
- package/dist/esm/modules/excel/workbook.browser.js +135 -25
- package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/esm/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/esm/modules/pdf/excel-bridge.js +32 -0
- package/dist/esm/modules/pdf/font/metrics.js +3 -237
- package/dist/esm/modules/pdf/index.js +1 -1
- package/dist/esm/modules/pdf/render-layout-to-pdf.js +647 -0
- package/dist/esm/modules/pdf/word-bridge.js +122 -274
- package/dist/esm/modules/stream/index.base.js +2 -1
- package/dist/esm/modules/stream/internal/sink-adapter.js +198 -0
- package/dist/esm/modules/stream/pull-stream.js +51 -5
- package/dist/esm/modules/word/advanced/diff.js +167 -0
- package/dist/esm/modules/word/advanced/drawing-shapes.js +268 -0
- package/dist/esm/modules/word/advanced/field-engine.js +1225 -0
- package/dist/esm/modules/word/advanced/glossary.js +79 -0
- package/dist/esm/modules/word/advanced/math-convert.js +595 -0
- package/dist/esm/modules/word/advanced/ole-objects.js +271 -0
- package/dist/esm/modules/word/advanced/style-map.js +322 -0
- package/dist/esm/modules/word/advanced/validation.js +1065 -0
- package/dist/esm/modules/word/advanced/vba-project.js +265 -0
- package/dist/esm/modules/word/bridge/excel-bridge.js +980 -0
- package/dist/esm/modules/word/builder/document-handle.js +664 -0
- package/dist/esm/modules/word/builder/paragraph-builders.js +90 -0
- package/dist/esm/modules/word/builder/run-builders.js +600 -0
- package/dist/esm/modules/word/builder/table-builders.js +45 -0
- package/dist/esm/modules/word/constants.js +109 -1
- package/dist/esm/modules/word/convert/conversion-ir.js +31 -0
- package/dist/esm/modules/word/convert/docx-to-semantic.js +499 -0
- package/dist/esm/modules/word/convert/flat-opc.js +385 -0
- package/dist/esm/modules/word/convert/html/html-import.js +1907 -0
- package/dist/{browser/modules/word → esm/modules/word/convert/html}/html-renderer.js +420 -69
- package/dist/esm/modules/word/convert/html/html.js +15 -0
- package/dist/esm/modules/word/convert/markdown/markdown-import.js +1325 -0
- package/dist/esm/modules/word/convert/markdown/markdown-renderer.js +634 -0
- package/dist/esm/modules/word/convert/markdown/markdown.js +15 -0
- package/dist/esm/modules/word/convert/odt/odt.js +1932 -0
- package/dist/esm/modules/word/core/color-utils.js +43 -0
- package/dist/esm/modules/word/core/internal-utils.js +209 -0
- package/dist/esm/modules/word/core/mapper.js +427 -0
- package/dist/esm/modules/word/core/opc-paths.js +48 -0
- package/dist/esm/modules/word/core/text-utils.js +202 -0
- package/dist/esm/modules/word/core/walker.js +570 -0
- package/dist/esm/modules/word/crypto.js +13 -7
- package/dist/esm/modules/word/document-io.js +80 -197
- package/dist/esm/modules/word/errors.js +54 -2
- package/dist/esm/modules/word/excel.js +13 -0
- package/dist/esm/modules/word/font/font-embed.js +646 -0
- package/dist/{browser/modules/word → esm/modules/word/font}/font-obfuscation.js +4 -9
- package/dist/esm/modules/word/font/hyphenation.js +4210 -0
- package/dist/esm/modules/word/font/text-shaping.js +635 -0
- package/dist/esm/modules/word/html.js +6 -5
- package/dist/esm/modules/word/incremental-edit.js +361 -0
- package/dist/esm/modules/word/index.base.js +138 -29
- package/dist/esm/modules/word/layout/layout-constants.js +17 -0
- package/dist/esm/modules/word/layout/layout-full.js +1696 -0
- package/dist/esm/modules/word/layout/layout-model.js +16 -0
- package/dist/esm/modules/word/layout/layout.js +1167 -0
- package/dist/esm/modules/word/layout/render-page.js +1238 -0
- package/dist/esm/modules/word/markdown.js +13 -0
- package/dist/esm/modules/word/patcher.js +537 -0
- package/dist/esm/modules/word/query/compat.js +58 -0
- package/dist/esm/modules/word/query/data-binding.js +392 -0
- package/dist/esm/modules/word/query/form-fields.js +268 -0
- package/dist/esm/modules/word/query/format-search.js +329 -0
- package/dist/esm/modules/word/query/mail-merge.js +111 -0
- package/dist/esm/modules/word/query/merge.js +617 -0
- package/dist/esm/modules/word/query/replace.js +301 -0
- package/dist/esm/modules/word/query/revisions.js +879 -0
- package/dist/esm/modules/word/query/search.js +346 -0
- package/dist/esm/modules/word/query/split.js +135 -0
- package/dist/esm/modules/word/query/style-resolve.js +368 -0
- package/dist/esm/modules/word/reader/chart-parser.js +810 -0
- package/dist/esm/modules/word/reader/comments-parser.js +92 -0
- package/dist/esm/modules/word/reader/doc-props-parsers.js +190 -0
- package/dist/esm/modules/word/reader/docx-reader.js +2557 -0
- package/dist/esm/modules/word/reader/drawing-helpers.js +84 -0
- package/dist/esm/modules/word/reader/form-field-parser.js +82 -0
- package/dist/esm/modules/word/reader/image-parsers.js +291 -0
- package/dist/esm/modules/word/reader/math-parser.js +422 -0
- package/dist/esm/modules/word/reader/metadata-parsers.js +87 -0
- package/dist/esm/modules/word/reader/numbering-parser.js +166 -0
- package/dist/esm/modules/word/reader/paragraph-section-parsers.js +503 -0
- package/dist/esm/modules/word/reader/parse-utils.js +249 -0
- package/dist/esm/modules/word/reader/properties-parsers.js +332 -0
- package/dist/esm/modules/word/reader/reader-context.js +61 -0
- package/dist/esm/modules/word/reader/sdt-helpers.js +111 -0
- package/dist/esm/modules/word/reader/settings-parser.js +263 -0
- package/dist/esm/modules/word/reader/styles-parser.js +147 -0
- package/dist/esm/modules/word/reader/table-properties-parsers.js +234 -0
- package/dist/esm/modules/word/reader/theme-parser.js +167 -0
- package/dist/esm/modules/word/reader/watermark-parser.js +110 -0
- package/dist/esm/modules/word/security/cfb-reader.js +410 -0
- package/dist/esm/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/esm/modules/word/security/document-protection.js +201 -0
- package/dist/esm/modules/word/security/encryption.js +602 -0
- package/dist/esm/modules/word/security/policy.js +102 -0
- package/dist/esm/modules/word/template/template-chart.js +167 -0
- package/dist/esm/modules/word/template/template-datasource.js +541 -0
- package/dist/esm/modules/word/template/template-engine.js +1435 -0
- package/dist/esm/modules/word/units.js +43 -14
- package/dist/esm/modules/word/{writers → writer}/chart-writer.js +164 -23
- package/dist/esm/modules/word/writer/checkbox-writer.js +79 -0
- package/dist/esm/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/esm/modules/word/writer/common-parts.js +101 -0
- package/dist/{browser/modules/word → esm/modules/word/writer}/content-types.js +14 -6
- package/dist/esm/modules/word/writer/document-writer.js +473 -0
- package/dist/esm/modules/word/writer/docx-packager.js +1515 -0
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/footnote-writer.js +13 -10
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/header-footer-writer.js +39 -21
- package/dist/esm/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/math-writer.js +21 -1
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/numbering-writer.js +11 -4
- package/dist/esm/modules/word/{writers → writer}/paragraph-writer.js +73 -38
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/parts-writer.js +91 -12
- package/dist/esm/modules/word/writer/reference-scanners.js +111 -0
- package/dist/esm/modules/word/writer/relationships.js +117 -0
- package/dist/esm/modules/word/writer/render-context.js +46 -0
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/run-writer.js +126 -24
- package/dist/esm/modules/word/writer/sdt-writer.js +189 -0
- package/dist/esm/modules/word/writer/stream-buf.js +73 -0
- package/dist/esm/modules/word/writer/streaming-writer.js +1382 -0
- package/dist/esm/modules/word/writer/string-buf.js +7 -0
- package/dist/esm/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/esm/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/esm/utils/crypto.browser.js +3 -1
- package/dist/esm/utils/crypto.js +4 -1
- package/dist/esm/utils/font-metrics.js +293 -0
- package/dist/esm/utils/string-buf.js +89 -0
- package/dist/esm/utils/theme-colors.js +120 -0
- package/dist/iife/excelts.iife.js +70692 -70337
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +57 -57
- package/dist/types/modules/archive/fs/archive-file.d.ts +8 -5
- package/dist/types/modules/excel/chart/chart-ex-types.d.ts +0 -12
- package/dist/types/modules/excel/chart/chart.d.ts +1 -5
- package/dist/types/modules/excel/chart/types.d.ts +0 -6
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +40 -0
- package/dist/types/modules/excel/utils/string-buf.d.ts +5 -26
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +19 -9
- package/dist/types/modules/excel/xlsx/xlsx.d.ts +10 -2
- package/dist/types/modules/pdf/excel-bridge.d.ts +30 -1
- package/dist/types/modules/pdf/font/metrics.d.ts +3 -52
- package/dist/types/modules/pdf/index.d.ts +1 -1
- package/dist/types/modules/pdf/render-layout-to-pdf.d.ts +66 -0
- package/dist/types/modules/pdf/word-bridge.d.ts +80 -12
- package/dist/types/modules/stream/index.base.d.ts +2 -0
- package/dist/types/modules/stream/internal/sink-adapter.d.ts +65 -0
- package/dist/types/modules/stream/pull-stream.d.ts +19 -2
- package/dist/types/modules/stream/types.d.ts +13 -1
- package/dist/types/modules/word/advanced/diff.d.ts +61 -0
- package/dist/types/modules/word/advanced/drawing-shapes.d.ts +269 -0
- package/dist/types/modules/word/advanced/field-engine.d.ts +43 -0
- package/dist/types/modules/word/advanced/glossary.d.ts +86 -0
- package/dist/types/modules/word/advanced/math-convert.d.ts +30 -0
- package/dist/types/modules/word/advanced/ole-objects.d.ts +115 -0
- package/dist/types/modules/word/advanced/style-map.d.ts +105 -0
- package/dist/types/modules/word/advanced/validation.d.ts +56 -0
- package/dist/types/modules/word/advanced/vba-project.d.ts +91 -0
- package/dist/types/modules/word/bridge/excel-bridge.d.ts +127 -0
- package/dist/types/modules/word/builder/document-handle.d.ts +151 -0
- package/dist/types/modules/word/builder/paragraph-builders.d.ts +61 -0
- package/dist/types/modules/word/builder/run-builders.d.ts +374 -0
- package/dist/types/modules/word/builder/table-builders.d.ts +23 -0
- package/dist/types/modules/word/constants.d.ts +39 -1
- package/dist/types/modules/word/convert/conversion-ir.d.ts +210 -0
- package/dist/types/modules/word/convert/docx-to-semantic.d.ts +39 -0
- package/dist/types/modules/word/convert/flat-opc.d.ts +44 -0
- package/dist/types/modules/word/convert/html/html-import.d.ts +50 -0
- package/dist/{browser/modules/word → types/modules/word/convert/html}/html-renderer.d.ts +14 -1
- package/dist/types/modules/word/convert/html/html.d.ts +15 -0
- package/dist/types/modules/word/convert/markdown/markdown-import.d.ts +68 -0
- package/dist/types/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
- package/dist/types/modules/word/convert/markdown/markdown.d.ts +15 -0
- package/dist/types/modules/word/convert/odt/odt.d.ts +41 -0
- package/dist/types/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
- package/dist/types/modules/word/core/internal-utils.d.ts +90 -0
- package/dist/types/modules/word/core/mapper.d.ts +44 -0
- package/dist/types/modules/word/core/opc-paths.d.ts +33 -0
- package/dist/types/modules/word/core/text-utils.d.ts +38 -0
- package/dist/types/modules/word/core/walker.d.ts +119 -0
- package/dist/types/modules/word/crypto.d.ts +14 -9
- package/dist/types/modules/word/document-io.d.ts +59 -27
- package/dist/types/modules/word/errors.d.ts +44 -1
- package/dist/types/modules/word/excel.d.ts +14 -0
- package/dist/types/modules/word/font/font-embed.d.ts +112 -0
- package/dist/types/modules/word/font/hyphenation.d.ts +65 -0
- package/dist/types/modules/word/font/text-shaping.d.ts +58 -0
- package/dist/types/modules/word/html.d.ts +7 -6
- package/dist/types/modules/word/incremental-edit.d.ts +123 -0
- package/dist/types/modules/word/index.base.d.ts +194 -10
- package/dist/types/modules/word/layout/layout-constants.d.ts +17 -0
- package/dist/types/modules/word/layout/layout-full.d.ts +53 -0
- package/dist/types/modules/word/layout/layout-model.d.ts +344 -0
- package/dist/types/modules/word/layout/layout.d.ts +63 -0
- package/dist/types/modules/word/layout/render-page.d.ts +57 -0
- package/dist/types/modules/word/markdown.d.ts +14 -0
- package/dist/types/modules/word/patcher.d.ts +62 -0
- package/dist/types/modules/word/query/compat.d.ts +25 -0
- package/dist/types/modules/word/query/data-binding.d.ts +22 -0
- package/dist/types/modules/word/query/form-fields.d.ts +41 -0
- package/dist/types/modules/word/query/format-search.d.ts +99 -0
- package/dist/types/modules/word/query/mail-merge.d.ts +25 -0
- package/dist/types/modules/word/query/merge.d.ts +50 -0
- package/dist/types/modules/word/query/replace.d.ts +47 -0
- package/dist/types/modules/word/query/revisions.d.ts +67 -0
- package/dist/types/modules/word/query/search.d.ts +129 -0
- package/dist/types/modules/word/query/split.d.ts +44 -0
- package/dist/types/modules/word/query/style-resolve.d.ts +104 -0
- package/dist/types/modules/word/reader/chart-parser.d.ts +20 -0
- package/dist/types/modules/word/reader/comments-parser.d.ts +26 -0
- package/dist/types/modules/word/reader/doc-props-parsers.d.ts +15 -0
- package/dist/types/modules/word/reader/docx-reader.d.ts +27 -0
- package/dist/types/modules/word/reader/drawing-helpers.d.ts +27 -0
- package/dist/types/modules/word/reader/form-field-parser.d.ts +21 -0
- package/dist/types/modules/word/reader/image-parsers.d.ts +11 -0
- package/dist/types/modules/word/reader/math-parser.d.ts +12 -0
- package/dist/types/modules/word/reader/metadata-parsers.d.ts +17 -0
- package/dist/types/modules/word/reader/numbering-parser.d.ts +13 -0
- package/dist/types/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
- package/dist/types/modules/word/reader/parse-utils.d.ts +91 -0
- package/dist/types/modules/word/reader/properties-parsers.d.ts +21 -0
- package/dist/types/modules/word/reader/reader-context.d.ts +69 -0
- package/dist/types/modules/word/reader/sdt-helpers.d.ts +29 -0
- package/dist/types/modules/word/reader/settings-parser.d.ts +8 -0
- package/dist/types/modules/word/reader/styles-parser.d.ts +12 -0
- package/dist/types/modules/word/reader/table-properties-parsers.d.ts +12 -0
- package/dist/types/modules/word/reader/theme-parser.d.ts +8 -0
- package/dist/types/modules/word/reader/watermark-parser.d.ts +15 -0
- package/dist/types/modules/word/security/cfb-reader.d.ts +37 -0
- package/dist/types/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
- package/dist/types/modules/word/security/document-protection.d.ts +93 -0
- package/dist/{browser/modules/word → types/modules/word/security}/encryption.d.ts +51 -4
- package/dist/types/modules/word/security/policy.d.ts +80 -0
- package/dist/types/modules/word/template/template-chart.d.ts +56 -0
- package/dist/types/modules/word/template/template-datasource.d.ts +154 -0
- package/dist/types/modules/word/template/template-engine.d.ts +121 -0
- package/dist/types/modules/word/types.d.ts +224 -25
- package/dist/types/modules/word/units.d.ts +26 -0
- package/dist/types/modules/word/writer/checkbox-writer.d.ts +17 -0
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/comment-writer.d.ts +2 -1
- package/dist/types/modules/word/writer/common-parts.d.ts +57 -0
- package/dist/{browser/modules/word → types/modules/word/writer}/content-types.d.ts +2 -2
- package/dist/types/modules/word/writer/document-writer.d.ts +24 -0
- package/dist/types/modules/word/writer/docx-packager.d.ts +35 -0
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/footnote-writer.d.ts +3 -2
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/header-footer-writer.d.ts +3 -2
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/image-writer.d.ts +1 -1
- package/dist/types/modules/word/writer/math-writer.d.ts +20 -0
- package/dist/types/modules/word/{writers → writer}/numbering-writer.d.ts +1 -1
- package/dist/types/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
- package/dist/types/modules/word/{writers → writer}/parts-writer.d.ts +3 -3
- package/dist/types/modules/word/writer/reference-scanners.d.ts +42 -0
- package/dist/types/modules/word/writer/relationships.d.ts +52 -0
- package/dist/types/modules/word/writer/render-context.d.ts +124 -0
- package/dist/types/modules/word/{writers → writer}/run-writer.d.ts +10 -1
- package/dist/types/modules/word/writer/sdt-writer.d.ts +25 -0
- package/dist/types/modules/word/writer/stream-buf.d.ts +37 -0
- package/dist/types/modules/word/writer/streaming-writer.d.ts +344 -0
- package/dist/types/modules/word/writer/string-buf.d.ts +8 -0
- package/dist/types/modules/word/{writers → writer}/table-writer.d.ts +2 -1
- package/dist/types/modules/xml/types.d.ts +22 -0
- package/dist/types/utils/crypto.browser.d.ts +3 -1
- package/dist/types/utils/crypto.d.ts +4 -1
- package/dist/types/utils/font-metrics.d.ts +63 -0
- package/dist/types/utils/string-buf.d.ts +42 -0
- package/dist/types/utils/theme-colors.d.ts +55 -0
- package/package.json +121 -39
- package/dist/browser/modules/word/color-utils.js +0 -94
- package/dist/browser/modules/word/document.d.ts +0 -657
- package/dist/browser/modules/word/document.js +0 -1533
- package/dist/browser/modules/word/docx-packager.d.ts +0 -14
- package/dist/browser/modules/word/docx-packager.js +0 -822
- package/dist/browser/modules/word/docx-reader.d.ts +0 -11
- package/dist/browser/modules/word/docx-reader.js +0 -4929
- package/dist/browser/modules/word/encryption.js +0 -274
- package/dist/browser/modules/word/internal-utils.d.ts +0 -23
- package/dist/browser/modules/word/internal-utils.js +0 -54
- package/dist/browser/modules/word/namespaces.d.ts +0 -159
- package/dist/browser/modules/word/namespaces.js +0 -189
- package/dist/browser/modules/word/relationships.d.ts +0 -30
- package/dist/browser/modules/word/relationships.js +0 -48
- package/dist/browser/modules/word/writers/checkbox-writer.d.ts +0 -9
- package/dist/browser/modules/word/writers/checkbox-writer.js +0 -42
- package/dist/browser/modules/word/writers/document-writer.d.ts +0 -16
- package/dist/browser/modules/word/writers/document-writer.js +0 -461
- package/dist/browser/modules/word/writers/math-writer.d.ts +0 -9
- package/dist/cjs/modules/word/color-utils.js +0 -97
- package/dist/cjs/modules/word/document.js +0 -1645
- package/dist/cjs/modules/word/docx-packager.js +0 -825
- package/dist/cjs/modules/word/docx-reader.js +0 -4932
- package/dist/cjs/modules/word/encryption.js +0 -282
- package/dist/cjs/modules/word/internal-utils.js +0 -59
- package/dist/cjs/modules/word/namespaces.js +0 -192
- package/dist/cjs/modules/word/relationships.js +0 -55
- package/dist/cjs/modules/word/writers/checkbox-writer.js +0 -45
- package/dist/cjs/modules/word/writers/document-writer.js +0 -465
- package/dist/esm/modules/word/color-utils.js +0 -94
- package/dist/esm/modules/word/document.js +0 -1533
- package/dist/esm/modules/word/docx-packager.js +0 -822
- package/dist/esm/modules/word/docx-reader.js +0 -4929
- package/dist/esm/modules/word/encryption.js +0 -274
- package/dist/esm/modules/word/internal-utils.js +0 -54
- package/dist/esm/modules/word/namespaces.js +0 -189
- package/dist/esm/modules/word/relationships.js +0 -48
- package/dist/esm/modules/word/writers/checkbox-writer.js +0 -42
- package/dist/esm/modules/word/writers/document-writer.js +0 -461
- package/dist/types/modules/word/document.d.ts +0 -657
- package/dist/types/modules/word/docx-packager.d.ts +0 -14
- package/dist/types/modules/word/docx-reader.d.ts +0 -11
- package/dist/types/modules/word/internal-utils.d.ts +0 -23
- package/dist/types/modules/word/namespaces.d.ts +0 -159
- package/dist/types/modules/word/relationships.d.ts +0 -30
- package/dist/types/modules/word/writers/checkbox-writer.d.ts +0 -9
- package/dist/types/modules/word/writers/document-writer.d.ts +0 -16
- package/dist/types/modules/word/writers/math-writer.d.ts +0 -9
- /package/dist/browser/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
- /package/dist/browser/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/section-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/browser/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/browser/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/types/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
- /package/dist/types/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/section-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Re-export of the shared {@link StringBuf} from `@utils/string-buf`.
|
|
4
|
+
*
|
|
5
|
+
* Kept as a thin alias so existing relative imports (`./string-buf`) within
|
|
6
|
+
* the word writer continue to work without churn.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.StringBuf = void 0;
|
|
10
|
+
var string_buf_1 = require("../../../utils/string-buf.js");
|
|
11
|
+
Object.defineProperty(exports, "StringBuf", { enumerable: true, get: function () { return string_buf_1.StringBuf; } });
|
|
@@ -64,12 +64,43 @@ function renderTableStyleCondition(xml, condition) {
|
|
|
64
64
|
(0, run_writer_1.renderShading)(xml, condition.cellProperties.shading);
|
|
65
65
|
}
|
|
66
66
|
if (condition.cellProperties.borders) {
|
|
67
|
-
|
|
67
|
+
renderCellBordersInStyle(xml, condition.cellProperties.borders);
|
|
68
68
|
}
|
|
69
69
|
xml.closeNode();
|
|
70
70
|
}
|
|
71
71
|
xml.closeNode();
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Render cell borders inside a style definition (w:tcBorders).
|
|
75
|
+
* Cell-level border container is `w:tcBorders`, not `w:tblBorders` — using
|
|
76
|
+
* the wrong wrapper produces invalid styles.xml that Word silently ignores.
|
|
77
|
+
*/
|
|
78
|
+
function renderCellBordersInStyle(xml, borders) {
|
|
79
|
+
xml.openNode("w:tcBorders");
|
|
80
|
+
for (const side of [
|
|
81
|
+
"top",
|
|
82
|
+
"left",
|
|
83
|
+
"bottom",
|
|
84
|
+
"right",
|
|
85
|
+
"insideH",
|
|
86
|
+
"insideV",
|
|
87
|
+
"start",
|
|
88
|
+
"end",
|
|
89
|
+
"tl2br",
|
|
90
|
+
"tr2bl"
|
|
91
|
+
]) {
|
|
92
|
+
const b = borders[side];
|
|
93
|
+
if (b) {
|
|
94
|
+
xml.leafNode(`w:${side}`, {
|
|
95
|
+
"w:val": b.style,
|
|
96
|
+
"w:sz": String(b.size ?? 4),
|
|
97
|
+
"w:space": String(b.space ?? 0),
|
|
98
|
+
"w:color": b.color ?? "auto"
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
xml.closeNode();
|
|
103
|
+
}
|
|
73
104
|
/** Render table borders inside a style definition. */
|
|
74
105
|
function renderTableBordersInStyle(xml, borders) {
|
|
75
106
|
xml.openNode("w:tblBorders");
|
|
@@ -325,6 +325,14 @@ function renderTableCellProperties(xml, cPr, insidePropertyChange = false) {
|
|
|
325
325
|
if (cPr.width) {
|
|
326
326
|
renderTableWidth(xml, "w:tcW", cPr.width);
|
|
327
327
|
}
|
|
328
|
+
else {
|
|
329
|
+
// OOXML's CT_TcPr.tcW is technically optional, but Word treats a
|
|
330
|
+
// missing <w:tcW> as a hard schema violation: it triggers the
|
|
331
|
+
// "content unreadable" repair dialog and silently drops the table.
|
|
332
|
+
// Emit a w:type="auto" placeholder so Word lays the cell out using
|
|
333
|
+
// the table-level grid widths.
|
|
334
|
+
xml.leafNode("w:tcW", { "w:w": "0", "w:type": "auto" });
|
|
335
|
+
}
|
|
328
336
|
if (cPr.gridSpan !== undefined && cPr.gridSpan > 1) {
|
|
329
337
|
xml.leafNode("w:gridSpan", { "w:val": String(cPr.gridSpan) });
|
|
330
338
|
}
|
|
@@ -415,12 +423,24 @@ function renderTableCellProperties(xml, cPr, insidePropertyChange = false) {
|
|
|
415
423
|
xml.closeNode();
|
|
416
424
|
}
|
|
417
425
|
/** Render a table cell. */
|
|
418
|
-
function renderTableCell(xml, cell) {
|
|
426
|
+
function renderTableCell(xml, cell, helpers) {
|
|
419
427
|
xml.openNode("w:tc");
|
|
428
|
+
// OOXML CT_Tc requires a <w:tcPr> with at least <w:tcW> for Word to
|
|
429
|
+
// accept the cell. If the model didn't supply any cell properties we
|
|
430
|
+
// synthesise a minimal <w:tcPr><w:tcW w:type="auto"/></w:tcPr>; if it
|
|
431
|
+
// did, renderTableCellProperties handles the missing-tcW fallback.
|
|
420
432
|
if (cell.properties) {
|
|
421
433
|
renderTableCellProperties(xml, cell.properties);
|
|
422
434
|
}
|
|
423
|
-
|
|
435
|
+
else {
|
|
436
|
+
xml.openNode("w:tcPr");
|
|
437
|
+
xml.leafNode("w:tcW", { "w:w": "0", "w:type": "auto" });
|
|
438
|
+
xml.closeNode();
|
|
439
|
+
}
|
|
440
|
+
// OOXML §17.4.66 (CT_Tc) requires every table cell to *end* with a
|
|
441
|
+
// <w:p>. An empty cell needs at least one <w:p>, and a cell whose last
|
|
442
|
+
// block is a nested <w:tbl> must have a trailing <w:p> after it — Word
|
|
443
|
+
// (and LibreOffice) reject the document otherwise.
|
|
424
444
|
if (cell.content.length === 0) {
|
|
425
445
|
xml.openNode("w:p");
|
|
426
446
|
xml.closeNode();
|
|
@@ -428,17 +448,22 @@ function renderTableCell(xml, cell) {
|
|
|
428
448
|
else {
|
|
429
449
|
for (const block of cell.content) {
|
|
430
450
|
if (block.type === "paragraph") {
|
|
431
|
-
(0, paragraph_writer_1.renderParagraph)(xml, block);
|
|
451
|
+
(0, paragraph_writer_1.renderParagraph)(xml, block, helpers);
|
|
432
452
|
}
|
|
433
453
|
else if (block.type === "table") {
|
|
434
|
-
renderTable(xml, block);
|
|
454
|
+
renderTable(xml, block, helpers);
|
|
435
455
|
}
|
|
436
456
|
}
|
|
457
|
+
const last = cell.content[cell.content.length - 1];
|
|
458
|
+
if (last && last.type === "table") {
|
|
459
|
+
xml.openNode("w:p");
|
|
460
|
+
xml.closeNode();
|
|
461
|
+
}
|
|
437
462
|
}
|
|
438
463
|
xml.closeNode();
|
|
439
464
|
}
|
|
440
465
|
/** Render a table row. */
|
|
441
|
-
function renderTableRow(xml, row) {
|
|
466
|
+
function renderTableRow(xml, row, helpers) {
|
|
442
467
|
xml.openNode("w:tr");
|
|
443
468
|
// Table property exception (w:tblPrEx) must come before w:trPr per schema
|
|
444
469
|
if (row.properties?.tblPrEx) {
|
|
@@ -448,7 +473,7 @@ function renderTableRow(xml, row) {
|
|
|
448
473
|
renderTableRowProperties(xml, row.properties);
|
|
449
474
|
}
|
|
450
475
|
for (const cell of row.cells) {
|
|
451
|
-
renderTableCell(xml, cell);
|
|
476
|
+
renderTableCell(xml, cell, helpers);
|
|
452
477
|
}
|
|
453
478
|
xml.closeNode();
|
|
454
479
|
}
|
|
@@ -486,21 +511,79 @@ function renderTablePropertiesEx(xml, ex) {
|
|
|
486
511
|
xml.closeNode();
|
|
487
512
|
}
|
|
488
513
|
/** Render a w:tbl element. */
|
|
489
|
-
function renderTable(xml, table) {
|
|
514
|
+
function renderTable(xml, table, helpers) {
|
|
490
515
|
xml.openNode("w:tbl");
|
|
491
516
|
if (table.properties) {
|
|
492
517
|
renderTableProperties(xml, table.properties);
|
|
493
518
|
}
|
|
494
|
-
// Column grid
|
|
519
|
+
// Column grid. ECMA-376 §17.4.49 requires <w:tblGrid> with at least one
|
|
520
|
+
// <w:gridCol>. When the caller did not supply explicit column widths we
|
|
521
|
+
// synthesise the grid by inferring the column count from the widest row
|
|
522
|
+
// (counting gridSpan + gridBefore + gridAfter) and dividing the table
|
|
523
|
+
// width evenly. This keeps the package valid for Word / LibreOffice
|
|
524
|
+
// even when authors used the convenience builders that don't compute
|
|
525
|
+
// a grid up front.
|
|
526
|
+
xml.openNode("w:tblGrid");
|
|
495
527
|
if (table.columnWidths && table.columnWidths.length > 0) {
|
|
496
|
-
xml.openNode("w:tblGrid");
|
|
497
528
|
for (const w of table.columnWidths) {
|
|
498
529
|
xml.leafNode("w:gridCol", { "w:w": String(w) });
|
|
499
530
|
}
|
|
500
|
-
xml.closeNode();
|
|
501
531
|
}
|
|
532
|
+
else {
|
|
533
|
+
const columnCount = Math.max(1, computeTableColumnCount(table));
|
|
534
|
+
const totalWidth = inferTableWidthInTwips(table.properties);
|
|
535
|
+
const colWidth = Math.max(1, Math.floor(totalWidth / columnCount));
|
|
536
|
+
for (let i = 0; i < columnCount; i++) {
|
|
537
|
+
xml.leafNode("w:gridCol", { "w:w": String(colWidth) });
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
xml.closeNode();
|
|
502
541
|
for (const row of table.rows) {
|
|
503
|
-
renderTableRow(xml, row);
|
|
542
|
+
renderTableRow(xml, row, helpers);
|
|
504
543
|
}
|
|
505
544
|
xml.closeNode();
|
|
506
545
|
}
|
|
546
|
+
/**
|
|
547
|
+
* Count the number of grid columns the table requires.
|
|
548
|
+
*
|
|
549
|
+
* Each cell occupies `gridSpan` columns (default 1); each row may also
|
|
550
|
+
* declare `gridBefore` / `gridAfter` to leave empty grid units on its sides.
|
|
551
|
+
* The grid must be wide enough for every row, so we take the maximum.
|
|
552
|
+
*/
|
|
553
|
+
function computeTableColumnCount(table) {
|
|
554
|
+
let max = 1;
|
|
555
|
+
for (const row of table.rows) {
|
|
556
|
+
let count = row.properties?.gridBefore ?? 0;
|
|
557
|
+
for (const cell of row.cells) {
|
|
558
|
+
count += cell.properties?.gridSpan ?? 1;
|
|
559
|
+
}
|
|
560
|
+
count += row.properties?.gridAfter ?? 0;
|
|
561
|
+
if (count > max) {
|
|
562
|
+
max = count;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return max;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Pick a sensible total width (in twips) for a synthesised tblGrid.
|
|
569
|
+
*
|
|
570
|
+
* - If the table specifies a `dxa` width, use it directly.
|
|
571
|
+
* - If it specifies a `pct` width, treat it as a fraction of a default
|
|
572
|
+
* page text area (US Letter minus 1" margins = 9 360 twips). A 5000/pct
|
|
573
|
+
* value (= 100%) maps to the full text area.
|
|
574
|
+
* - Otherwise default to the same 9 360 twips.
|
|
575
|
+
*/
|
|
576
|
+
function inferTableWidthInTwips(props) {
|
|
577
|
+
const TEXT_AREA_TWIPS = 9360;
|
|
578
|
+
const w = props?.width;
|
|
579
|
+
if (!w) {
|
|
580
|
+
return TEXT_AREA_TWIPS;
|
|
581
|
+
}
|
|
582
|
+
if (w.type === "dxa" && typeof w.value === "number" && w.value > 0) {
|
|
583
|
+
return w.value;
|
|
584
|
+
}
|
|
585
|
+
if (w.type === "pct" && typeof w.value === "number" && w.value > 0) {
|
|
586
|
+
return Math.round((w.value / 5000) * TEXT_AREA_TWIPS);
|
|
587
|
+
}
|
|
588
|
+
return TEXT_AREA_TWIPS;
|
|
589
|
+
}
|
|
@@ -525,7 +525,9 @@ function md5(input) {
|
|
|
525
525
|
// =============================================================================
|
|
526
526
|
/**
|
|
527
527
|
* RC4 stream cipher.
|
|
528
|
-
*
|
|
528
|
+
*
|
|
529
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
530
|
+
* (PDF 1.4 standard handler V=1/V=2).
|
|
529
531
|
*/
|
|
530
532
|
function rc4(key, data) {
|
|
531
533
|
const s = new Uint8Array(256);
|
package/dist/cjs/utils/crypto.js
CHANGED
|
@@ -143,7 +143,10 @@ function aesEcbEncrypt(block, key) {
|
|
|
143
143
|
// =============================================================================
|
|
144
144
|
/**
|
|
145
145
|
* RC4 stream cipher.
|
|
146
|
-
*
|
|
146
|
+
*
|
|
147
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
148
|
+
* (PDF 1.4 standard handler V=1/V=2). Modern Node `crypto` no longer
|
|
149
|
+
* exposes RC4, so this is a pure-JS implementation.
|
|
147
150
|
*/
|
|
148
151
|
function rc4(key, data) {
|
|
149
152
|
// Node's crypto doesn't expose RC4 in modern versions, use pure JS
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Standard Font Metrics — shared between Word layout and PDF rendering.
|
|
4
|
+
*
|
|
5
|
+
* Provides width data for the 14 standard PDF fonts (Helvetica, Times, Courier families).
|
|
6
|
+
* Used for text measurement without requiring actual font files.
|
|
7
|
+
*
|
|
8
|
+
* Character widths are specified in 1/1000 of a text unit. To get the actual width
|
|
9
|
+
* of a character at a given font size:
|
|
10
|
+
* width_in_points = (charWidth / 1000) * fontSize
|
|
11
|
+
*
|
|
12
|
+
* @see PDF Reference 1.7, Appendix D - Standard Type 1 Fonts
|
|
13
|
+
* @see Adobe Font Metrics files (AFM) for canonical widths
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getCharWidth = getCharWidth;
|
|
17
|
+
exports.measureTextWidth = measureTextWidth;
|
|
18
|
+
exports.getFontAscent = getFontAscent;
|
|
19
|
+
exports.getFontDescent = getFontDescent;
|
|
20
|
+
exports.getLineHeight = getLineHeight;
|
|
21
|
+
exports.isStandardFont = isStandardFont;
|
|
22
|
+
exports.getStandardFontNames = getStandardFontNames;
|
|
23
|
+
exports.mapToStandardFont = mapToStandardFont;
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// Helvetica Metrics (afm data: Helvetica)
|
|
26
|
+
// =============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Character widths for ASCII 32-126.
|
|
29
|
+
* Values are in thousandths of a unit of text space.
|
|
30
|
+
*/
|
|
31
|
+
// prettier-ignore
|
|
32
|
+
const HELVETICA_WIDTHS = {
|
|
33
|
+
32: 278, 33: 278, 34: 355, 35: 556, 36: 556, 37: 889, 38: 667, 39: 191, 40: 333, 41: 333,
|
|
34
|
+
42: 389, 43: 584, 44: 278, 45: 333, 46: 278, 47: 278, 48: 556, 49: 556, 50: 556, 51: 556,
|
|
35
|
+
52: 556, 53: 556, 54: 556, 55: 556, 56: 556, 57: 556, 58: 278, 59: 278, 60: 584, 61: 584,
|
|
36
|
+
62: 584, 63: 556, 64: 1015, 65: 667, 66: 667, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
|
|
37
|
+
72: 722, 73: 278, 74: 500, 75: 667, 76: 556, 77: 833, 78: 722, 79: 778, 80: 667, 81: 778,
|
|
38
|
+
82: 722, 83: 667, 84: 611, 85: 722, 86: 667, 87: 944, 88: 667, 89: 667, 90: 611, 91: 278,
|
|
39
|
+
92: 278, 93: 278, 94: 469, 95: 556, 96: 333, 97: 556, 98: 556, 99: 500, 100: 556, 101: 556,
|
|
40
|
+
102: 278, 103: 556, 104: 556, 105: 222, 106: 222, 107: 500, 108: 222, 109: 833, 110: 556,
|
|
41
|
+
111: 556, 112: 556, 113: 556, 114: 333, 115: 500, 116: 278, 117: 556, 118: 500, 119: 722,
|
|
42
|
+
120: 500, 121: 500, 122: 500, 123: 334, 124: 260, 125: 334, 126: 584
|
|
43
|
+
};
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
const HELVETICA_BOLD_WIDTHS = {
|
|
46
|
+
32: 278, 33: 333, 34: 474, 35: 556, 36: 556, 37: 889, 38: 722, 39: 238, 40: 333, 41: 333,
|
|
47
|
+
42: 389, 43: 584, 44: 278, 45: 333, 46: 278, 47: 278, 48: 556, 49: 556, 50: 556, 51: 556,
|
|
48
|
+
52: 556, 53: 556, 54: 556, 55: 556, 56: 556, 57: 556, 58: 333, 59: 333, 60: 584, 61: 584,
|
|
49
|
+
62: 584, 63: 611, 64: 975, 65: 722, 66: 722, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
|
|
50
|
+
72: 722, 73: 278, 74: 556, 75: 722, 76: 611, 77: 833, 78: 722, 79: 778, 80: 667, 81: 778,
|
|
51
|
+
82: 722, 83: 667, 84: 611, 85: 722, 86: 667, 87: 944, 88: 667, 89: 667, 90: 611, 91: 333,
|
|
52
|
+
92: 278, 93: 333, 94: 584, 95: 556, 96: 333, 97: 556, 98: 611, 99: 556, 100: 611, 101: 556,
|
|
53
|
+
102: 333, 103: 611, 104: 611, 105: 278, 106: 278, 107: 556, 108: 278, 109: 889, 110: 611,
|
|
54
|
+
111: 611, 112: 611, 113: 611, 114: 389, 115: 556, 116: 333, 117: 611, 118: 556, 119: 778,
|
|
55
|
+
120: 556, 121: 556, 122: 500, 123: 389, 124: 280, 125: 389, 126: 584
|
|
56
|
+
};
|
|
57
|
+
// prettier-ignore
|
|
58
|
+
const TIMES_ROMAN_WIDTHS = {
|
|
59
|
+
32: 250, 33: 333, 34: 408, 35: 500, 36: 500, 37: 833, 38: 778, 39: 180, 40: 333, 41: 333,
|
|
60
|
+
42: 500, 43: 564, 44: 250, 45: 333, 46: 250, 47: 278, 48: 500, 49: 500, 50: 500, 51: 500,
|
|
61
|
+
52: 500, 53: 500, 54: 500, 55: 500, 56: 500, 57: 500, 58: 278, 59: 278, 60: 564, 61: 564,
|
|
62
|
+
62: 564, 63: 444, 64: 921, 65: 722, 66: 667, 67: 667, 68: 722, 69: 611, 70: 556, 71: 722,
|
|
63
|
+
72: 722, 73: 333, 74: 389, 75: 722, 76: 611, 77: 889, 78: 722, 79: 722, 80: 556, 81: 722,
|
|
64
|
+
82: 667, 83: 556, 84: 611, 85: 722, 86: 722, 87: 944, 88: 722, 89: 722, 90: 611, 91: 333,
|
|
65
|
+
92: 278, 93: 333, 94: 469, 95: 500, 96: 333, 97: 444, 98: 500, 99: 444, 100: 500, 101: 444,
|
|
66
|
+
102: 333, 103: 500, 104: 500, 105: 278, 106: 278, 107: 500, 108: 278, 109: 778, 110: 500,
|
|
67
|
+
111: 500, 112: 500, 113: 500, 114: 333, 115: 389, 116: 278, 117: 500, 118: 500, 119: 722,
|
|
68
|
+
120: 500, 121: 500, 122: 444, 123: 480, 124: 200, 125: 480, 126: 541
|
|
69
|
+
};
|
|
70
|
+
// prettier-ignore
|
|
71
|
+
const TIMES_BOLD_WIDTHS = {
|
|
72
|
+
32: 250, 33: 333, 34: 555, 35: 500, 36: 500, 37: 1000, 38: 833, 39: 278, 40: 333, 41: 333,
|
|
73
|
+
42: 500, 43: 570, 44: 250, 45: 333, 46: 250, 47: 278, 48: 500, 49: 500, 50: 500, 51: 500,
|
|
74
|
+
52: 500, 53: 500, 54: 500, 55: 500, 56: 500, 57: 500, 58: 333, 59: 333, 60: 570, 61: 570,
|
|
75
|
+
62: 570, 63: 500, 64: 930, 65: 722, 66: 667, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
|
|
76
|
+
72: 778, 73: 389, 74: 500, 75: 778, 76: 667, 77: 944, 78: 722, 79: 778, 80: 611, 81: 778,
|
|
77
|
+
82: 722, 83: 556, 84: 667, 85: 722, 86: 722, 87: 1000, 88: 722, 89: 722, 90: 667, 91: 333,
|
|
78
|
+
92: 278, 93: 333, 94: 581, 95: 500, 96: 333, 97: 500, 98: 556, 99: 444, 100: 556, 101: 444,
|
|
79
|
+
102: 333, 103: 500, 104: 556, 105: 278, 106: 333, 107: 556, 108: 278, 109: 833, 110: 556,
|
|
80
|
+
111: 500, 112: 556, 113: 556, 114: 444, 115: 389, 116: 333, 117: 556, 118: 500, 119: 722,
|
|
81
|
+
120: 500, 121: 500, 122: 444, 123: 394, 124: 220, 125: 394, 126: 520
|
|
82
|
+
};
|
|
83
|
+
// Courier is monospaced - every character is 600 units wide
|
|
84
|
+
const COURIER_WIDTH = 600;
|
|
85
|
+
const FONT_DESCRIPTORS = {
|
|
86
|
+
Helvetica: {
|
|
87
|
+
ascent: 718,
|
|
88
|
+
descent: -207,
|
|
89
|
+
capHeight: 718,
|
|
90
|
+
avgWidth: 513,
|
|
91
|
+
widths: HELVETICA_WIDTHS
|
|
92
|
+
},
|
|
93
|
+
"Helvetica-Bold": {
|
|
94
|
+
ascent: 718,
|
|
95
|
+
descent: -207,
|
|
96
|
+
capHeight: 718,
|
|
97
|
+
avgWidth: 535,
|
|
98
|
+
widths: HELVETICA_BOLD_WIDTHS
|
|
99
|
+
},
|
|
100
|
+
"Helvetica-Oblique": {
|
|
101
|
+
ascent: 718,
|
|
102
|
+
descent: -207,
|
|
103
|
+
capHeight: 718,
|
|
104
|
+
avgWidth: 513,
|
|
105
|
+
widths: HELVETICA_WIDTHS // same widths as regular
|
|
106
|
+
},
|
|
107
|
+
"Helvetica-BoldOblique": {
|
|
108
|
+
ascent: 718,
|
|
109
|
+
descent: -207,
|
|
110
|
+
capHeight: 718,
|
|
111
|
+
avgWidth: 535,
|
|
112
|
+
widths: HELVETICA_BOLD_WIDTHS
|
|
113
|
+
},
|
|
114
|
+
"Times-Roman": {
|
|
115
|
+
ascent: 683,
|
|
116
|
+
descent: -217,
|
|
117
|
+
capHeight: 662,
|
|
118
|
+
avgWidth: 478,
|
|
119
|
+
widths: TIMES_ROMAN_WIDTHS
|
|
120
|
+
},
|
|
121
|
+
"Times-Bold": {
|
|
122
|
+
ascent: 683,
|
|
123
|
+
descent: -217,
|
|
124
|
+
capHeight: 676,
|
|
125
|
+
avgWidth: 505,
|
|
126
|
+
widths: TIMES_BOLD_WIDTHS
|
|
127
|
+
},
|
|
128
|
+
"Times-Italic": {
|
|
129
|
+
ascent: 683,
|
|
130
|
+
descent: -217,
|
|
131
|
+
capHeight: 653,
|
|
132
|
+
avgWidth: 478,
|
|
133
|
+
widths: TIMES_ROMAN_WIDTHS // approximate
|
|
134
|
+
},
|
|
135
|
+
"Times-BoldItalic": {
|
|
136
|
+
ascent: 683,
|
|
137
|
+
descent: -217,
|
|
138
|
+
capHeight: 669,
|
|
139
|
+
avgWidth: 505,
|
|
140
|
+
widths: TIMES_BOLD_WIDTHS // approximate
|
|
141
|
+
},
|
|
142
|
+
Courier: {
|
|
143
|
+
ascent: 629,
|
|
144
|
+
descent: -157,
|
|
145
|
+
capHeight: 562,
|
|
146
|
+
avgWidth: 600,
|
|
147
|
+
widths: null,
|
|
148
|
+
monoWidth: COURIER_WIDTH
|
|
149
|
+
},
|
|
150
|
+
"Courier-Bold": {
|
|
151
|
+
ascent: 629,
|
|
152
|
+
descent: -157,
|
|
153
|
+
capHeight: 562,
|
|
154
|
+
avgWidth: 600,
|
|
155
|
+
widths: null,
|
|
156
|
+
monoWidth: COURIER_WIDTH
|
|
157
|
+
},
|
|
158
|
+
"Courier-Oblique": {
|
|
159
|
+
ascent: 629,
|
|
160
|
+
descent: -157,
|
|
161
|
+
capHeight: 562,
|
|
162
|
+
avgWidth: 600,
|
|
163
|
+
widths: null,
|
|
164
|
+
monoWidth: COURIER_WIDTH
|
|
165
|
+
},
|
|
166
|
+
"Courier-BoldOblique": {
|
|
167
|
+
ascent: 629,
|
|
168
|
+
descent: -157,
|
|
169
|
+
capHeight: 562,
|
|
170
|
+
avgWidth: 600,
|
|
171
|
+
widths: null,
|
|
172
|
+
monoWidth: COURIER_WIDTH
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
// =============================================================================
|
|
176
|
+
// Font Name Mapping
|
|
177
|
+
// =============================================================================
|
|
178
|
+
/**
|
|
179
|
+
* Maps common font family names to the closest standard PDF font.
|
|
180
|
+
*/
|
|
181
|
+
const FONT_FAMILY_MAP = {
|
|
182
|
+
// Sans-serif → Helvetica
|
|
183
|
+
helvetica: "Helvetica",
|
|
184
|
+
arial: "Helvetica",
|
|
185
|
+
calibri: "Helvetica",
|
|
186
|
+
"segoe ui": "Helvetica",
|
|
187
|
+
"trebuchet ms": "Helvetica",
|
|
188
|
+
verdana: "Helvetica",
|
|
189
|
+
tahoma: "Helvetica",
|
|
190
|
+
"gill sans": "Helvetica",
|
|
191
|
+
"franklin gothic": "Helvetica",
|
|
192
|
+
"lucida sans": "Helvetica",
|
|
193
|
+
aptos: "Helvetica",
|
|
194
|
+
// Serif → Times-Roman
|
|
195
|
+
"times new roman": "Times-Roman",
|
|
196
|
+
times: "Times-Roman",
|
|
197
|
+
georgia: "Times-Roman",
|
|
198
|
+
garamond: "Times-Roman",
|
|
199
|
+
"book antiqua": "Times-Roman",
|
|
200
|
+
palatino: "Times-Roman",
|
|
201
|
+
"palatino linotype": "Times-Roman",
|
|
202
|
+
cambria: "Times-Roman",
|
|
203
|
+
"century schoolbook": "Times-Roman",
|
|
204
|
+
// Monospace → Courier
|
|
205
|
+
"courier new": "Courier",
|
|
206
|
+
courier: "Courier",
|
|
207
|
+
consolas: "Courier",
|
|
208
|
+
"lucida console": "Courier",
|
|
209
|
+
monaco: "Courier",
|
|
210
|
+
"andale mono": "Courier",
|
|
211
|
+
"cascadia code": "Courier",
|
|
212
|
+
"cascadia mono": "Courier",
|
|
213
|
+
menlo: "Courier"
|
|
214
|
+
};
|
|
215
|
+
// =============================================================================
|
|
216
|
+
// Public API
|
|
217
|
+
// =============================================================================
|
|
218
|
+
/**
|
|
219
|
+
* Get the width of a character in a given font.
|
|
220
|
+
* @param charCode - Unicode code point (or char code)
|
|
221
|
+
* @param fontName - PDF standard font name
|
|
222
|
+
* @returns Width in thousandths of a unit
|
|
223
|
+
*/
|
|
224
|
+
function getCharWidth(charCode, fontName) {
|
|
225
|
+
const desc = FONT_DESCRIPTORS[fontName];
|
|
226
|
+
if (!desc) {
|
|
227
|
+
// Fall back to Helvetica
|
|
228
|
+
return getCharWidth(charCode, "Helvetica");
|
|
229
|
+
}
|
|
230
|
+
if (desc.monoWidth !== undefined) {
|
|
231
|
+
return desc.monoWidth;
|
|
232
|
+
}
|
|
233
|
+
return desc.widths?.[charCode] ?? desc.avgWidth;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Measure the width of a text string in the given font and size.
|
|
237
|
+
* @param text - The string to measure
|
|
238
|
+
* @param fontName - PDF standard font name
|
|
239
|
+
* @param fontSize - Font size in points
|
|
240
|
+
* @returns Width in points
|
|
241
|
+
*/
|
|
242
|
+
function measureTextWidth(text, fontName, fontSize) {
|
|
243
|
+
let totalWidth = 0;
|
|
244
|
+
for (let i = 0; i < text.length; i++) {
|
|
245
|
+
totalWidth += getCharWidth(text.charCodeAt(i), fontName);
|
|
246
|
+
}
|
|
247
|
+
return (totalWidth / 1000) * fontSize;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get the font ascent for a given font and size.
|
|
251
|
+
* @param fontName - PDF standard font name
|
|
252
|
+
* @param fontSize - Font size in points
|
|
253
|
+
* @returns Ascent in points (positive, distance above baseline)
|
|
254
|
+
*/
|
|
255
|
+
function getFontAscent(fontName, fontSize) {
|
|
256
|
+
const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
|
|
257
|
+
return (desc.ascent / 1000) * fontSize;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get the font descent for a given font and size.
|
|
261
|
+
* @param fontName - PDF standard font name
|
|
262
|
+
* @param fontSize - Font size in points
|
|
263
|
+
* @returns Descent in points (positive value representing distance below baseline)
|
|
264
|
+
*/
|
|
265
|
+
function getFontDescent(fontName, fontSize) {
|
|
266
|
+
const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
|
|
267
|
+
return (desc.descent / 1000) * fontSize;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Get the total line height (ascent - descent) for a font.
|
|
271
|
+
* @param fontName - PDF standard font name
|
|
272
|
+
* @param fontSize - Font size in points
|
|
273
|
+
* @returns Line height in points
|
|
274
|
+
*/
|
|
275
|
+
function getLineHeight(fontName, fontSize) {
|
|
276
|
+
const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
|
|
277
|
+
return ((desc.ascent - desc.descent) / 1000) * fontSize;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Check if a font name is a known standard PDF font.
|
|
281
|
+
*/
|
|
282
|
+
function isStandardFont(fontName) {
|
|
283
|
+
return fontName in FONT_DESCRIPTORS;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get all supported standard font names.
|
|
287
|
+
*/
|
|
288
|
+
function getStandardFontNames() {
|
|
289
|
+
return Object.keys(FONT_DESCRIPTORS);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Map common font names (like "Arial", "Calibri") to closest standard font.
|
|
293
|
+
* Returns the input unchanged if it's already a standard font name.
|
|
294
|
+
* Falls back to "Helvetica" for unknown fonts.
|
|
295
|
+
*/
|
|
296
|
+
function mapToStandardFont(fontName) {
|
|
297
|
+
// If it's already a standard font, return as-is
|
|
298
|
+
if (fontName in FONT_DESCRIPTORS) {
|
|
299
|
+
return fontName;
|
|
300
|
+
}
|
|
301
|
+
const lower = fontName.toLowerCase().trim();
|
|
302
|
+
return FONT_FAMILY_MAP[lower] ?? "Helvetica";
|
|
303
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* StringBuf - Cross-Platform String Buffer
|
|
4
|
+
*
|
|
5
|
+
* Efficient string builder that accumulates UTF-8 encoded bytes into a single
|
|
6
|
+
* `Uint8Array`. Designed for hot paths that build large XML / text payloads
|
|
7
|
+
* (XLSX worksheet writers, streaming DOCX writer) where naïve `string +=`
|
|
8
|
+
* concatenation triggers O(n²) re-allocations.
|
|
9
|
+
*
|
|
10
|
+
* Works identically in Node.js and Browser environments — uses only
|
|
11
|
+
* `TextEncoder` and `Uint8Array`.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.StringBuf = void 0;
|
|
15
|
+
const encoder = new TextEncoder();
|
|
16
|
+
/**
|
|
17
|
+
* Efficient string builder backed by a growable `Uint8Array`.
|
|
18
|
+
*/
|
|
19
|
+
class StringBuf {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this._buf = new Uint8Array((options && options.size) || 16384);
|
|
22
|
+
this._inPos = 0;
|
|
23
|
+
this._buffer = undefined;
|
|
24
|
+
}
|
|
25
|
+
get length() {
|
|
26
|
+
return this._inPos;
|
|
27
|
+
}
|
|
28
|
+
get capacity() {
|
|
29
|
+
return this._buf.length;
|
|
30
|
+
}
|
|
31
|
+
get buffer() {
|
|
32
|
+
return this._buf;
|
|
33
|
+
}
|
|
34
|
+
/** Return a snapshot of the bytes written so far. Cached until next mutation. */
|
|
35
|
+
toBuffer() {
|
|
36
|
+
if (!this._buffer) {
|
|
37
|
+
this._buffer = this._buf.slice(0, this._inPos);
|
|
38
|
+
}
|
|
39
|
+
return this._buffer;
|
|
40
|
+
}
|
|
41
|
+
reset(position) {
|
|
42
|
+
position = position ?? 0;
|
|
43
|
+
this._buffer = undefined;
|
|
44
|
+
this._inPos = position;
|
|
45
|
+
}
|
|
46
|
+
_grow(min) {
|
|
47
|
+
let size = this._buf.length * 2;
|
|
48
|
+
while (size < min) {
|
|
49
|
+
size *= 2;
|
|
50
|
+
}
|
|
51
|
+
const buf = new Uint8Array(size);
|
|
52
|
+
buf.set(this._buf);
|
|
53
|
+
this._buf = buf;
|
|
54
|
+
}
|
|
55
|
+
/** Append a string, encoded as UTF-8. */
|
|
56
|
+
addText(text) {
|
|
57
|
+
this._buffer = undefined;
|
|
58
|
+
// Optimistically reserve 1 byte per char (true for ASCII; multi-byte
|
|
59
|
+
// chars trigger the slow path below).
|
|
60
|
+
const optimistic = this._inPos + text.length;
|
|
61
|
+
if (optimistic > this._buf.length - 4) {
|
|
62
|
+
this._grow(optimistic);
|
|
63
|
+
}
|
|
64
|
+
// `encodeInto` writes directly into the buffer, avoiding the intermediate
|
|
65
|
+
// Uint8Array allocation that `encoder.encode()` creates.
|
|
66
|
+
const target = this._buf.subarray(this._inPos);
|
|
67
|
+
const result = encoder.encodeInto(text, target);
|
|
68
|
+
if (result.read < text.length) {
|
|
69
|
+
// Multi-byte chars exceeded the optimistic estimate.
|
|
70
|
+
// Worst case: 3 bytes per remaining char.
|
|
71
|
+
const remaining = text.length - result.read;
|
|
72
|
+
this._grow(this._inPos + result.written + remaining * 3);
|
|
73
|
+
const result2 = encoder.encodeInto(text.substring(result.read), this._buf.subarray(this._inPos + result.written));
|
|
74
|
+
this._inPos += result.written + result2.written;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this._inPos += result.written;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Append the contents of another StringBuf without re-encoding. */
|
|
81
|
+
addStringBuf(inBuf) {
|
|
82
|
+
if (inBuf.length) {
|
|
83
|
+
this._buffer = undefined;
|
|
84
|
+
if (this.length + inBuf.length > this.capacity) {
|
|
85
|
+
this._grow(this.length + inBuf.length);
|
|
86
|
+
}
|
|
87
|
+
this._buf.set(inBuf._buf.subarray(0, inBuf.length), this._inPos);
|
|
88
|
+
this._inPos += inBuf.length;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.StringBuf = StringBuf;
|