@syncfusion/ej2-docx 0.0.0-stage → 35.1.40
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/.gitleaksignore +35 -0
- package/README.md +68 -2
- package/core.js +4 -0
- package/dist/ej2-docx.umd.min.js +11 -0
- package/dist/ej2-docx.umd.min.js.map +1 -0
- package/dist/es6/ej2-docx.es2015.js +66697 -0
- package/dist/es6/ej2-docx.es2015.js.map +1 -0
- package/dist/es6/ej2-docx.es5.js +77568 -0
- package/dist/es6/ej2-docx.es5.js.map +1 -0
- package/dist/global/ej2-docx.min.js +11 -0
- package/dist/global/ej2-docx.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/features.js +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +30 -3
- package/src/all.d.ts +50 -0
- package/src/all.js +147 -0
- package/src/core/compat/base64.d.ts +13 -0
- package/src/core/compat/base64.js +90 -0
- package/src/core/compat/object-compat.d.ts +30 -0
- package/src/core/compat/object-compat.js +40 -0
- package/src/core/compat/sha256.d.ts +9 -0
- package/src/core/compat/sha256.js +98 -0
- package/src/core/errors/docx-error.d.ts +89 -0
- package/src/core/errors/docx-error.js +138 -0
- package/src/core/errors/error-codes.d.ts +8 -0
- package/src/core/errors/error-codes.js +0 -0
- package/src/core/errors/index.d.ts +10 -0
- package/src/core/errors/index.js +9 -0
- package/src/core/index.d.ts +12 -0
- package/src/core/index.js +12 -0
- package/src/core/mc/alternate-content.d.ts +7 -0
- package/src/core/mc/alternate-content.js +67 -0
- package/src/core/mc/attributes.d.ts +24 -0
- package/src/core/mc/attributes.js +82 -0
- package/src/core/mc/index.d.ts +7 -0
- package/src/core/mc/index.js +5 -0
- package/src/core/mc/inspect.d.ts +16 -0
- package/src/core/mc/inspect.js +148 -0
- package/src/core/mc/namespaces.d.ts +4 -0
- package/src/core/mc/namespaces.js +4 -0
- package/src/core/mc/scope.d.ts +6 -0
- package/src/core/mc/scope.js +47 -0
- package/src/core/opc/content-types.d.ts +34 -0
- package/src/core/opc/content-types.js +162 -0
- package/src/core/opc/index.d.ts +8 -0
- package/src/core/opc/index.js +4 -0
- package/src/core/opc/package.d.ts +49 -0
- package/src/core/opc/package.js +324 -0
- package/src/core/opc/part-name.d.ts +47 -0
- package/src/core/opc/part-name.js +205 -0
- package/src/core/opc/relationships.d.ts +46 -0
- package/src/core/opc/relationships.js +212 -0
- package/src/core/preservation/index.d.ts +2 -0
- package/src/core/preservation/index.js +1 -0
- package/src/core/preservation/opaque-body.d.ts +16 -0
- package/src/core/preservation/opaque-body.js +69 -0
- package/src/core/registry/block-handlers.d.ts +30 -0
- package/src/core/registry/block-handlers.js +36 -0
- package/src/core/registry/create-defaults.d.ts +39 -0
- package/src/core/registry/create-defaults.js +42 -0
- package/src/core/registry/feature-registry.d.ts +20 -0
- package/src/core/registry/feature-registry.js +29 -0
- package/src/core/registry/index.d.ts +9 -0
- package/src/core/registry/index.js +8 -0
- package/src/core/registry/inline-handlers.d.ts +20 -0
- package/src/core/registry/inline-handlers.js +30 -0
- package/src/core/registry/materialize-handlers.d.ts +35 -0
- package/src/core/registry/materialize-handlers.js +75 -0
- package/src/core/registry/multi-part-handlers.d.ts +37 -0
- package/src/core/registry/multi-part-handlers.js +206 -0
- package/src/core/registry/package-part-handlers.d.ts +28 -0
- package/src/core/registry/package-part-handlers.js +190 -0
- package/src/core/registry/part-handlers.d.ts +24 -0
- package/src/core/registry/part-handlers.js +172 -0
- package/src/core/registry/run-leaf-handlers.d.ts +26 -0
- package/src/core/registry/run-leaf-handlers.js +72 -0
- package/src/core/security/limits.d.ts +40 -0
- package/src/core/security/limits.js +26 -0
- package/src/core/xml/index.d.ts +7 -0
- package/src/core/xml/index.js +3 -0
- package/src/core/xml/model.d.ts +66 -0
- package/src/core/xml/model.js +17 -0
- package/src/core/xml/parse.d.ts +12 -0
- package/src/core/xml/parse.js +382 -0
- package/src/core/xml/serialize.d.ts +6 -0
- package/src/core/xml/serialize.js +93 -0
- package/src/core/zip/crc32.d.ts +2 -0
- package/src/core/zip/crc32.js +25 -0
- package/src/core/zip/deflate.d.ts +6 -0
- package/src/core/zip/deflate.js +6 -0
- package/src/core/zip/index.d.ts +10 -0
- package/src/core/zip/index.js +4 -0
- package/src/core/zip/inflate-raw.d.ts +17 -0
- package/src/core/zip/inflate-raw.js +450 -0
- package/src/core/zip/names.d.ts +6 -0
- package/src/core/zip/names.js +52 -0
- package/src/core/zip/read.d.ts +8 -0
- package/src/core/zip/read.js +262 -0
- package/src/core/zip/write.d.ts +7 -0
- package/src/core/zip/write.js +189 -0
- package/src/core/zip/zip-entry.d.ts +4 -0
- package/src/core/zip/zip-entry.js +0 -0
- package/src/features/bibliography/index.d.ts +100 -0
- package/src/features/bibliography/index.js +290 -0
- package/src/features/bookmarks/index.d.ts +331 -0
- package/src/features/bookmarks/index.js +1009 -0
- package/src/features/comments/comment-extensions.d.ts +157 -0
- package/src/features/comments/comment-extensions.js +356 -0
- package/src/features/comments/index.d.ts +579 -0
- package/src/features/comments/index.js +1727 -0
- package/src/features/content-controls/index.d.ts +821 -0
- package/src/features/content-controls/index.js +2857 -0
- package/src/features/custom-xml/index.d.ts +236 -0
- package/src/features/custom-xml/index.js +661 -0
- package/src/features/document/alignment.d.ts +23 -0
- package/src/features/document/alignment.js +36 -0
- package/src/features/document/alt-chunk.d.ts +103 -0
- package/src/features/document/alt-chunk.js +221 -0
- package/src/features/document/assert-never.d.ts +1 -0
- package/src/features/document/assert-never.js +4 -0
- package/src/features/document/augmentations.d.ts +578 -0
- package/src/features/document/augmentations.js +0 -0
- package/src/features/document/body-always-on.d.ts +36 -0
- package/src/features/document/body-always-on.js +66 -0
- package/src/features/document/body-blocks.d.ts +7 -0
- package/src/features/document/body-blocks.js +78 -0
- package/src/features/document/body-item-adapters.d.ts +62 -0
- package/src/features/document/body-item-adapters.js +97 -0
- package/src/features/document/body-item-collection.d.ts +151 -0
- package/src/features/document/body-item-collection.js +440 -0
- package/src/features/document/body-item.d.ts +35 -0
- package/src/features/document/body-item.js +8 -0
- package/src/features/document/body.d.ts +150 -0
- package/src/features/document/body.js +263 -0
- package/src/features/document/character-format.d.ts +413 -0
- package/src/features/document/character-format.js +2054 -0
- package/src/features/document/color.d.ts +178 -0
- package/src/features/document/color.js +495 -0
- package/src/features/document/document.d.ts +410 -0
- package/src/features/document/document.js +1049 -0
- package/src/features/document/element-type.d.ts +68 -0
- package/src/features/document/element-type.js +133 -0
- package/src/features/document/entity-type.d.ts +92 -0
- package/src/features/document/entity-type.js +93 -0
- package/src/features/document/feature-block.d.ts +16 -0
- package/src/features/document/feature-block.js +0 -0
- package/src/features/document/feature-inline.d.ts +13 -0
- package/src/features/document/feature-inline.js +0 -0
- package/src/features/document/feature-multi-package-part.d.ts +19 -0
- package/src/features/document/feature-multi-package-part.js +8 -0
- package/src/features/document/feature-package-level-part.d.ts +18 -0
- package/src/features/document/feature-package-level-part.js +8 -0
- package/src/features/document/feature-package-part.d.ts +14 -0
- package/src/features/document/feature-package-part.js +0 -0
- package/src/features/document/feature-run-leaf.d.ts +9 -0
- package/src/features/document/feature-run-leaf.js +0 -0
- package/src/features/document/headers-footers.d.ts +206 -0
- package/src/features/document/headers-footers.js +384 -0
- package/src/features/document/index.d.ts +41 -0
- package/src/features/document/index.js +34 -0
- package/src/features/document/length.d.ts +152 -0
- package/src/features/document/length.js +245 -0
- package/src/features/document/load-options.d.ts +14 -0
- package/src/features/document/load-options.js +0 -0
- package/src/features/document/locale-ids.d.ts +227 -0
- package/src/features/document/locale-ids.js +485 -0
- package/src/features/document/on-off.d.ts +9 -0
- package/src/features/document/on-off.js +27 -0
- package/src/features/document/page-setup.d.ts +339 -0
- package/src/features/document/page-setup.js +244 -0
- package/src/features/document/paragraph-format.d.ts +880 -0
- package/src/features/document/paragraph-format.js +2807 -0
- package/src/features/document/paragraph-item-collection.d.ts +162 -0
- package/src/features/document/paragraph-item-collection.js +363 -0
- package/src/features/document/paragraph-item.d.ts +83 -0
- package/src/features/document/paragraph-item.js +103 -0
- package/src/features/document/paragraph.d.ts +435 -0
- package/src/features/document/paragraph.js +888 -0
- package/src/features/document/run.d.ts +1 -0
- package/src/features/document/run.js +768 -0
- package/src/features/document/section-partition-flatten.d.ts +124 -0
- package/src/features/document/section-partition-flatten.js +217 -0
- package/src/features/document/section-properties-model.d.ts +13 -0
- package/src/features/document/section-properties-model.js +0 -0
- package/src/features/document/section.d.ts +93 -0
- package/src/features/document/section.js +178 -0
- package/src/features/document/sections.d.ts +103 -0
- package/src/features/document/sections.js +217 -0
- package/src/features/document/sub-super-script.d.ts +23 -0
- package/src/features/document/sub-super-script.js +43 -0
- package/src/features/document/text-range.d.ts +445 -0
- package/src/features/document/text-range.js +1156 -0
- package/src/features/document/typed-body-collections.d.ts +162 -0
- package/src/features/document/typed-body-collections.js +371 -0
- package/src/features/document/underline-style.d.ts +38 -0
- package/src/features/document/underline-style.js +126 -0
- package/src/features/document/units.d.ts +8 -0
- package/src/features/document/units.js +7 -0
- package/src/features/document/wml.d.ts +16 -0
- package/src/features/document/wml.js +67 -0
- package/src/features/drawing/authoring.d.ts +27 -0
- package/src/features/drawing/authoring.js +271 -0
- package/src/features/drawing/body-pr.d.ts +271 -0
- package/src/features/drawing/body-pr.js +663 -0
- package/src/features/drawing/drawing-shape.d.ts +1192 -0
- package/src/features/drawing/drawing-shape.js +3239 -0
- package/src/features/drawing/encode-builders.d.ts +176 -0
- package/src/features/drawing/encode-builders.js +390 -0
- package/src/features/drawing/fill-format.d.ts +52 -0
- package/src/features/drawing/fill-format.js +124 -0
- package/src/features/drawing/host-codec.d.ts +632 -0
- package/src/features/drawing/host-codec.js +2595 -0
- package/src/features/drawing/index.d.ts +13 -0
- package/src/features/drawing/index.js +33 -0
- package/src/features/drawing/line-format.d.ts +76 -0
- package/src/features/drawing/line-format.js +343 -0
- package/src/features/drawing/parse-register.d.ts +50 -0
- package/src/features/drawing/parse-register.js +257 -0
- package/src/features/drawing/residual-utils.d.ts +47 -0
- package/src/features/drawing/residual-utils.js +290 -0
- package/src/features/drawing/shape-types.d.ts +433 -0
- package/src/features/drawing/shape-types.js +437 -0
- package/src/features/drawing/sp-pr.d.ts +396 -0
- package/src/features/drawing/sp-pr.js +610 -0
- package/src/features/drawing/text-frame.d.ts +90 -0
- package/src/features/drawing/text-frame.js +152 -0
- package/src/features/drawing/types.d.ts +352 -0
- package/src/features/drawing/types.js +60 -0
- package/src/features/drawing/wrap-format.d.ts +62 -0
- package/src/features/drawing/wrap-format.js +114 -0
- package/src/features/editable-ranges/index.d.ts +494 -0
- package/src/features/editable-ranges/index.js +1348 -0
- package/src/features/fields/index.d.ts +428 -0
- package/src/features/fields/index.js +2148 -0
- package/src/features/fields/paragraph-field.d.ts +187 -0
- package/src/features/fields/paragraph-field.js +692 -0
- package/src/features/font-table/font-substitution-table.d.ts +75 -0
- package/src/features/font-table/font-substitution-table.js +257 -0
- package/src/features/font-table/font-table-entry.d.ts +255 -0
- package/src/features/font-table/font-table-entry.js +823 -0
- package/src/features/font-table/font-table.d.ts +128 -0
- package/src/features/font-table/font-table.js +313 -0
- package/src/features/font-table/index.d.ts +27 -0
- package/src/features/font-table/index.js +48 -0
- package/src/features/glossary/index.d.ts +97 -0
- package/src/features/glossary/index.js +286 -0
- package/src/features/headers-footers/index.d.ts +506 -0
- package/src/features/headers-footers/index.js +1666 -0
- package/src/features/hyperlinks/index.d.ts +230 -0
- package/src/features/hyperlinks/index.js +685 -0
- package/src/features/images/caption-authoring-api.d.ts +33 -0
- package/src/features/images/caption-authoring-api.js +33 -0
- package/src/features/images/caption-enums.d.ts +52 -0
- package/src/features/images/caption-enums.js +141 -0
- package/src/features/images/caption-host.d.ts +10 -0
- package/src/features/images/caption-host.js +21 -0
- package/src/features/images/captions.d.ts +13 -0
- package/src/features/images/captions.js +142 -0
- package/src/features/images/host-codec.d.ts +103 -0
- package/src/features/images/host-codec.js +720 -0
- package/src/features/images/image-sniff.d.ts +21 -0
- package/src/features/images/image-sniff.js +71 -0
- package/src/features/images/index.d.ts +506 -0
- package/src/features/images/index.js +1429 -0
- package/src/features/images/layout-types.d.ts +232 -0
- package/src/features/images/layout-types.js +294 -0
- package/src/features/images/public-entry.d.ts +9 -0
- package/src/features/images/public-entry.js +9 -0
- package/src/features/index.d.ts +35 -0
- package/src/features/index.js +36 -0
- package/src/features/mail-merge/index.d.ts +113 -0
- package/src/features/mail-merge/index.js +315 -0
- package/src/features/notes/index.d.ts +573 -0
- package/src/features/notes/index.js +1725 -0
- package/src/features/numbering/abstract-numbering.d.ts +90 -0
- package/src/features/numbering/abstract-numbering.js +292 -0
- package/src/features/numbering/index.d.ts +182 -0
- package/src/features/numbering/index.js +668 -0
- package/src/features/numbering/list-format.d.ts +158 -0
- package/src/features/numbering/list-format.js +590 -0
- package/src/features/numbering/list-string.d.ts +7 -0
- package/src/features/numbering/list-string.js +423 -0
- package/src/features/numbering/list-style.d.ts +204 -0
- package/src/features/numbering/list-style.js +1084 -0
- package/src/features/numbering/numbering-instance.d.ts +101 -0
- package/src/features/numbering/numbering-instance.js +329 -0
- package/src/features/numbering/numbering-level.d.ts +118 -0
- package/src/features/numbering/numbering-level.js +501 -0
- package/src/features/numbering/picture-bullet.d.ts +34 -0
- package/src/features/numbering/picture-bullet.js +88 -0
- package/src/features/ole-object/catalog.d.ts +300 -0
- package/src/features/ole-object/catalog.js +908 -0
- package/src/features/ole-object/index.d.ts +526 -0
- package/src/features/ole-object/index.js +1421 -0
- package/src/features/ole-object/relationship.d.ts +27 -0
- package/src/features/ole-object/relationship.js +27 -0
- package/src/features/ole-object/typed-dom.d.ts +186 -0
- package/src/features/ole-object/typed-dom.js +595 -0
- package/src/features/properties/index.d.ts +205 -0
- package/src/features/properties/index.js +549 -0
- package/src/features/revisions/index.d.ts +204 -0
- package/src/features/revisions/index.js +695 -0
- package/src/features/sections/column-collection.d.ts +119 -0
- package/src/features/sections/column-collection.js +478 -0
- package/src/features/sections/column.d.ts +15 -0
- package/src/features/sections/column.js +37 -0
- package/src/features/sections/index.d.ts +91 -0
- package/src/features/sections/index.js +1096 -0
- package/src/features/sections/margins.d.ts +40 -0
- package/src/features/sections/margins.js +105 -0
- package/src/features/sections/page-number-style.d.ts +21 -0
- package/src/features/sections/page-number-style.js +62 -0
- package/src/features/sections/page-orientation.d.ts +10 -0
- package/src/features/sections/page-orientation.js +10 -0
- package/src/features/sections/page-setup.d.ts +435 -0
- package/src/features/sections/page-setup.js +1479 -0
- package/src/features/sections/page-size.d.ts +59 -0
- package/src/features/sections/page-size.js +68 -0
- package/src/features/sections/section-break-code.d.ts +27 -0
- package/src/features/sections/section-break-code.js +60 -0
- package/src/features/sections/section-document-association.d.ts +18 -0
- package/src/features/sections/section-document-association.js +31 -0
- package/src/features/sections/section-validation.d.ts +43 -0
- package/src/features/sections/section-validation.js +97 -0
- package/src/features/settings/attached-template.d.ts +35 -0
- package/src/features/settings/attached-template.js +98 -0
- package/src/features/settings/compat-settings.d.ts +216 -0
- package/src/features/settings/compat-settings.js +508 -0
- package/src/features/settings/document-background.d.ts +59 -0
- package/src/features/settings/document-background.js +131 -0
- package/src/features/settings/document-protection.d.ts +65 -0
- package/src/features/settings/document-protection.js +157 -0
- package/src/features/settings/document-settings-facades.d.ts +108 -0
- package/src/features/settings/document-settings-facades.js +312 -0
- package/src/features/settings/document-settings-values.d.ts +43 -0
- package/src/features/settings/document-settings-values.js +60 -0
- package/src/features/settings/footnote-properties.d.ts +211 -0
- package/src/features/settings/footnote-properties.js +591 -0
- package/src/features/settings/index.d.ts +356 -0
- package/src/features/settings/index.js +829 -0
- package/src/features/settings/settings-children.d.ts +151 -0
- package/src/features/settings/settings-children.js +505 -0
- package/src/features/settings/web-settings.d.ts +88 -0
- package/src/features/settings/web-settings.js +227 -0
- package/src/features/settings/zoom.d.ts +79 -0
- package/src/features/settings/zoom.js +147 -0
- package/src/features/styles/builtin-catalog.d.ts +159 -0
- package/src/features/styles/builtin-catalog.js +963 -0
- package/src/features/styles/builtin-resolver.d.ts +49 -0
- package/src/features/styles/builtin-resolver.js +165 -0
- package/src/features/styles/default-styles.d.ts +37 -0
- package/src/features/styles/default-styles.js +186 -0
- package/src/features/styles/default-theme.d.ts +13 -0
- package/src/features/styles/default-theme.js +13 -0
- package/src/features/styles/doc-defaults.d.ts +58 -0
- package/src/features/styles/doc-defaults.js +178 -0
- package/src/features/styles/formatting-resolver.d.ts +27 -0
- package/src/features/styles/formatting-resolver.js +72 -0
- package/src/features/styles/index.d.ts +256 -0
- package/src/features/styles/index.js +1325 -0
- package/src/features/styles/latent-styles.d.ts +68 -0
- package/src/features/styles/latent-styles.js +305 -0
- package/src/features/styles/paragraph-properties.d.ts +71 -0
- package/src/features/styles/paragraph-properties.js +237 -0
- package/src/features/styles/run-properties.d.ts +93 -0
- package/src/features/styles/run-properties.js +516 -0
- package/src/features/styles/style-base.d.ts +402 -0
- package/src/features/styles/style-base.js +1026 -0
- package/src/features/styles/style-collection.d.ts +264 -0
- package/src/features/styles/style-collection.js +714 -0
- package/src/features/styles/style-format-bridge.d.ts +64 -0
- package/src/features/styles/style-format-bridge.js +100 -0
- package/src/features/styles/style.d.ts +84 -0
- package/src/features/styles/style.js +375 -0
- package/src/features/styles/styles-with-effects.d.ts +71 -0
- package/src/features/styles/styles-with-effects.js +180 -0
- package/src/features/styles/table-style.d.ts +272 -0
- package/src/features/styles/table-style.js +1226 -0
- package/src/features/styles/theme.d.ts +126 -0
- package/src/features/styles/theme.js +377 -0
- package/src/features/tables/border-style-map.d.ts +24 -0
- package/src/features/tables/border-style-map.js +81 -0
- package/src/features/tables/borders.d.ts +126 -0
- package/src/features/tables/borders.js +527 -0
- package/src/features/tables/collections.d.ts +113 -0
- package/src/features/tables/collections.js +261 -0
- package/src/features/tables/format.d.ts +208 -0
- package/src/features/tables/format.js +716 -0
- package/src/features/tables/index.d.ts +597 -0
- package/src/features/tables/index.js +2386 -0
- package/src/features/tables/paddings.d.ts +41 -0
- package/src/features/tables/paddings.js +97 -0
- package/src/features/tables/tbl-pr-positioning.d.ts +27 -0
- package/src/features/tables/tbl-pr-positioning.js +178 -0
- package/src/features/tables/tbl-pr.d.ts +528 -0
- package/src/features/tables/tbl-pr.js +1208 -0
- package/src/features/tables/tc-pr.d.ts +168 -0
- package/src/features/tables/tc-pr.js +553 -0
- package/src/features/tables/tr-pr.d.ts +60 -0
- package/src/features/tables/tr-pr.js +215 -0
- package/src/features/watermark/detect.d.ts +76 -0
- package/src/features/watermark/detect.js +219 -0
- package/src/features/watermark/index.d.ts +28 -0
- package/src/features/watermark/index.js +91 -0
- package/src/features/watermark/logical-store.d.ts +29 -0
- package/src/features/watermark/logical-store.js +31 -0
- package/src/features/watermark/model.d.ts +285 -0
- package/src/features/watermark/model.js +597 -0
- package/src/features/watermark/parse.d.ts +84 -0
- package/src/features/watermark/parse.js +815 -0
- package/src/features/watermark/serialize.d.ts +98 -0
- package/src/features/watermark/serialize.js +1517 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Table / row / cell format facades and positioning (DocIO-aligned).
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
import { createTableBordersHost, createCellBordersHost, Borders } from './borders';
|
|
18
|
+
import { Paddings } from './paddings';
|
|
19
|
+
import { readTableAlignment, readTableBorders, readTableCellMargins, readTableCellSpacing, readTableLayout, readTablePreferredWidth, readTableShading, writeTableAlignment, writeTableBorders, writeTableCellMargins, writeTableCellSpacing, writeTableLayout, writeTablePreferredWidth, writeTableShading, twipsToPoint, pointToTwips, } from './tbl-pr';
|
|
20
|
+
import { readRowCantSplit, readRowShading, writeRowCantSplit, writeRowShading, } from './tr-pr';
|
|
21
|
+
import { readCellBorders, readCellFitText, readCellMargins, readCellNoWrap, readCellShading, readCellTextDirection, readCellVerticalAlignment, readGridSpan, readHorizontalMerge, readIsSamePaddingsAsTable, readVerticalMerge, writeCellBorders, writeCellFitText, writeCellMargins, writeCellNoWrap, writeCellShading, writeCellTextDirection, writeCellVerticalAlignment, writeGridSpan, writeHorizontalMerge, writeIsSamePaddingsAsTable, writeVerticalMerge, } from './tc-pr';
|
|
22
|
+
import { readTablePositioning, writeTablePositioning, } from './tbl-pr-positioning';
|
|
23
|
+
import { colorToHexWire, normalizeColorHex } from '../document/color';
|
|
24
|
+
/**
|
|
25
|
+
* Horizontal merge / vertical merge token (`ST_Merge` mapping).
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export var CellMerge = {
|
|
30
|
+
None: 'none',
|
|
31
|
+
Start: 'start',
|
|
32
|
+
Continue: 'continue',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Horizontal origin for floating table position (`w:tblpPr/@w:horzAnchor`).
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export var TableHorizontalOrigin = {
|
|
40
|
+
Margin: 'margin',
|
|
41
|
+
Page: 'page',
|
|
42
|
+
Column: 'column',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Vertical origin for floating table position (`w:tblpPr/@w:vertAnchor`).
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export var TableVerticalOrigin = {
|
|
50
|
+
Margin: 'margin',
|
|
51
|
+
Page: 'page',
|
|
52
|
+
Paragraph: 'paragraph',
|
|
53
|
+
};
|
|
54
|
+
function shdFill(shd) {
|
|
55
|
+
return shd == null ? undefined : shd.fill;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Normalize table/row/cell shading fill input to OOXML wire (`RRGGBB` / `'auto'`).
|
|
59
|
+
* {@link Color} becomes hex. {@link Color.Transparent} and empty tokens clear fill
|
|
60
|
+
* (`undefined`) — never invent `fill="auto"` for “no color” authoring.
|
|
61
|
+
* Explicit string `'auto'` is preserved for load-path / intentional wire parity.
|
|
62
|
+
* Strings may include a leading `#`; unknown non-hex tokens pass through for load-path compatibility.
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
function shadingFillToWire(value) {
|
|
66
|
+
if (typeof value === 'number') {
|
|
67
|
+
var hex_1 = colorToHexWire(value);
|
|
68
|
+
// Transparent (empty hex) clears fill; do not map to wire `auto`.
|
|
69
|
+
return hex_1.length > 0 ? hex_1 : undefined;
|
|
70
|
+
}
|
|
71
|
+
var raw = value.trim();
|
|
72
|
+
if (raw.length === 0) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
if (raw.toLowerCase() === 'auto') {
|
|
76
|
+
return 'auto';
|
|
77
|
+
}
|
|
78
|
+
var hex = normalizeColorHex(raw);
|
|
79
|
+
return hex !== undefined ? hex : value;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Build a `w:shd` bag from a fill wire value.
|
|
83
|
+
* When a fill is authored, default `pattern` to `clear` and `color` to `auto`
|
|
84
|
+
* (DocIO / Word direct-format shape) unless previous shading already set them.
|
|
85
|
+
* Never invents `fill: 'auto'` unless the caller passed that wire value.
|
|
86
|
+
* Clearing fill drops a DocIO-default-only remainder (`clear`/`auto`) so bare
|
|
87
|
+
* `w:shd` without a real fill is not left behind.
|
|
88
|
+
*
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
function shdFromFill(fill, prev) {
|
|
92
|
+
if (fill === undefined) {
|
|
93
|
+
if (prev === undefined) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
var patternLeft = prev.pattern;
|
|
97
|
+
var colorLeft = prev.color;
|
|
98
|
+
// clear + auto (or absent) is only the DocIO default envelope for a real fill.
|
|
99
|
+
var onlyDocIoDefaults = (patternLeft === undefined || patternLeft === 'clear') &&
|
|
100
|
+
(colorLeft === undefined || colorLeft === 'auto');
|
|
101
|
+
if (onlyDocIoDefaults) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
if (colorLeft === undefined && patternLeft === undefined) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return __assign({}, (colorLeft !== undefined ? { color: colorLeft } : {}), (patternLeft !== undefined ? { pattern: patternLeft } : {}));
|
|
108
|
+
}
|
|
109
|
+
// DocIO cell/table backColor: val="clear" color="auto" fill="<hex|auto>"
|
|
110
|
+
var pattern = prev !== undefined && prev.pattern !== undefined && prev.pattern.length > 0
|
|
111
|
+
? prev.pattern
|
|
112
|
+
: 'clear';
|
|
113
|
+
var color = prev !== undefined && prev.color !== undefined && prev.color.length > 0
|
|
114
|
+
? prev.color
|
|
115
|
+
: 'auto';
|
|
116
|
+
return {
|
|
117
|
+
fill: fill,
|
|
118
|
+
color: color,
|
|
119
|
+
pattern: pattern,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function wireMergeToCellMerge(v) {
|
|
123
|
+
if (v === 'restart') {
|
|
124
|
+
return CellMerge.Start;
|
|
125
|
+
}
|
|
126
|
+
if (v === 'continue') {
|
|
127
|
+
return CellMerge.Continue;
|
|
128
|
+
}
|
|
129
|
+
return CellMerge.None;
|
|
130
|
+
}
|
|
131
|
+
function cellMergeToWire(v) {
|
|
132
|
+
if (v === CellMerge.Start) {
|
|
133
|
+
return 'restart';
|
|
134
|
+
}
|
|
135
|
+
if (v === CellMerge.Continue) {
|
|
136
|
+
return 'continue';
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Floating table position (`w:tblpPr`).
|
|
142
|
+
*
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
var TablePositioning = /** @class */ (function () {
|
|
146
|
+
/**
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
function TablePositioning(host) {
|
|
150
|
+
this.host = host;
|
|
151
|
+
}
|
|
152
|
+
TablePositioning.prototype.readBag = function () {
|
|
153
|
+
var bag = readTablePositioning(this.host.readTblPr());
|
|
154
|
+
return bag !== undefined ? bag : {};
|
|
155
|
+
};
|
|
156
|
+
TablePositioning.prototype.writeBag = function (next) {
|
|
157
|
+
this.host.writeTblPr(writeTablePositioning(this.host.readTblPr(), next));
|
|
158
|
+
};
|
|
159
|
+
Object.defineProperty(TablePositioning.prototype, "horizontalPosition", {
|
|
160
|
+
get: function () {
|
|
161
|
+
var v = this.readBag().horizontalPosition;
|
|
162
|
+
return v !== undefined ? v : 0;
|
|
163
|
+
},
|
|
164
|
+
set: function (value) {
|
|
165
|
+
var prev = this.readBag();
|
|
166
|
+
this.writeBag({
|
|
167
|
+
horizontalPosition: value,
|
|
168
|
+
verticalPosition: prev.verticalPosition,
|
|
169
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
170
|
+
verticalOrigin: prev.verticalOrigin,
|
|
171
|
+
distanceFromTop: prev.distanceFromTop,
|
|
172
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
173
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
174
|
+
distanceFromRight: prev.distanceFromRight,
|
|
175
|
+
unknownAttributes: prev.unknownAttributes,
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
enumerable: true,
|
|
179
|
+
configurable: true
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(TablePositioning.prototype, "verticalPosition", {
|
|
182
|
+
get: function () {
|
|
183
|
+
var v = this.readBag().verticalPosition;
|
|
184
|
+
return v !== undefined ? v : 0;
|
|
185
|
+
},
|
|
186
|
+
set: function (value) {
|
|
187
|
+
var prev = this.readBag();
|
|
188
|
+
this.writeBag({
|
|
189
|
+
horizontalPosition: prev.horizontalPosition,
|
|
190
|
+
verticalPosition: value,
|
|
191
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
192
|
+
verticalOrigin: prev.verticalOrigin,
|
|
193
|
+
distanceFromTop: prev.distanceFromTop,
|
|
194
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
195
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
196
|
+
distanceFromRight: prev.distanceFromRight,
|
|
197
|
+
unknownAttributes: prev.unknownAttributes,
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
enumerable: true,
|
|
201
|
+
configurable: true
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(TablePositioning.prototype, "horizontalOrigin", {
|
|
204
|
+
get: function () {
|
|
205
|
+
var v = this.readBag().horizontalOrigin;
|
|
206
|
+
return v !== undefined ? v : TableHorizontalOrigin.Margin;
|
|
207
|
+
},
|
|
208
|
+
set: function (value) {
|
|
209
|
+
var prev = this.readBag();
|
|
210
|
+
this.writeBag({
|
|
211
|
+
horizontalPosition: prev.horizontalPosition,
|
|
212
|
+
verticalPosition: prev.verticalPosition,
|
|
213
|
+
horizontalOrigin: value,
|
|
214
|
+
verticalOrigin: prev.verticalOrigin,
|
|
215
|
+
distanceFromTop: prev.distanceFromTop,
|
|
216
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
217
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
218
|
+
distanceFromRight: prev.distanceFromRight,
|
|
219
|
+
unknownAttributes: prev.unknownAttributes,
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
enumerable: true,
|
|
223
|
+
configurable: true
|
|
224
|
+
});
|
|
225
|
+
Object.defineProperty(TablePositioning.prototype, "verticalOrigin", {
|
|
226
|
+
get: function () {
|
|
227
|
+
var v = this.readBag().verticalOrigin;
|
|
228
|
+
return v !== undefined ? v : TableVerticalOrigin.Margin;
|
|
229
|
+
},
|
|
230
|
+
set: function (value) {
|
|
231
|
+
var prev = this.readBag();
|
|
232
|
+
this.writeBag({
|
|
233
|
+
horizontalPosition: prev.horizontalPosition,
|
|
234
|
+
verticalPosition: prev.verticalPosition,
|
|
235
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
236
|
+
verticalOrigin: value,
|
|
237
|
+
distanceFromTop: prev.distanceFromTop,
|
|
238
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
239
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
240
|
+
distanceFromRight: prev.distanceFromRight,
|
|
241
|
+
unknownAttributes: prev.unknownAttributes,
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
enumerable: true,
|
|
245
|
+
configurable: true
|
|
246
|
+
});
|
|
247
|
+
Object.defineProperty(TablePositioning.prototype, "distanceFromTop", {
|
|
248
|
+
get: function () {
|
|
249
|
+
var v = this.readBag().distanceFromTop;
|
|
250
|
+
return v !== undefined ? v : 0;
|
|
251
|
+
},
|
|
252
|
+
set: function (value) {
|
|
253
|
+
var prev = this.readBag();
|
|
254
|
+
this.writeBag({
|
|
255
|
+
horizontalPosition: prev.horizontalPosition,
|
|
256
|
+
verticalPosition: prev.verticalPosition,
|
|
257
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
258
|
+
verticalOrigin: prev.verticalOrigin,
|
|
259
|
+
distanceFromTop: value,
|
|
260
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
261
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
262
|
+
distanceFromRight: prev.distanceFromRight,
|
|
263
|
+
unknownAttributes: prev.unknownAttributes,
|
|
264
|
+
});
|
|
265
|
+
},
|
|
266
|
+
enumerable: true,
|
|
267
|
+
configurable: true
|
|
268
|
+
});
|
|
269
|
+
Object.defineProperty(TablePositioning.prototype, "distanceFromBottom", {
|
|
270
|
+
get: function () {
|
|
271
|
+
var v = this.readBag().distanceFromBottom;
|
|
272
|
+
return v !== undefined ? v : 0;
|
|
273
|
+
},
|
|
274
|
+
set: function (value) {
|
|
275
|
+
var prev = this.readBag();
|
|
276
|
+
this.writeBag({
|
|
277
|
+
horizontalPosition: prev.horizontalPosition,
|
|
278
|
+
verticalPosition: prev.verticalPosition,
|
|
279
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
280
|
+
verticalOrigin: prev.verticalOrigin,
|
|
281
|
+
distanceFromTop: prev.distanceFromTop,
|
|
282
|
+
distanceFromBottom: value,
|
|
283
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
284
|
+
distanceFromRight: prev.distanceFromRight,
|
|
285
|
+
unknownAttributes: prev.unknownAttributes,
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
enumerable: true,
|
|
289
|
+
configurable: true
|
|
290
|
+
});
|
|
291
|
+
Object.defineProperty(TablePositioning.prototype, "distanceFromLeft", {
|
|
292
|
+
get: function () {
|
|
293
|
+
var v = this.readBag().distanceFromLeft;
|
|
294
|
+
return v !== undefined ? v : 0;
|
|
295
|
+
},
|
|
296
|
+
set: function (value) {
|
|
297
|
+
var prev = this.readBag();
|
|
298
|
+
this.writeBag({
|
|
299
|
+
horizontalPosition: prev.horizontalPosition,
|
|
300
|
+
verticalPosition: prev.verticalPosition,
|
|
301
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
302
|
+
verticalOrigin: prev.verticalOrigin,
|
|
303
|
+
distanceFromTop: prev.distanceFromTop,
|
|
304
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
305
|
+
distanceFromLeft: value,
|
|
306
|
+
distanceFromRight: prev.distanceFromRight,
|
|
307
|
+
unknownAttributes: prev.unknownAttributes,
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
enumerable: true,
|
|
311
|
+
configurable: true
|
|
312
|
+
});
|
|
313
|
+
Object.defineProperty(TablePositioning.prototype, "distanceFromRight", {
|
|
314
|
+
get: function () {
|
|
315
|
+
var v = this.readBag().distanceFromRight;
|
|
316
|
+
return v !== undefined ? v : 0;
|
|
317
|
+
},
|
|
318
|
+
set: function (value) {
|
|
319
|
+
var prev = this.readBag();
|
|
320
|
+
this.writeBag({
|
|
321
|
+
horizontalPosition: prev.horizontalPosition,
|
|
322
|
+
verticalPosition: prev.verticalPosition,
|
|
323
|
+
horizontalOrigin: prev.horizontalOrigin,
|
|
324
|
+
verticalOrigin: prev.verticalOrigin,
|
|
325
|
+
distanceFromTop: prev.distanceFromTop,
|
|
326
|
+
distanceFromBottom: prev.distanceFromBottom,
|
|
327
|
+
distanceFromLeft: prev.distanceFromLeft,
|
|
328
|
+
distanceFromRight: value,
|
|
329
|
+
unknownAttributes: prev.unknownAttributes,
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
enumerable: true,
|
|
333
|
+
configurable: true
|
|
334
|
+
});
|
|
335
|
+
return TablePositioning;
|
|
336
|
+
}());
|
|
337
|
+
export { TablePositioning };
|
|
338
|
+
/**
|
|
339
|
+
* Table-level formatting surface.
|
|
340
|
+
*
|
|
341
|
+
* @public
|
|
342
|
+
*/
|
|
343
|
+
var TableFormat = /** @class */ (function () {
|
|
344
|
+
/**
|
|
345
|
+
* @private
|
|
346
|
+
*/
|
|
347
|
+
function TableFormat(host) {
|
|
348
|
+
var _this = this;
|
|
349
|
+
this.host = host;
|
|
350
|
+
this.bordersInstance = new Borders(createTableBordersHost(function () { return readTableBorders(_this.host.readTblPr()); }, function (value) {
|
|
351
|
+
_this.host.writeTblPr(writeTableBorders(_this.host.readTblPr(), value));
|
|
352
|
+
}), true);
|
|
353
|
+
var padHost = {
|
|
354
|
+
read: function () { return readTableCellMargins(_this.host.readTblPr()); },
|
|
355
|
+
write: function (value) {
|
|
356
|
+
_this.host.writeTblPr(writeTableCellMargins(_this.host.readTblPr(), value));
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
this.paddingsInstance = new Paddings(padHost);
|
|
360
|
+
this.positioningInstance = new TablePositioning(host);
|
|
361
|
+
}
|
|
362
|
+
Object.defineProperty(TableFormat.prototype, "borders", {
|
|
363
|
+
get: function () {
|
|
364
|
+
return this.bordersInstance;
|
|
365
|
+
},
|
|
366
|
+
enumerable: true,
|
|
367
|
+
configurable: true
|
|
368
|
+
});
|
|
369
|
+
Object.defineProperty(TableFormat.prototype, "paddings", {
|
|
370
|
+
get: function () {
|
|
371
|
+
return this.paddingsInstance;
|
|
372
|
+
},
|
|
373
|
+
enumerable: true,
|
|
374
|
+
configurable: true
|
|
375
|
+
});
|
|
376
|
+
Object.defineProperty(TableFormat.prototype, "positioning", {
|
|
377
|
+
get: function () {
|
|
378
|
+
return this.positioningInstance;
|
|
379
|
+
},
|
|
380
|
+
enumerable: true,
|
|
381
|
+
configurable: true
|
|
382
|
+
});
|
|
383
|
+
Object.defineProperty(TableFormat.prototype, "horizontalAlignment", {
|
|
384
|
+
get: function () {
|
|
385
|
+
var value = readTableAlignment(this.host.readTblPr());
|
|
386
|
+
return value !== undefined ? value : 'left';
|
|
387
|
+
},
|
|
388
|
+
set: function (value) {
|
|
389
|
+
if (value !== 'left' && value !== 'center' && value !== 'right') {
|
|
390
|
+
throw new RangeError('Unsupported TableAlignment value');
|
|
391
|
+
}
|
|
392
|
+
this.host.writeTblPr(writeTableAlignment(this.host.readTblPr(), value));
|
|
393
|
+
},
|
|
394
|
+
enumerable: true,
|
|
395
|
+
configurable: true
|
|
396
|
+
});
|
|
397
|
+
Object.defineProperty(TableFormat.prototype, "cellSpacing", {
|
|
398
|
+
get: function () {
|
|
399
|
+
var value = readTableCellSpacing(this.host.readTblPr());
|
|
400
|
+
return value !== undefined ? value : 0;
|
|
401
|
+
},
|
|
402
|
+
set: function (value) {
|
|
403
|
+
if (typeof value !== 'number' || !isFinite(value) || value < 0) {
|
|
404
|
+
throw new RangeError('cellSpacing must be a finite non-negative number');
|
|
405
|
+
}
|
|
406
|
+
this.host.writeTblPr(writeTableCellSpacing(this.host.readTblPr(), value));
|
|
407
|
+
},
|
|
408
|
+
enumerable: true,
|
|
409
|
+
configurable: true
|
|
410
|
+
});
|
|
411
|
+
Object.defineProperty(TableFormat.prototype, "backColor", {
|
|
412
|
+
/**
|
|
413
|
+
* Table background fill (`w:tblPr/w:shd/@w:fill`).
|
|
414
|
+
*
|
|
415
|
+
* - **Get (runtime)**: OOXML wire string — hex `RRGGBB`, `'auto'`, or `undefined` when unset.
|
|
416
|
+
* - **Set**: hex string / `'auto'` (optional leading `#`), a {@link Color} enum value, or
|
|
417
|
+
* `undefined` to clear the authored fill. {@link Color.Transparent} clears fill
|
|
418
|
+
* (does not invent `w:fill="auto"`).
|
|
419
|
+
*
|
|
420
|
+
* TypeScript 3.3 requires identical get/set types, so the declared type is
|
|
421
|
+
* `string | Color | undefined`; the getter always returns a string when set.
|
|
422
|
+
*/
|
|
423
|
+
get: function () {
|
|
424
|
+
return shdFill(readTableShading(this.host.readTblPr()));
|
|
425
|
+
},
|
|
426
|
+
set: function (value) {
|
|
427
|
+
var prev = readTableShading(this.host.readTblPr());
|
|
428
|
+
var wire = value === undefined ? undefined : shadingFillToWire(value);
|
|
429
|
+
this.host.writeTblPr(writeTableShading(this.host.readTblPr(), shdFromFill(wire, prev)));
|
|
430
|
+
// DocIO writes the same fill onto each cell so tcPr/shd carries the color.
|
|
431
|
+
var apply = this.host.applyTableBackColorToCells;
|
|
432
|
+
if (apply !== undefined) {
|
|
433
|
+
apply.call(this.host, wire);
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
enumerable: true,
|
|
437
|
+
configurable: true
|
|
438
|
+
});
|
|
439
|
+
Object.defineProperty(TableFormat.prototype, "wrapAround", {
|
|
440
|
+
/**
|
|
441
|
+
* When `true`, text may wrap around a floating table (`w:tblpPr` present).
|
|
442
|
+
* When `false`, the table is inline (no `w:tblpPr`).
|
|
443
|
+
*/
|
|
444
|
+
get: function () {
|
|
445
|
+
return readTablePositioning(this.host.readTblPr()) !== undefined;
|
|
446
|
+
},
|
|
447
|
+
set: function (value) {
|
|
448
|
+
if (value) {
|
|
449
|
+
var existing = readTablePositioning(this.host.readTblPr());
|
|
450
|
+
if (existing === undefined) {
|
|
451
|
+
this.host.writeTblPr(writeTablePositioning(this.host.readTblPr(), {}));
|
|
452
|
+
}
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
this.host.writeTblPr(writeTablePositioning(this.host.readTblPr(), undefined));
|
|
456
|
+
},
|
|
457
|
+
enumerable: true,
|
|
458
|
+
configurable: true
|
|
459
|
+
});
|
|
460
|
+
Object.defineProperty(TableFormat.prototype, "isAutoResized", {
|
|
461
|
+
/**
|
|
462
|
+
* Inverse of fixed layout: `true` when layout is autoFit (default).
|
|
463
|
+
*/
|
|
464
|
+
get: function () {
|
|
465
|
+
return readTableLayout(this.host.readTblPr()) !== 'fixed';
|
|
466
|
+
},
|
|
467
|
+
set: function (value) {
|
|
468
|
+
var layout = value ? 'autoFit' : 'fixed';
|
|
469
|
+
this.host.writeTblPr(writeTableLayout(this.host.readTblPr(), layout));
|
|
470
|
+
},
|
|
471
|
+
enumerable: true,
|
|
472
|
+
configurable: true
|
|
473
|
+
});
|
|
474
|
+
Object.defineProperty(TableFormat.prototype, "preferredWidth", {
|
|
475
|
+
/**
|
|
476
|
+
* @private
|
|
477
|
+
* Preferred width bag used by AutoFit / width helpers.
|
|
478
|
+
*/
|
|
479
|
+
get: function () {
|
|
480
|
+
return readTablePreferredWidth(this.host.readTblPr());
|
|
481
|
+
},
|
|
482
|
+
set: function (value) {
|
|
483
|
+
this.host.writeTblPr(writeTablePreferredWidth(this.host.readTblPr(), value));
|
|
484
|
+
},
|
|
485
|
+
enumerable: true,
|
|
486
|
+
configurable: true
|
|
487
|
+
});
|
|
488
|
+
Object.defineProperty(TableFormat.prototype, "layout", {
|
|
489
|
+
/**
|
|
490
|
+
* @private
|
|
491
|
+
*/
|
|
492
|
+
get: function () {
|
|
493
|
+
return readTableLayout(this.host.readTblPr());
|
|
494
|
+
},
|
|
495
|
+
set: function (value) {
|
|
496
|
+
this.host.writeTblPr(writeTableLayout(this.host.readTblPr(), value));
|
|
497
|
+
},
|
|
498
|
+
enumerable: true,
|
|
499
|
+
configurable: true
|
|
500
|
+
});
|
|
501
|
+
return TableFormat;
|
|
502
|
+
}());
|
|
503
|
+
export { TableFormat };
|
|
504
|
+
/**
|
|
505
|
+
* Row-level formatting surface.
|
|
506
|
+
*
|
|
507
|
+
* @public
|
|
508
|
+
*/
|
|
509
|
+
var RowFormat = /** @class */ (function () {
|
|
510
|
+
/**
|
|
511
|
+
* @private
|
|
512
|
+
*/
|
|
513
|
+
function RowFormat(host) {
|
|
514
|
+
this.host = host;
|
|
515
|
+
}
|
|
516
|
+
Object.defineProperty(RowFormat.prototype, "isBreakAcrossPages", {
|
|
517
|
+
/**
|
|
518
|
+
* When `true`, the row may break across pages (Word default).
|
|
519
|
+
* Maps inversely to `w:cantSplit`.
|
|
520
|
+
*/
|
|
521
|
+
get: function () {
|
|
522
|
+
var cant = readRowCantSplit(this.host.readTrPr());
|
|
523
|
+
return cant !== true;
|
|
524
|
+
},
|
|
525
|
+
set: function (value) {
|
|
526
|
+
// isBreakAcrossPages true → remove cantSplit; false → write cantSplit on.
|
|
527
|
+
this.host.writeTrPr(writeRowCantSplit(this.host.readTrPr(), value ? undefined : true));
|
|
528
|
+
},
|
|
529
|
+
enumerable: true,
|
|
530
|
+
configurable: true
|
|
531
|
+
});
|
|
532
|
+
Object.defineProperty(RowFormat.prototype, "backColor", {
|
|
533
|
+
/**
|
|
534
|
+
* Row background fill (`w:trPr/w:shd/@w:fill`).
|
|
535
|
+
*
|
|
536
|
+
* - **Get (runtime)**: OOXML wire string — hex `RRGGBB`, `'auto'`, or `undefined` when unset.
|
|
537
|
+
* - **Set**: hex string / `'auto'` (optional leading `#`), a {@link Color} enum value, or
|
|
538
|
+
* `undefined` to clear the authored fill. {@link Color.Transparent} clears fill
|
|
539
|
+
* (does not invent `w:fill="auto"`).
|
|
540
|
+
*/
|
|
541
|
+
get: function () {
|
|
542
|
+
return shdFill(readRowShading(this.host.readTrPr()));
|
|
543
|
+
},
|
|
544
|
+
set: function (value) {
|
|
545
|
+
var prev = readRowShading(this.host.readTrPr());
|
|
546
|
+
var wire = value === undefined ? undefined : shadingFillToWire(value);
|
|
547
|
+
this.host.writeTrPr(writeRowShading(this.host.readTrPr(), shdFromFill(wire, prev)));
|
|
548
|
+
},
|
|
549
|
+
enumerable: true,
|
|
550
|
+
configurable: true
|
|
551
|
+
});
|
|
552
|
+
return RowFormat;
|
|
553
|
+
}());
|
|
554
|
+
export { RowFormat };
|
|
555
|
+
/**
|
|
556
|
+
* Cell-level formatting surface.
|
|
557
|
+
*
|
|
558
|
+
* @public
|
|
559
|
+
*/
|
|
560
|
+
var CellFormat = /** @class */ (function () {
|
|
561
|
+
/**
|
|
562
|
+
* @private
|
|
563
|
+
*/
|
|
564
|
+
function CellFormat(host) {
|
|
565
|
+
var _this = this;
|
|
566
|
+
this.host = host;
|
|
567
|
+
this.bordersInstance = new Borders(createCellBordersHost(function () { return readCellBorders(_this.host.readTcPr()); }, function (value) {
|
|
568
|
+
_this.host.writeTcPr(writeCellBorders(_this.host.readTcPr(), value));
|
|
569
|
+
}), false);
|
|
570
|
+
var padHost = {
|
|
571
|
+
read: function () { return readCellMargins(_this.host.readTcPr()); },
|
|
572
|
+
write: function (value) {
|
|
573
|
+
_this.host.writeTcPr(writeCellMargins(_this.host.readTcPr(), value));
|
|
574
|
+
},
|
|
575
|
+
};
|
|
576
|
+
this.paddingsInstance = new Paddings(padHost);
|
|
577
|
+
}
|
|
578
|
+
Object.defineProperty(CellFormat.prototype, "backColor", {
|
|
579
|
+
/**
|
|
580
|
+
* Cell background fill (`w:tcPr/w:shd/@w:fill`).
|
|
581
|
+
*
|
|
582
|
+
* - **Get (runtime)**: OOXML wire string — hex `RRGGBB`, `'auto'`, or `undefined` when unset.
|
|
583
|
+
* - **Set**: hex string / `'auto'` (optional leading `#`), a {@link Color} enum value, or
|
|
584
|
+
* `undefined` to clear the authored fill. {@link Color.Transparent} clears fill
|
|
585
|
+
* (does not invent `w:fill="auto"`).
|
|
586
|
+
*/
|
|
587
|
+
get: function () {
|
|
588
|
+
return shdFill(readCellShading(this.host.readTcPr()));
|
|
589
|
+
},
|
|
590
|
+
set: function (value) {
|
|
591
|
+
var prev = readCellShading(this.host.readTcPr());
|
|
592
|
+
var wire = value === undefined ? undefined : shadingFillToWire(value);
|
|
593
|
+
this.host.writeTcPr(writeCellShading(this.host.readTcPr(), shdFromFill(wire, prev)));
|
|
594
|
+
},
|
|
595
|
+
enumerable: true,
|
|
596
|
+
configurable: true
|
|
597
|
+
});
|
|
598
|
+
Object.defineProperty(CellFormat.prototype, "borders", {
|
|
599
|
+
get: function () {
|
|
600
|
+
return this.bordersInstance;
|
|
601
|
+
},
|
|
602
|
+
enumerable: true,
|
|
603
|
+
configurable: true
|
|
604
|
+
});
|
|
605
|
+
Object.defineProperty(CellFormat.prototype, "paddings", {
|
|
606
|
+
get: function () {
|
|
607
|
+
return this.paddingsInstance;
|
|
608
|
+
},
|
|
609
|
+
enumerable: true,
|
|
610
|
+
configurable: true
|
|
611
|
+
});
|
|
612
|
+
Object.defineProperty(CellFormat.prototype, "verticalAlignment", {
|
|
613
|
+
get: function () {
|
|
614
|
+
var value = readCellVerticalAlignment(this.host.readTcPr());
|
|
615
|
+
return value !== undefined ? value : 'top';
|
|
616
|
+
},
|
|
617
|
+
set: function (value) {
|
|
618
|
+
if (value !== 'top' && value !== 'center' && value !== 'bottom') {
|
|
619
|
+
throw new RangeError('Unsupported verticalAlignment value');
|
|
620
|
+
}
|
|
621
|
+
this.host.writeTcPr(writeCellVerticalAlignment(this.host.readTcPr(), value));
|
|
622
|
+
},
|
|
623
|
+
enumerable: true,
|
|
624
|
+
configurable: true
|
|
625
|
+
});
|
|
626
|
+
Object.defineProperty(CellFormat.prototype, "textDirection", {
|
|
627
|
+
get: function () {
|
|
628
|
+
var value = readCellTextDirection(this.host.readTcPr());
|
|
629
|
+
return value !== undefined ? value : 'lr';
|
|
630
|
+
},
|
|
631
|
+
set: function (value) {
|
|
632
|
+
if (value !== 'lr' &&
|
|
633
|
+
value !== 'rl' &&
|
|
634
|
+
value !== 'tb' &&
|
|
635
|
+
value !== 'btLr' &&
|
|
636
|
+
value !== 'lrV' &&
|
|
637
|
+
value !== 'rlV') {
|
|
638
|
+
throw new RangeError('Unsupported textDirection value');
|
|
639
|
+
}
|
|
640
|
+
this.host.writeTcPr(writeCellTextDirection(this.host.readTcPr(), value));
|
|
641
|
+
},
|
|
642
|
+
enumerable: true,
|
|
643
|
+
configurable: true
|
|
644
|
+
});
|
|
645
|
+
Object.defineProperty(CellFormat.prototype, "wrapText", {
|
|
646
|
+
/**
|
|
647
|
+
* When `true`, cell text wraps (default). Maps inversely to `w:noWrap`.
|
|
648
|
+
*/
|
|
649
|
+
get: function () {
|
|
650
|
+
var noWrap = readCellNoWrap(this.host.readTcPr());
|
|
651
|
+
return noWrap !== true;
|
|
652
|
+
},
|
|
653
|
+
set: function (value) {
|
|
654
|
+
this.host.writeTcPr(writeCellNoWrap(this.host.readTcPr(), value ? undefined : true));
|
|
655
|
+
},
|
|
656
|
+
enumerable: true,
|
|
657
|
+
configurable: true
|
|
658
|
+
});
|
|
659
|
+
Object.defineProperty(CellFormat.prototype, "fitText", {
|
|
660
|
+
get: function () {
|
|
661
|
+
var v = readCellFitText(this.host.readTcPr());
|
|
662
|
+
return v === true;
|
|
663
|
+
},
|
|
664
|
+
set: function (value) {
|
|
665
|
+
this.host.writeTcPr(writeCellFitText(this.host.readTcPr(), value ? true : undefined));
|
|
666
|
+
},
|
|
667
|
+
enumerable: true,
|
|
668
|
+
configurable: true
|
|
669
|
+
});
|
|
670
|
+
Object.defineProperty(CellFormat.prototype, "columnSpan", {
|
|
671
|
+
get: function () {
|
|
672
|
+
var span = readGridSpan(this.host.readTcPr());
|
|
673
|
+
return span !== undefined && span > 0 ? span : 1;
|
|
674
|
+
},
|
|
675
|
+
set: function (value) {
|
|
676
|
+
this.host.writeTcPr(writeGridSpan(this.host.readTcPr(), value));
|
|
677
|
+
},
|
|
678
|
+
enumerable: true,
|
|
679
|
+
configurable: true
|
|
680
|
+
});
|
|
681
|
+
Object.defineProperty(CellFormat.prototype, "horizontalMerge", {
|
|
682
|
+
get: function () {
|
|
683
|
+
return wireMergeToCellMerge(readHorizontalMerge(this.host.readTcPr()));
|
|
684
|
+
},
|
|
685
|
+
set: function (value) {
|
|
686
|
+
this.host.writeTcPr(writeHorizontalMerge(this.host.readTcPr(), cellMergeToWire(value)));
|
|
687
|
+
},
|
|
688
|
+
enumerable: true,
|
|
689
|
+
configurable: true
|
|
690
|
+
});
|
|
691
|
+
Object.defineProperty(CellFormat.prototype, "verticalMerge", {
|
|
692
|
+
get: function () {
|
|
693
|
+
return wireMergeToCellMerge(readVerticalMerge(this.host.readTcPr()));
|
|
694
|
+
},
|
|
695
|
+
set: function (value) {
|
|
696
|
+
this.host.writeTcPr(writeVerticalMerge(this.host.readTcPr(), cellMergeToWire(value)));
|
|
697
|
+
},
|
|
698
|
+
enumerable: true,
|
|
699
|
+
configurable: true
|
|
700
|
+
});
|
|
701
|
+
Object.defineProperty(CellFormat.prototype, "samePaddingsAsTable", {
|
|
702
|
+
get: function () {
|
|
703
|
+
return readIsSamePaddingsAsTable(this.host.readTcPr());
|
|
704
|
+
},
|
|
705
|
+
set: function (value) {
|
|
706
|
+
this.host.writeTcPr(writeIsSamePaddingsAsTable(this.host.readTcPr(), value));
|
|
707
|
+
},
|
|
708
|
+
enumerable: true,
|
|
709
|
+
configurable: true
|
|
710
|
+
});
|
|
711
|
+
return CellFormat;
|
|
712
|
+
}());
|
|
713
|
+
export { CellFormat };
|
|
714
|
+
// Silence unused import when point helpers are only re-exported indirectly.
|
|
715
|
+
void twipsToPoint;
|
|
716
|
+
void pointToTwips;
|