@syncfusion/ej2-docx 0.0.0-stage → 35.1.39
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/README.md +68 -2
- package/core.js +4 -0
- package/dist/ej2-docx.umd.min.js +2 -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 +2 -0
- package/dist/global/ej2-docx.min.js.map +1 -0
- package/dist/global/index.d.ts +5 -0
- package/features.js +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +31 -4
- 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,1325 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spread = (this && this.__spread) || function () {
|
|
18
|
+
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
19
|
+
return ar;
|
|
20
|
+
};
|
|
21
|
+
var __values = (this && this.__values) || function (o) {
|
|
22
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
23
|
+
if (m) return m.call(o);
|
|
24
|
+
return {
|
|
25
|
+
next: function () {
|
|
26
|
+
if (o && i >= o.length) o = void 0;
|
|
27
|
+
return { value: o && o[i++], done: !o };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export * from './builtin-catalog';
|
|
32
|
+
export * from './builtin-resolver';
|
|
33
|
+
export * from './default-styles';
|
|
34
|
+
export * from './default-theme';
|
|
35
|
+
export * from './doc-defaults';
|
|
36
|
+
export * from './formatting-resolver';
|
|
37
|
+
export * from './latent-styles';
|
|
38
|
+
export * from './paragraph-properties';
|
|
39
|
+
export * from './run-properties';
|
|
40
|
+
export * from './style-base';
|
|
41
|
+
export * from './style-collection';
|
|
42
|
+
export * from './style-format-bridge';
|
|
43
|
+
export * from './style';
|
|
44
|
+
export * from './styles-with-effects';
|
|
45
|
+
export * from './table-style';
|
|
46
|
+
export * from './theme';
|
|
47
|
+
import { DocxError } from '../../core/errors/docx-error';
|
|
48
|
+
import { WordDocument } from '../document/document';
|
|
49
|
+
import { Paragraph } from '../document/paragraph';
|
|
50
|
+
import { TextRange } from '../document/text-range';
|
|
51
|
+
import { elementChildren, isWml, wmlElement, } from '../document/wml';
|
|
52
|
+
import { partName } from '../../core/opc/part-name';
|
|
53
|
+
import { featureId, isFeatureRegistered, registerFeature, registerFeatureMaterializeHandler, registerFeaturePartHandler, visitParagraphsInDocumentOrder, } from '../../core/registry/index';
|
|
54
|
+
import { parseXml, serializeXml, WML_TRANSITIONAL_NAMESPACE } from '../../core/xml/index';
|
|
55
|
+
import { parseDocDefaults } from './doc-defaults';
|
|
56
|
+
import { resolveReferencedStyle, resolveStyleForTarget } from './builtin-resolver';
|
|
57
|
+
import { StyleCollection } from './style-collection';
|
|
58
|
+
import { characterSnapshotToModeledRunProperties } from './style-format-bridge';
|
|
59
|
+
import { ParagraphStyle } from './style-base';
|
|
60
|
+
import { getBuiltinStyleTemplate, getBuiltinStyleTemplateByDisplayName, normalizeStyleName, } from './builtin-catalog';
|
|
61
|
+
import { buildDefaultStylesArgs } from './default-styles';
|
|
62
|
+
import { registerFontTableFeature, resetFontTableFeatureForTests, } from '../font-table/index';
|
|
63
|
+
import { resolveRunFormattingWithStyles } from './formatting-resolver';
|
|
64
|
+
import { parseLatentStyles } from './latent-styles';
|
|
65
|
+
import { EMPTY_MODELED_PARAGRAPH_PROPERTIES } from './paragraph-properties';
|
|
66
|
+
import { EMPTY_MODELED_RUN_PROPERTIES } from './run-properties';
|
|
67
|
+
import { createMinimalDocxStyle, parseDocxStyle } from './style';
|
|
68
|
+
import { registerStylesWithEffectsFeature, resetStylesWithEffectsFeatureForTests, } from './styles-with-effects';
|
|
69
|
+
import { registerThemeFeature, resetThemeFeatureForTests, themeFor } from './theme';
|
|
70
|
+
import { setStylesLookupFactory } from '../numbering/list-format';
|
|
71
|
+
// Bridge stylesFor into ListFormat.applyStyle without extensionless CJS require (Vitest ESM).
|
|
72
|
+
setStylesLookupFactory(function (document) { return stylesFor(document); });
|
|
73
|
+
var STYLES = featureId('styles');
|
|
74
|
+
/**
|
|
75
|
+
* @private
|
|
76
|
+
* Transitional styles relationship (ECMA-376-4 §9.2.12). */
|
|
77
|
+
export var STYLES_RELATIONSHIP_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles';
|
|
78
|
+
/**
|
|
79
|
+
* @private
|
|
80
|
+
* Strict styles relationship (ECMA-376-1 §11.3.12). */
|
|
81
|
+
export var STRICT_STYLES_RELATIONSHIP_TYPE = 'http://purl.oclc.org/ooxml/officeDocument/relationships/styles';
|
|
82
|
+
/**
|
|
83
|
+
* @private
|
|
84
|
+
* ECMA-376-1 §11.3.12 Style Definitions content type. */
|
|
85
|
+
export var STYLES_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml';
|
|
86
|
+
/**
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
export var STYLES_PART_NAME = partName('/word/styles.xml');
|
|
90
|
+
var utf8Decoder = new TextDecoder('utf-8');
|
|
91
|
+
var utf8 = new TextEncoder();
|
|
92
|
+
/**
|
|
93
|
+
* In-memory Style Definitions part (`word/styles.xml`).
|
|
94
|
+
*
|
|
95
|
+
* Models `CT_Styles` as optional {@link DocDefaults}, optional {@link LatentStyles},
|
|
96
|
+
* and an ordered list of {@link DocxStyle}. Serialize rebuilds the part from that
|
|
97
|
+
* class graph (not an opaque XML bag). Unmodeled root children are retained in
|
|
98
|
+
* document order relative to the three schema slots when dirty-path serialize runs.
|
|
99
|
+
*
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
/**
|
|
103
|
+
* In-memory Style Definitions part (`word/styles.xml`).
|
|
104
|
+
*
|
|
105
|
+
* Hosts package metadata (`docDefaults`, `latentStyles`, extras) and binds a
|
|
106
|
+
* document-owned live {@link StyleCollection}. Transitional {@link DocxStyle}
|
|
107
|
+
* lookups project from the live DOM with a stable shell cache so existing
|
|
108
|
+
* resolver tests keep identity for getStyle.
|
|
109
|
+
*
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
var StylesPart = /** @class */ (function () {
|
|
113
|
+
/**
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
function StylesPart(docDefaults, latentStyles, styles, rootExtrasBeforeStyles, rootExtrasAfterStyles, dirty) {
|
|
117
|
+
var e_1, _a;
|
|
118
|
+
this.docDefaultsValue = docDefaults;
|
|
119
|
+
this.latentStylesValue = latentStyles;
|
|
120
|
+
this.shellList = __spread(styles);
|
|
121
|
+
this.shellById = new Map();
|
|
122
|
+
try {
|
|
123
|
+
for (var _b = __values(this.shellList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
124
|
+
var style = _c.value;
|
|
125
|
+
this.shellById.set(style.styleId, style);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
129
|
+
finally {
|
|
130
|
+
try {
|
|
131
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
132
|
+
}
|
|
133
|
+
finally { if (e_1) throw e_1.error; }
|
|
134
|
+
}
|
|
135
|
+
this.collection = undefined;
|
|
136
|
+
this.projectedById = new Map();
|
|
137
|
+
this.rootExtrasBeforeStyles = rootExtrasBeforeStyles;
|
|
138
|
+
this.rootExtrasAfterStyles = rootExtrasAfterStyles;
|
|
139
|
+
this.pendingParagraphStyles = new Set();
|
|
140
|
+
this.pendingCharacterStyles = new Set();
|
|
141
|
+
this.pendingTableStyles = new Set();
|
|
142
|
+
this.dirty = dirty;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
* StyleCollectionHost: styles package dirty + invalidate DocxStyle projection cache.
|
|
147
|
+
*/
|
|
148
|
+
StylesPart.prototype.markStylesDirty = function () {
|
|
149
|
+
this.dirty = true;
|
|
150
|
+
// Keep projectedById so DocxStyle identity stays stable across ensure of other styles.
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Drop a stable DocxStyle projection after the live style is removed.
|
|
154
|
+
*
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
StylesPart.prototype.forgetProjectedStyle = function (styleId) {
|
|
158
|
+
this.projectedById.delete(styleId);
|
|
159
|
+
this.shellById.delete(styleId);
|
|
160
|
+
this.pendingParagraphStyles.delete(styleId);
|
|
161
|
+
this.pendingCharacterStyles.delete(styleId);
|
|
162
|
+
this.pendingTableStyles.delete(styleId);
|
|
163
|
+
if (this.shellList.length > 0) {
|
|
164
|
+
this.shellList = this.shellList.filter(function (shell) { return shell.styleId !== styleId; });
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Clear body (and header/footer when registered) content references to `styleId`
|
|
169
|
+
* so save-time materialize cannot re-create a minimal stub.
|
|
170
|
+
*
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
173
|
+
StylesPart.prototype.purgeContentStyleReferences = function (document, styleId) {
|
|
174
|
+
purgeStyleReferencesInDocument(document, styleId);
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Bind the live StyleCollection and drain create/load shells into it.
|
|
178
|
+
*
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
StylesPart.prototype.bindLiveCollection = function (collection) {
|
|
182
|
+
if (this.collection === collection) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
this.collection = collection;
|
|
186
|
+
if (this.shellList.length > 0) {
|
|
187
|
+
var shells = this.takeShells();
|
|
188
|
+
collection.replaceFromDocxStyles(shells, false);
|
|
189
|
+
}
|
|
190
|
+
// Pending ids recorded before bind transfer into the live collection.
|
|
191
|
+
var pendingParagraph = Array.from(this.pendingParagraphStyles);
|
|
192
|
+
for (var i = 0; i < pendingParagraph.length; i += 1) {
|
|
193
|
+
collection.registerPendingParagraphStyle(pendingParagraph[i]);
|
|
194
|
+
}
|
|
195
|
+
this.pendingParagraphStyles.clear();
|
|
196
|
+
var pendingCharacter = Array.from(this.pendingCharacterStyles);
|
|
197
|
+
for (var i = 0; i < pendingCharacter.length; i += 1) {
|
|
198
|
+
collection.registerPendingCharacterStyle(pendingCharacter[i]);
|
|
199
|
+
}
|
|
200
|
+
this.pendingCharacterStyles.clear();
|
|
201
|
+
var pendingTable = Array.from(this.pendingTableStyles);
|
|
202
|
+
for (var i = 0; i < pendingTable.length; i += 1) {
|
|
203
|
+
collection.registerPendingTableStyle(pendingTable[i]);
|
|
204
|
+
}
|
|
205
|
+
this.pendingTableStyles.clear();
|
|
206
|
+
this.projectedById.clear();
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Drain unbound DocxStyle shells (load/create path).
|
|
210
|
+
*
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
StylesPart.prototype.takeShells = function () {
|
|
214
|
+
var shells = this.shellList.slice();
|
|
215
|
+
this.shellList = [];
|
|
216
|
+
this.shellById.clear();
|
|
217
|
+
return shells;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Live styles collection when bound.
|
|
221
|
+
*
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
StylesPart.prototype.liveCollection = function () {
|
|
225
|
+
return this.collection;
|
|
226
|
+
};
|
|
227
|
+
Object.defineProperty(StylesPart.prototype, "styles", {
|
|
228
|
+
/**
|
|
229
|
+
* Ordered style definitions as they appear under `w:styles`.
|
|
230
|
+
* Projects live styles to DocxStyle shells when the collection is bound.
|
|
231
|
+
*
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
234
|
+
get: function () {
|
|
235
|
+
if (this.collection !== undefined) {
|
|
236
|
+
var liveStyles = this.collection.stylesInOrder();
|
|
237
|
+
var out = [];
|
|
238
|
+
for (var i = 0; i < liveStyles.length; i += 1) {
|
|
239
|
+
var live = liveStyles[i];
|
|
240
|
+
var styleId = live.styleId;
|
|
241
|
+
var shell = this.projectedById.get(styleId);
|
|
242
|
+
if (shell === undefined) {
|
|
243
|
+
shell = this.collection.projectDocxStyle(styleId);
|
|
244
|
+
if (shell !== undefined) {
|
|
245
|
+
this.projectedById.set(styleId, shell);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (shell !== undefined) {
|
|
249
|
+
out.push(shell);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return out;
|
|
253
|
+
}
|
|
254
|
+
return this.shellList;
|
|
255
|
+
},
|
|
256
|
+
enumerable: true,
|
|
257
|
+
configurable: true
|
|
258
|
+
});
|
|
259
|
+
Object.defineProperty(StylesPart.prototype, "docDefaults", {
|
|
260
|
+
/**
|
|
261
|
+
* WordDocument defaults (`w:docDefaults`), when present.
|
|
262
|
+
*
|
|
263
|
+
* @public
|
|
264
|
+
*/
|
|
265
|
+
get: function () {
|
|
266
|
+
return this.docDefaultsValue;
|
|
267
|
+
},
|
|
268
|
+
enumerable: true,
|
|
269
|
+
configurable: true
|
|
270
|
+
});
|
|
271
|
+
Object.defineProperty(StylesPart.prototype, "latentStyles", {
|
|
272
|
+
/**
|
|
273
|
+
* Latent styles (`w:latentStyles`), when present.
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
get: function () {
|
|
278
|
+
return this.latentStylesValue;
|
|
279
|
+
},
|
|
280
|
+
enumerable: true,
|
|
281
|
+
configurable: true
|
|
282
|
+
});
|
|
283
|
+
/**
|
|
284
|
+
* Look up a style by `w:styleId` (DocxStyle projection; stable while clean).
|
|
285
|
+
*
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
StylesPart.prototype.getStyle = function (styleId) {
|
|
289
|
+
if (this.collection !== undefined) {
|
|
290
|
+
var cached = this.projectedById.get(styleId);
|
|
291
|
+
if (cached !== undefined) {
|
|
292
|
+
return cached;
|
|
293
|
+
}
|
|
294
|
+
var projected = this.collection.projectDocxStyle(styleId);
|
|
295
|
+
if (projected !== undefined) {
|
|
296
|
+
this.projectedById.set(styleId, projected);
|
|
297
|
+
}
|
|
298
|
+
return projected;
|
|
299
|
+
}
|
|
300
|
+
return this.shellById.get(styleId);
|
|
301
|
+
};
|
|
302
|
+
/** Whether a style id exists in the catalog (including pending ensure). */
|
|
303
|
+
StylesPart.prototype.hasStyle = function (styleId) {
|
|
304
|
+
if (this.collection !== undefined) {
|
|
305
|
+
return this.collection.hasStyle(styleId);
|
|
306
|
+
}
|
|
307
|
+
return (this.shellById.has(styleId) ||
|
|
308
|
+
this.pendingParagraphStyles.has(styleId) ||
|
|
309
|
+
this.pendingCharacterStyles.has(styleId) ||
|
|
310
|
+
this.pendingTableStyles.has(styleId));
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Modeled run properties from `w:docDefaults/w:rPrDefault/w:rPr`.
|
|
314
|
+
*
|
|
315
|
+
* @public
|
|
316
|
+
*/
|
|
317
|
+
StylesPart.prototype.docDefaultsRunProperties = function () {
|
|
318
|
+
var defaults = this.docDefaultsValue;
|
|
319
|
+
if (defaults === undefined) {
|
|
320
|
+
return EMPTY_MODELED_RUN_PROPERTIES;
|
|
321
|
+
}
|
|
322
|
+
return defaults.runProperties();
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Modeled paragraph properties from `w:docDefaults/w:pPrDefault/w:pPr`.
|
|
326
|
+
*
|
|
327
|
+
* Spacing uses branded point `number` (twips). Absent markup is not filled
|
|
328
|
+
* with create-path defaults on load.
|
|
329
|
+
*
|
|
330
|
+
* @public
|
|
331
|
+
*/
|
|
332
|
+
StylesPart.prototype.docDefaultsParagraphProperties = function () {
|
|
333
|
+
var defaults = this.docDefaultsValue;
|
|
334
|
+
if (defaults === undefined) {
|
|
335
|
+
return EMPTY_MODELED_PARAGRAPH_PROPERTIES;
|
|
336
|
+
}
|
|
337
|
+
return defaults.paragraphProperties();
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Modeled `w:rPr` on a style definition, or `undefined` when the style is absent.
|
|
341
|
+
*
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
StylesPart.prototype.styleRunProperties = function (styleId) {
|
|
345
|
+
if (this.collection !== undefined) {
|
|
346
|
+
var live = this.collection.getStyle(styleId);
|
|
347
|
+
if (live === undefined) {
|
|
348
|
+
return undefined;
|
|
349
|
+
}
|
|
350
|
+
return characterSnapshotToModeledRunProperties(live.characterFormatSnapshot());
|
|
351
|
+
}
|
|
352
|
+
var style = this.shellById.get(styleId);
|
|
353
|
+
if (style === undefined) {
|
|
354
|
+
return undefined;
|
|
355
|
+
}
|
|
356
|
+
return style.runProperties();
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* `w:basedOn/@w:val` for a style id, or `undefined` when absent or unknown.
|
|
360
|
+
*
|
|
361
|
+
* @public
|
|
362
|
+
*/
|
|
363
|
+
StylesPart.prototype.styleBasedOn = function (styleId) {
|
|
364
|
+
if (this.collection !== undefined) {
|
|
365
|
+
var live = this.collection.getStyle(styleId);
|
|
366
|
+
if (live === undefined) {
|
|
367
|
+
return undefined;
|
|
368
|
+
}
|
|
369
|
+
return live.basedOnId;
|
|
370
|
+
}
|
|
371
|
+
var __ts33_2;
|
|
372
|
+
return ((__ts33_2 = this.shellById.get(styleId)), __ts33_2 == null ? undefined : __ts33_2.basedOn);
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Ensure a paragraph style exists, creating a minimal `CT_Style` when absent.
|
|
376
|
+
*/
|
|
377
|
+
StylesPart.prototype.ensureParagraphStyle = function (styleId) {
|
|
378
|
+
if (this.collection !== undefined) {
|
|
379
|
+
this.collection.ensureParagraphStyle(styleId);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this.ensureStyle(styleId, 'paragraph');
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Ensure a character style exists, creating a minimal `CT_Style` when absent.
|
|
386
|
+
*/
|
|
387
|
+
StylesPart.prototype.ensureCharacterStyle = function (styleId) {
|
|
388
|
+
if (this.collection !== undefined) {
|
|
389
|
+
this.collection.ensureCharacterStyle(styleId);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
this.ensureStyle(styleId, 'character');
|
|
393
|
+
};
|
|
394
|
+
/**Ensure a table style exists, creating a minimal `CT_Style` when absent.
|
|
395
|
+
*/
|
|
396
|
+
StylesPart.prototype.ensureTableStyle = function (styleId) {
|
|
397
|
+
if (this.collection !== undefined) {
|
|
398
|
+
this.collection.ensureTableStyle(styleId);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
this.ensureStyle(styleId, 'table');
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* @private
|
|
405
|
+
* Record a paragraph style reference before save. */
|
|
406
|
+
StylesPart.prototype.registerPendingParagraphStyle = function (styleId) {
|
|
407
|
+
if (this.collection !== undefined) {
|
|
408
|
+
this.collection.registerPendingParagraphStyle(styleId);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (this.shellById.has(styleId)) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
this.pendingParagraphStyles.add(styleId);
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* @private
|
|
418
|
+
* Record a character style reference before save. */
|
|
419
|
+
StylesPart.prototype.registerPendingCharacterStyle = function (styleId) {
|
|
420
|
+
if (this.collection !== undefined) {
|
|
421
|
+
this.collection.registerPendingCharacterStyle(styleId);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (this.shellById.has(styleId)) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
this.pendingCharacterStyles.add(styleId);
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* @private
|
|
431
|
+
* Record a table style reference before save. */
|
|
432
|
+
StylesPart.prototype.registerPendingTableStyle = function (styleId) {
|
|
433
|
+
if (this.collection !== undefined) {
|
|
434
|
+
this.collection.registerPendingTableStyle(styleId);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (this.shellById.has(styleId)) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
this.pendingTableStyles.add(styleId);
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* @private
|
|
444
|
+
*/
|
|
445
|
+
StylesPart.prototype.materializePending = function (document) {
|
|
446
|
+
var _this = this;
|
|
447
|
+
// Ensure live collection is bound before materialize so ensure/canonicalize
|
|
448
|
+
// go through the single Styles DOM.
|
|
449
|
+
styleCollectionFor(document);
|
|
450
|
+
var collection = this.collection;
|
|
451
|
+
if (collection !== undefined) {
|
|
452
|
+
visitParagraphsInDocumentOrder(document, function (paragraph) {
|
|
453
|
+
var e_2, _a;
|
|
454
|
+
var paragraphStyleId = paragraph.styleId;
|
|
455
|
+
// Empty style id is invalid OOXML; skip rather than fail save.
|
|
456
|
+
if (paragraphStyleId !== undefined && paragraphStyleId.length > 0 && !collection.hasStyle(paragraphStyleId)) {
|
|
457
|
+
collection.ensureParagraphStyle(paragraphStyleId);
|
|
458
|
+
var resolved = collection.getStyle(paragraphStyleId);
|
|
459
|
+
if (resolved !== undefined && resolved.styleId !== paragraphStyleId) {
|
|
460
|
+
paragraph.styleId = resolved.styleId;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
try {
|
|
464
|
+
for (var _b = __values(paragraph.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
465
|
+
var inline = _c.value;
|
|
466
|
+
if (!(inline instanceof TextRange)) {
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
var runStyleId = inline.characterFormat.characterStyle;
|
|
470
|
+
if (runStyleId !== undefined && runStyleId.length > 0 && !collection.hasStyle(runStyleId)) {
|
|
471
|
+
collection.ensureCharacterStyle(runStyleId);
|
|
472
|
+
var resolved = collection.getStyle(runStyleId);
|
|
473
|
+
if (resolved !== undefined && resolved.styleId !== runStyleId) {
|
|
474
|
+
inline.characterFormat.characterStyle = resolved.styleId;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
480
|
+
finally {
|
|
481
|
+
try {
|
|
482
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
483
|
+
}
|
|
484
|
+
finally { if (e_2) throw e_2.error; }
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
visitTablesInDocumentOrder(document, function (table) {
|
|
488
|
+
var tableStyleId = table.styleId;
|
|
489
|
+
if (tableStyleId !== undefined && tableStyleId.length > 0 && !collection.hasStyle(tableStyleId)) {
|
|
490
|
+
collection.ensureTableStyle(tableStyleId);
|
|
491
|
+
var resolved = collection.getStyle(tableStyleId);
|
|
492
|
+
if (resolved !== undefined && resolved.styleId !== tableStyleId) {
|
|
493
|
+
table.styleId = resolved.styleId;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
collection.materializePendingIds(function (fromId, toId) {
|
|
498
|
+
visitParagraphsInDocumentOrder(document, function (paragraph) {
|
|
499
|
+
if (paragraph.styleId === fromId) {
|
|
500
|
+
paragraph.styleId = toId;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}, function (fromId, toId) {
|
|
504
|
+
visitParagraphsInDocumentOrder(document, function (paragraph) {
|
|
505
|
+
var e_3, _a;
|
|
506
|
+
try {
|
|
507
|
+
for (var _b = __values(paragraph.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
508
|
+
var inline = _c.value;
|
|
509
|
+
if (!(inline instanceof TextRange)) {
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (inline.characterFormat.characterStyle === fromId) {
|
|
513
|
+
inline.characterFormat.characterStyle = toId;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
518
|
+
finally {
|
|
519
|
+
try {
|
|
520
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
521
|
+
}
|
|
522
|
+
finally { if (e_3) throw e_3.error; }
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}, function (fromId, toId) {
|
|
526
|
+
visitTablesInDocumentOrder(document, function (table) {
|
|
527
|
+
if (table.styleId === fromId) {
|
|
528
|
+
table.styleId = toId;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
visitParagraphsInDocumentOrder(document, function (paragraph) {
|
|
535
|
+
var e_4, _a;
|
|
536
|
+
var paragraphStyleId = paragraph.styleId;
|
|
537
|
+
if (paragraphStyleId !== undefined && !_this.shellById.has(paragraphStyleId)) {
|
|
538
|
+
_this.ensureStyle(paragraphStyleId, 'paragraph');
|
|
539
|
+
_this.pendingParagraphStyles.delete(paragraphStyleId);
|
|
540
|
+
var resolved = _this.shellById.get(paragraphStyleId);
|
|
541
|
+
if (resolved !== undefined && resolved.styleId !== paragraphStyleId) {
|
|
542
|
+
paragraph.styleId = resolved.styleId;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
for (var _b = __values(paragraph.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
547
|
+
var inline = _c.value;
|
|
548
|
+
if (!(inline instanceof TextRange)) {
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
var runStyleId = inline.characterFormat.characterStyle;
|
|
552
|
+
if (runStyleId !== undefined && !_this.shellById.has(runStyleId)) {
|
|
553
|
+
_this.ensureStyle(runStyleId, 'character');
|
|
554
|
+
_this.pendingCharacterStyles.delete(runStyleId);
|
|
555
|
+
var resolved = _this.shellById.get(runStyleId);
|
|
556
|
+
if (resolved !== undefined && resolved.styleId !== runStyleId) {
|
|
557
|
+
inline.characterFormat.characterStyle = resolved.styleId;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
563
|
+
finally {
|
|
564
|
+
try {
|
|
565
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
566
|
+
}
|
|
567
|
+
finally { if (e_4) throw e_4.error; }
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
visitTablesInDocumentOrder(document, function (table) {
|
|
571
|
+
var tableStyleId = table.styleId;
|
|
572
|
+
if (tableStyleId !== undefined && !_this.shellById.has(tableStyleId)) {
|
|
573
|
+
_this.ensureStyle(tableStyleId, 'table');
|
|
574
|
+
_this.pendingTableStyles.delete(tableStyleId);
|
|
575
|
+
var resolved = _this.shellById.get(tableStyleId);
|
|
576
|
+
if (resolved !== undefined && resolved.styleId !== tableStyleId) {
|
|
577
|
+
table.styleId = resolved.styleId;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
this.pendingParagraphStyles.clear();
|
|
582
|
+
this.pendingCharacterStyles.clear();
|
|
583
|
+
this.pendingTableStyles.clear();
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* @private
|
|
587
|
+
*/
|
|
588
|
+
StylesPart.prototype.isDirty = function () {
|
|
589
|
+
return this.dirty;
|
|
590
|
+
};
|
|
591
|
+
/**
|
|
592
|
+
* @private
|
|
593
|
+
*/
|
|
594
|
+
StylesPart.prototype.serialize = function () {
|
|
595
|
+
var e_5, _a;
|
|
596
|
+
var children = [];
|
|
597
|
+
if (this.docDefaultsValue !== undefined) {
|
|
598
|
+
children.push(this.docDefaultsValue.serialize());
|
|
599
|
+
}
|
|
600
|
+
if (this.latentStylesValue !== undefined) {
|
|
601
|
+
children.push(this.latentStylesValue.serialize());
|
|
602
|
+
}
|
|
603
|
+
children.push.apply(children, __spread(this.rootExtrasBeforeStyles));
|
|
604
|
+
if (this.collection !== undefined) {
|
|
605
|
+
var liveStyles = this.collection.stylesInOrder();
|
|
606
|
+
for (var i = 0; i < liveStyles.length; i += 1) {
|
|
607
|
+
children.push(liveStyles[i].serialize());
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
try {
|
|
612
|
+
for (var _b = __values(this.shellList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
613
|
+
var style = _c.value;
|
|
614
|
+
children.push(style.serialize());
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
618
|
+
finally {
|
|
619
|
+
try {
|
|
620
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
621
|
+
}
|
|
622
|
+
finally { if (e_5) throw e_5.error; }
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
children.push.apply(children, __spread(this.rootExtrasAfterStyles));
|
|
626
|
+
var root = wmlElement('styles', {
|
|
627
|
+
namespaceDeclarations: [{ prefix: 'w', namespaceUri: WML_TRANSITIONAL_NAMESPACE }],
|
|
628
|
+
children: children,
|
|
629
|
+
});
|
|
630
|
+
return utf8.encode(serializeXml(root));
|
|
631
|
+
};
|
|
632
|
+
StylesPart.prototype.ensureStyle = function (styleId, type) {
|
|
633
|
+
if (styleId.length === 0) {
|
|
634
|
+
throw new DocxError('content/invalid-style-id', 'Style id must not be empty');
|
|
635
|
+
}
|
|
636
|
+
if (this.shellById.has(styleId)) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
// Resolver: document-first, catalog-second (complete built-in
|
|
640
|
+
// definition), unknown preserved as a save-time dangling reference
|
|
641
|
+
// (round-trip; never a minimal stub).
|
|
642
|
+
var resolved = resolveReferencedStyle(this, styleId, type);
|
|
643
|
+
if (resolved === undefined) {
|
|
644
|
+
var created = createMinimalDocxStyle(styleId, type);
|
|
645
|
+
this.shellList.push(created);
|
|
646
|
+
this.shellById.set(styleId, created);
|
|
647
|
+
this.markStylesDirty();
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* @private
|
|
652
|
+
* Style-collection surface for the built-in resolver. */
|
|
653
|
+
StylesPart.prototype.findStyleByDisplayName = function (name) {
|
|
654
|
+
if (this.collection !== undefined) {
|
|
655
|
+
var live = this.collection.findByName(name);
|
|
656
|
+
if (live === undefined) {
|
|
657
|
+
return undefined;
|
|
658
|
+
}
|
|
659
|
+
var cached = this.projectedById.get(live.styleId);
|
|
660
|
+
if (cached !== undefined) {
|
|
661
|
+
return cached;
|
|
662
|
+
}
|
|
663
|
+
var projected = this.collection.projectDocxStyle(live.styleId);
|
|
664
|
+
if (projected !== undefined) {
|
|
665
|
+
this.projectedById.set(live.styleId, projected);
|
|
666
|
+
}
|
|
667
|
+
return projected;
|
|
668
|
+
}
|
|
669
|
+
var normalized = normalizeStyleName(name);
|
|
670
|
+
if (normalized.length === 0) {
|
|
671
|
+
return undefined;
|
|
672
|
+
}
|
|
673
|
+
return this.shellList.find(function (style) {
|
|
674
|
+
var styleName = style.name;
|
|
675
|
+
return styleName !== undefined && normalizeStyleName(styleName) === normalized;
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* @private
|
|
680
|
+
* Style-collection surface for the built-in resolver. */
|
|
681
|
+
StylesPart.prototype.addStyle = function (style) {
|
|
682
|
+
if (this.collection !== undefined) {
|
|
683
|
+
if (this.collection.getStyle(style.styleId) !== undefined) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
// Live collection accepts Style; hydrate shell via replace path entry.
|
|
687
|
+
this.collection.hydrateFromDocxStyles([style], true);
|
|
688
|
+
this.projectedById.delete(style.styleId);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (this.shellById.has(style.styleId)) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
this.shellList.push(style);
|
|
695
|
+
this.shellById.set(style.styleId, style);
|
|
696
|
+
this.markStylesDirty();
|
|
697
|
+
};
|
|
698
|
+
return StylesPart;
|
|
699
|
+
}());
|
|
700
|
+
export { StylesPart };
|
|
701
|
+
var styleCollections = new WeakMap();
|
|
702
|
+
/**
|
|
703
|
+
* Bind or reuse the document-owned live StyleCollection on a styles part.
|
|
704
|
+
*
|
|
705
|
+
* @private
|
|
706
|
+
*/
|
|
707
|
+
function ensureLiveStyleCollection(document, part) {
|
|
708
|
+
var bound = part.liveCollection();
|
|
709
|
+
if (bound !== undefined) {
|
|
710
|
+
styleCollections.set(document, bound);
|
|
711
|
+
return bound;
|
|
712
|
+
}
|
|
713
|
+
var collection = styleCollections.get(document);
|
|
714
|
+
if (collection === undefined) {
|
|
715
|
+
collection = new StyleCollection(document, part);
|
|
716
|
+
styleCollections.set(document, collection);
|
|
717
|
+
}
|
|
718
|
+
part.bindLiveCollection(collection);
|
|
719
|
+
return collection;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Document-owned live StyleCollection. Stable identity per document.
|
|
723
|
+
*
|
|
724
|
+
* @public
|
|
725
|
+
*/
|
|
726
|
+
export function styleCollectionFor(document) {
|
|
727
|
+
registerStylesFeature();
|
|
728
|
+
return ensureLiveStyleCollection(document, stylesPartFor(document));
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Raw styles package part (no bind). Used by styleCollectionFor to avoid recursion.
|
|
732
|
+
*
|
|
733
|
+
* @private
|
|
734
|
+
*/
|
|
735
|
+
function stylesPartFor(document) {
|
|
736
|
+
var part = document.featurePart(STYLES);
|
|
737
|
+
if (part === undefined || !(part instanceof StylesPart)) {
|
|
738
|
+
throw new DocxError('feature/not-registered', 'Styles part was not loaded; call registerStylesFeature() before WordDocument.open');
|
|
739
|
+
}
|
|
740
|
+
return part;
|
|
741
|
+
}
|
|
742
|
+
function parseStylesRoot(root) {
|
|
743
|
+
var e_6, _a;
|
|
744
|
+
var docDefaults;
|
|
745
|
+
var latentStyles;
|
|
746
|
+
var styles = [];
|
|
747
|
+
var rootExtrasBeforeStyles = [];
|
|
748
|
+
var rootExtrasAfterStyles = [];
|
|
749
|
+
var sawStyle = false;
|
|
750
|
+
try {
|
|
751
|
+
for (var _b = __values(elementChildren(root)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
752
|
+
var child = _c.value;
|
|
753
|
+
if (isWml(child, 'docDefaults') && docDefaults === undefined) {
|
|
754
|
+
docDefaults = parseDocDefaults(child);
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
if (isWml(child, 'latentStyles') && latentStyles === undefined) {
|
|
758
|
+
latentStyles = parseLatentStyles(child);
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
if (isWml(child, 'style')) {
|
|
762
|
+
sawStyle = true;
|
|
763
|
+
var style = parseDocxStyle(child);
|
|
764
|
+
if (style !== undefined) {
|
|
765
|
+
styles.push(style);
|
|
766
|
+
}
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
if (sawStyle) {
|
|
770
|
+
rootExtrasAfterStyles.push(child);
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
rootExtrasBeforeStyles.push(child);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
778
|
+
finally {
|
|
779
|
+
try {
|
|
780
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
781
|
+
}
|
|
782
|
+
finally { if (e_6) throw e_6.error; }
|
|
783
|
+
}
|
|
784
|
+
return { docDefaults: docDefaults, latentStyles: latentStyles, styles: styles, rootExtrasBeforeStyles: rootExtrasBeforeStyles, rootExtrasAfterStyles: rootExtrasAfterStyles };
|
|
785
|
+
}
|
|
786
|
+
function loadStylesPart(part) {
|
|
787
|
+
if (part === undefined) {
|
|
788
|
+
var _a = buildDefaultStylesArgs(), docDefaults = _a.docDefaults, styles = _a.styles;
|
|
789
|
+
return new StylesPart(docDefaults, undefined, styles, [], [], true);
|
|
790
|
+
}
|
|
791
|
+
var root = parseXml(utf8Decoder.decode(part.data));
|
|
792
|
+
if (!isWml(root, 'styles')) {
|
|
793
|
+
return new StylesPart(undefined, undefined, [], [], [], false);
|
|
794
|
+
}
|
|
795
|
+
var parsed = parseStylesRoot(root);
|
|
796
|
+
return new StylesPart(parsed.docDefaults, parsed.latentStyles, parsed.styles, parsed.rootExtrasBeforeStyles, parsed.rootExtrasAfterStyles, false);
|
|
797
|
+
}
|
|
798
|
+
var registered = false;
|
|
799
|
+
/**
|
|
800
|
+
* @private
|
|
801
|
+
* Test hook */
|
|
802
|
+
export function resetStylesFeatureForTests() {
|
|
803
|
+
registered = false;
|
|
804
|
+
resetThemeFeatureForTests();
|
|
805
|
+
resetFontTableFeatureForTests();
|
|
806
|
+
resetStylesWithEffectsFeatureForTests();
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* @private
|
|
810
|
+
* Register the styles, theme, and font table package-part handlers. Idempotent. */
|
|
811
|
+
export function registerStylesFeature() {
|
|
812
|
+
if (registered) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
registered = true;
|
|
816
|
+
registerThemeFeature();
|
|
817
|
+
registerFontTableFeature();
|
|
818
|
+
registerStylesWithEffectsFeature();
|
|
819
|
+
registerFeature({ id: STYLES });
|
|
820
|
+
registerFeaturePartHandler({
|
|
821
|
+
featureId: STYLES,
|
|
822
|
+
relationshipTypes: [STYLES_RELATIONSHIP_TYPE, STRICT_STYLES_RELATIONSHIP_TYPE],
|
|
823
|
+
defaultRelativeTarget: 'styles.xml',
|
|
824
|
+
partName: STYLES_PART_NAME,
|
|
825
|
+
contentType: STYLES_CONTENT_TYPE,
|
|
826
|
+
loadPart: function (part, ctx) {
|
|
827
|
+
void ctx;
|
|
828
|
+
return loadStylesPart(part);
|
|
829
|
+
},
|
|
830
|
+
});
|
|
831
|
+
registerFeatureMaterializeHandler({
|
|
832
|
+
featureId: STYLES,
|
|
833
|
+
materialize: function (document) {
|
|
834
|
+
var part = document.featurePart(STYLES);
|
|
835
|
+
if (part instanceof StylesPart) {
|
|
836
|
+
part.materializePending(document);
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Styles catalog for a document. Requires {@link registerStylesFeature}.
|
|
843
|
+
*
|
|
844
|
+
* @throws DocxError `UNKNOWN_FEATURE` when the styles module was not registered before load.
|
|
845
|
+
* @private
|
|
846
|
+
*/
|
|
847
|
+
export function stylesFor(document) {
|
|
848
|
+
var part = stylesPartFor(document);
|
|
849
|
+
ensureLiveStyleCollection(document, part);
|
|
850
|
+
return part;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Assign a run character style id and ensure a matching style definition exists.
|
|
854
|
+
*
|
|
855
|
+
* Unknown styles throw `styles/undefined-style` (spec §5.2).
|
|
856
|
+
*
|
|
857
|
+
* @private
|
|
858
|
+
*/
|
|
859
|
+
export function assignRunStyle(document, run, styleId) {
|
|
860
|
+
var styles = stylesFor(document);
|
|
861
|
+
var resolved = resolveStyleForTarget(styles, styleId, 'character');
|
|
862
|
+
run.characterFormat.characterStyle = resolved.styleId;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Resolve effective bold, italic, font size, and font names for a run in a paragraph.
|
|
866
|
+
*
|
|
867
|
+
* Requires {@link registerStylesFeature} before {@link WordDocument.open}.
|
|
868
|
+
*
|
|
869
|
+
* @private
|
|
870
|
+
*/
|
|
871
|
+
export function resolveRunFormatting(document, paragraph, run) {
|
|
872
|
+
// Package-absent Theme is materialized as a dirty default for save emit only
|
|
873
|
+
// (theme.ts). Font-slot resolution requires a package-backed Theme part; dirty
|
|
874
|
+
// defaults leave asciiTheme/hAnsiTheme slots unresolved (formatting-resolver-theme AC).
|
|
875
|
+
var theme = themeFor(document);
|
|
876
|
+
return resolveRunFormattingWithStyles(stylesFor(document), paragraph, run, theme.isDirty() ? undefined : theme);
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Apply a built-in or custom style by style id or display name.
|
|
880
|
+
*
|
|
881
|
+
* - Paragraph styles write `w:pPr/w:pStyle` via {@link Paragraph.styleId}
|
|
882
|
+
* only — format properties are not copied onto the paragraph.
|
|
883
|
+
* - Character styles (built-in or custom) update DOM state only:
|
|
884
|
+
* {@link Paragraph.breakCharacterFormat}.characterStyle and each existing
|
|
885
|
+
* {@link TextRange}.characterFormat.characterStyle. Serialization reflects
|
|
886
|
+
* that DOM (`w:pPr/w:rPr/w:rStyle` and run `w:rPr/w:rStyle`). Does **not**
|
|
887
|
+
* set {@link Paragraph.styleId}.
|
|
888
|
+
*
|
|
889
|
+
* Type validation remains in {@link resolveStyleForTarget}.
|
|
890
|
+
*
|
|
891
|
+
* @param style Style id string or {@link BuiltInStyle} constant.
|
|
892
|
+
* @public
|
|
893
|
+
*/
|
|
894
|
+
Paragraph.prototype.applyStyle = function applyStyle(style) {
|
|
895
|
+
var e_7, _a;
|
|
896
|
+
var requested = typeof style === 'string' ? style : style;
|
|
897
|
+
var styles = stylesFor(this.owningDocument());
|
|
898
|
+
var target = resolveApplyStyleTarget(styles, requested);
|
|
899
|
+
var resolved = resolveStyleForTarget(styles, requested, target);
|
|
900
|
+
if (target === 'character') {
|
|
901
|
+
var styleId = resolved.styleId;
|
|
902
|
+
this.breakCharacterFormat.characterStyle = styleId;
|
|
903
|
+
try {
|
|
904
|
+
for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
905
|
+
var inline = _c.value;
|
|
906
|
+
if (inline instanceof TextRange) {
|
|
907
|
+
inline.characterFormat.characterStyle = styleId;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
912
|
+
finally {
|
|
913
|
+
try {
|
|
914
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
915
|
+
}
|
|
916
|
+
finally { if (e_7) throw e_7.error; }
|
|
917
|
+
}
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
this.styleId = resolved.styleId;
|
|
921
|
+
};
|
|
922
|
+
/**
|
|
923
|
+
* Decide whether {@link Paragraph.applyStyle} should resolve as paragraph or
|
|
924
|
+
* character. Prefers an existing document style (by id, then display name);
|
|
925
|
+
* otherwise uses the built-in catalog type. Defaults to paragraph so unknown
|
|
926
|
+
* and table-typed names keep prior invalid-type / undefined-style behavior.
|
|
927
|
+
*
|
|
928
|
+
* @private
|
|
929
|
+
*/
|
|
930
|
+
function resolveApplyStyleTarget(styles, nameOrId) {
|
|
931
|
+
var byId = styles.getStyle(nameOrId);
|
|
932
|
+
var existing = byId !== undefined ? byId : styles.findStyleByDisplayName(nameOrId);
|
|
933
|
+
if (existing !== undefined) {
|
|
934
|
+
return existing.type === 'character' ? 'character' : 'paragraph';
|
|
935
|
+
}
|
|
936
|
+
var byName = getBuiltinStyleTemplate(nameOrId);
|
|
937
|
+
var template = byName !== undefined ? byName : getBuiltinStyleTemplateByDisplayName(nameOrId);
|
|
938
|
+
if (template !== undefined && template.type === 'character') {
|
|
939
|
+
return 'character';
|
|
940
|
+
}
|
|
941
|
+
return 'paragraph';
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Read a direct (non-effective) character-format slot from a Style facade without
|
|
945
|
+
* triggering paragraph effective resolution.
|
|
946
|
+
* @private
|
|
947
|
+
*/
|
|
948
|
+
function directCharacterSlot(format, key) {
|
|
949
|
+
if (format === undefined) {
|
|
950
|
+
return undefined;
|
|
951
|
+
}
|
|
952
|
+
// Access private *Value fields via snapshot for reliable authored detection.
|
|
953
|
+
// Prefer public getters: Style-hosted CF has no resolveEffective* so getters are direct.
|
|
954
|
+
switch (key) {
|
|
955
|
+
case 'bold': return format.bold;
|
|
956
|
+
case 'italic': return format.italic;
|
|
957
|
+
case 'strikethrough': return format.strikethrough;
|
|
958
|
+
case 'doubleStrikethrough': return format.doubleStrikethrough;
|
|
959
|
+
case 'allCaps': return format.allCaps;
|
|
960
|
+
case 'smallCaps': return format.smallCaps;
|
|
961
|
+
case 'hidden': return format.hidden;
|
|
962
|
+
case 'emboss': return format.emboss;
|
|
963
|
+
case 'engrave': return format.engrave;
|
|
964
|
+
case 'outline': return format.outline;
|
|
965
|
+
case 'shadow': return format.shadow;
|
|
966
|
+
case 'noProof': return format.noProof;
|
|
967
|
+
case 'webHidden': return format.webHidden;
|
|
968
|
+
case 'fontSize': return format.fontSize;
|
|
969
|
+
case 'fontName': return format.fontName;
|
|
970
|
+
case 'fontNameAscii': return format.fontNameAscii;
|
|
971
|
+
case 'fontNameNonFarEast': return format.fontNameNonFarEast;
|
|
972
|
+
case 'fontNameFarEast': return format.fontNameFarEast;
|
|
973
|
+
case 'fontNameBidi': return format.fontNameBidi;
|
|
974
|
+
case 'underlineStyle': return format.underlineStyle;
|
|
975
|
+
case 'underlineColor': return format.underlineColor;
|
|
976
|
+
case 'textColor': return format.textColor;
|
|
977
|
+
case 'highlightColor': return format.highlightColor;
|
|
978
|
+
case 'textBackgroundColor': return format.textBackgroundColor;
|
|
979
|
+
case 'subSuperScript': return format.subSuperScript;
|
|
980
|
+
case 'characterSpacing': return format.characterSpacing;
|
|
981
|
+
case 'position': return format.position;
|
|
982
|
+
case 'kerning': return format.kerning;
|
|
983
|
+
case 'scaling': return format.scaling;
|
|
984
|
+
case 'boldBidi': return format.boldBidi;
|
|
985
|
+
case 'italicBidi': return format.italicBidi;
|
|
986
|
+
case 'fontSizeBidi': return format.fontSizeBidi;
|
|
987
|
+
case 'localeId': return format.localeId;
|
|
988
|
+
case 'localeIdBidi': return format.localeIdBidi;
|
|
989
|
+
case 'localeIdFarEast': return format.localeIdFarEast;
|
|
990
|
+
default: return undefined;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
function directParagraphSlot(format, key) {
|
|
994
|
+
if (format === undefined) {
|
|
995
|
+
return undefined;
|
|
996
|
+
}
|
|
997
|
+
switch (key) {
|
|
998
|
+
case 'horizontalAlignment': return format.horizontalAlignment;
|
|
999
|
+
case 'keepFollow': return format.keepFollow;
|
|
1000
|
+
case 'keepLines': return format.keepLines;
|
|
1001
|
+
case 'pageBreakBefore': return format.pageBreakBefore;
|
|
1002
|
+
case 'pageBreakAfter': return format.pageBreakAfter;
|
|
1003
|
+
case 'widowControl': return format.widowControl;
|
|
1004
|
+
case 'bidi': return format.bidi;
|
|
1005
|
+
case 'outlineLevel': return format.outlineLevel;
|
|
1006
|
+
case 'leftIndent': return format.leftIndent;
|
|
1007
|
+
case 'rightIndent': return format.rightIndent;
|
|
1008
|
+
case 'firstLineIndent': return format.firstLineIndent;
|
|
1009
|
+
case 'beforeSpacing': return format.beforeSpacing;
|
|
1010
|
+
case 'afterSpacing': return format.afterSpacing;
|
|
1011
|
+
case 'beforeAutospacing': return format.beforeAutospacing;
|
|
1012
|
+
case 'afterAutospacing': return format.afterAutospacing;
|
|
1013
|
+
case 'beforeLines': return format.beforeLines;
|
|
1014
|
+
case 'afterLines': return format.afterLines;
|
|
1015
|
+
case 'lineSpacing': return format.lineSpacing;
|
|
1016
|
+
case 'lineSpacingRule': return format.lineSpacingRule;
|
|
1017
|
+
case 'lineSpacingCount': return format.lineSpacingCount;
|
|
1018
|
+
case 'tabStops': return format.tabStops;
|
|
1019
|
+
case 'borders': {
|
|
1020
|
+
var pf = format;
|
|
1021
|
+
if (typeof pf.readBordersBag === 'function') {
|
|
1022
|
+
return pf.readBordersBag();
|
|
1023
|
+
}
|
|
1024
|
+
return pf.borders;
|
|
1025
|
+
}
|
|
1026
|
+
case 'backColor': return format.backColor;
|
|
1027
|
+
case 'foreColor': return format.foreColor;
|
|
1028
|
+
case 'contextualSpacing': return format.contextualSpacing;
|
|
1029
|
+
case 'mirrorIndents': return format.mirrorIndents;
|
|
1030
|
+
default: return undefined;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function modeledRunSlot(props, key) {
|
|
1034
|
+
switch (key) {
|
|
1035
|
+
case 'bold': return props.bold;
|
|
1036
|
+
case 'boldBidi': return props.boldCs;
|
|
1037
|
+
case 'italic': return props.italic;
|
|
1038
|
+
case 'italicBidi': return props.italicCs;
|
|
1039
|
+
case 'fontSize': return props.fontSize;
|
|
1040
|
+
case 'fontSizeBidi': return props.fontSizeCs;
|
|
1041
|
+
case 'kerning': return props.kerning;
|
|
1042
|
+
case 'fontName': return props.asciiFont !== undefined ? props.asciiFont : props.hAnsiFont;
|
|
1043
|
+
case 'fontNameAscii': return props.asciiFont;
|
|
1044
|
+
case 'fontNameNonFarEast': return props.hAnsiFont;
|
|
1045
|
+
case 'fontNameFarEast': return props.eastAsiaFont;
|
|
1046
|
+
case 'fontNameBidi': return props.csFont;
|
|
1047
|
+
case 'textColor': return props.color; // wire hex; CF getter maps Color — leave for CF path only when Color
|
|
1048
|
+
default: return undefined;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function modeledParagraphSlot(props, key) {
|
|
1052
|
+
var spacing = props.spacing;
|
|
1053
|
+
var indentation = props.indentation;
|
|
1054
|
+
switch (key) {
|
|
1055
|
+
case 'keepFollow': return props.keepNext;
|
|
1056
|
+
case 'keepLines': return props.keepLines;
|
|
1057
|
+
case 'pageBreakBefore': return props.pageBreakBefore;
|
|
1058
|
+
case 'widowControl': return props.widowControl;
|
|
1059
|
+
case 'contextualSpacing': return props.contextualSpacing;
|
|
1060
|
+
case 'outlineLevel': return props.outlineLevel;
|
|
1061
|
+
case 'beforeSpacing': return spacing === undefined ? undefined : spacing.before;
|
|
1062
|
+
case 'afterSpacing': return spacing === undefined ? undefined : spacing.after;
|
|
1063
|
+
case 'lineSpacing': return spacing === undefined ? undefined : (spacing.lineSpacing !== undefined ? spacing.lineSpacing : spacing.line);
|
|
1064
|
+
case 'lineSpacingRule': return spacing === undefined ? undefined : spacing.lineRule;
|
|
1065
|
+
case 'leftIndent': return indentation === undefined ? undefined : indentation.left;
|
|
1066
|
+
case 'rightIndent': return indentation === undefined ? undefined : indentation.right;
|
|
1067
|
+
case 'firstLineIndent': {
|
|
1068
|
+
if (indentation === undefined)
|
|
1069
|
+
return undefined;
|
|
1070
|
+
if (indentation.firstLine !== undefined)
|
|
1071
|
+
return indentation.firstLine;
|
|
1072
|
+
if (indentation.hanging !== undefined)
|
|
1073
|
+
return -indentation.hanging;
|
|
1074
|
+
return undefined;
|
|
1075
|
+
}
|
|
1076
|
+
default: return undefined;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
var CF_BOOL_DEFAULT_FALSE = new Set([
|
|
1080
|
+
'bold', 'italic', 'strikethrough', 'doubleStrikethrough', 'allCaps', 'smallCaps',
|
|
1081
|
+
'hidden', 'emboss', 'engrave', 'outline', 'shadow', 'noProof', 'webHidden',
|
|
1082
|
+
'boldBidi', 'italicBidi',
|
|
1083
|
+
]);
|
|
1084
|
+
/**
|
|
1085
|
+
* Effective break-character value for a paragraph (style chain → docDefaults → API default).
|
|
1086
|
+
* @private
|
|
1087
|
+
*/
|
|
1088
|
+
Paragraph.prototype.resolveEffectiveCharacterValue = function resolveEffectiveCharacterValue(key) {
|
|
1089
|
+
try {
|
|
1090
|
+
var document_1 = this.owningDocument();
|
|
1091
|
+
var styles = stylesFor(document_1);
|
|
1092
|
+
var collection = styleCollectionFor(document_1);
|
|
1093
|
+
var seen = new Set();
|
|
1094
|
+
var styleId = this.styleId;
|
|
1095
|
+
while (styleId !== undefined && styleId !== '' && !seen.has(styleId)) {
|
|
1096
|
+
seen.add(styleId);
|
|
1097
|
+
var live = collection.getStyle(styleId);
|
|
1098
|
+
if (live !== undefined) {
|
|
1099
|
+
var slot = directCharacterSlot(live.characterFormat, key);
|
|
1100
|
+
if (slot !== undefined) {
|
|
1101
|
+
return slot;
|
|
1102
|
+
}
|
|
1103
|
+
var base = live.baseStyle;
|
|
1104
|
+
styleId = base === undefined ? undefined : base.styleId;
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
// unresolved id — stop style walk
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
1110
|
+
var docRun = styles.docDefaultsRunProperties();
|
|
1111
|
+
var fromDoc = modeledRunSlot(docRun, key);
|
|
1112
|
+
if (fromDoc !== undefined) {
|
|
1113
|
+
// textColor from modeled is wire hex string — CharacterFormat expects Color enum on public get.
|
|
1114
|
+
// Only return modeled colors for keys that CF effective path knows how to map; skip textColor wire here.
|
|
1115
|
+
if (key === 'textColor') {
|
|
1116
|
+
// leave to API default path below (Transparent) unless we can map — skip hex
|
|
1117
|
+
}
|
|
1118
|
+
else {
|
|
1119
|
+
return fromDoc;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
catch (_a) {
|
|
1124
|
+
// detached — fall through
|
|
1125
|
+
}
|
|
1126
|
+
// Direct CF getters treat unset as `undefined` (DocIO-style).
|
|
1127
|
+
// Layout/effective consumers apply CHARACTER_FORMAT_DEFAULTS themselves.
|
|
1128
|
+
if (key === 'textColor' || key === 'textBackgroundColor' || key === 'underlineColor' || key === 'highlightColor') {
|
|
1129
|
+
return undefined;
|
|
1130
|
+
}
|
|
1131
|
+
return undefined;
|
|
1132
|
+
};
|
|
1133
|
+
/**
|
|
1134
|
+
* Effective paragraph-format value (style chain → docDefaults → API default).
|
|
1135
|
+
* @private
|
|
1136
|
+
*/
|
|
1137
|
+
Paragraph.prototype.resolveEffectiveParagraphValue = function resolveEffectiveParagraphValue(key) {
|
|
1138
|
+
try {
|
|
1139
|
+
var document_2 = this.owningDocument();
|
|
1140
|
+
var styles = stylesFor(document_2);
|
|
1141
|
+
var collection = styleCollectionFor(document_2);
|
|
1142
|
+
var seen = new Set();
|
|
1143
|
+
var styleId = this.styleId;
|
|
1144
|
+
while (styleId !== undefined && styleId !== '' && !seen.has(styleId)) {
|
|
1145
|
+
seen.add(styleId);
|
|
1146
|
+
var live = collection.getStyle(styleId);
|
|
1147
|
+
if (live !== undefined && live instanceof ParagraphStyle) {
|
|
1148
|
+
var slot = directParagraphSlot(live.paragraphFormat, key);
|
|
1149
|
+
if (slot !== undefined) {
|
|
1150
|
+
return slot;
|
|
1151
|
+
}
|
|
1152
|
+
var base = live.baseParagraphStyle;
|
|
1153
|
+
styleId = base === undefined ? undefined : base.styleId;
|
|
1154
|
+
continue;
|
|
1155
|
+
}
|
|
1156
|
+
if (live !== undefined) {
|
|
1157
|
+
var base = live.baseStyle;
|
|
1158
|
+
styleId = base === undefined ? undefined : base.styleId;
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
var docP = styles.docDefaultsParagraphProperties();
|
|
1164
|
+
var fromDoc = modeledParagraphSlot(docP, key);
|
|
1165
|
+
if (fromDoc !== undefined) {
|
|
1166
|
+
return fromDoc;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
catch (_a) {
|
|
1170
|
+
// detached
|
|
1171
|
+
}
|
|
1172
|
+
// Direct property getters treat unset as `undefined` (DocIO-style).
|
|
1173
|
+
// Layout/effective consumers apply PARAGRAPH_FORMAT_DEFAULTS themselves
|
|
1174
|
+
// when they need concrete booleans/numbers — do not invent them here.
|
|
1175
|
+
return undefined;
|
|
1176
|
+
};
|
|
1177
|
+
Object.defineProperty(WordDocument.prototype, 'styles', {
|
|
1178
|
+
get: function () {
|
|
1179
|
+
return styleCollectionFor(this);
|
|
1180
|
+
},
|
|
1181
|
+
configurable: true,
|
|
1182
|
+
});
|
|
1183
|
+
Object.defineProperty(WordDocument.prototype, 'addTableStyle', {
|
|
1184
|
+
value: function (name) {
|
|
1185
|
+
return styleCollectionFor(this).addTableStyle(name);
|
|
1186
|
+
},
|
|
1187
|
+
writable: true,
|
|
1188
|
+
configurable: true,
|
|
1189
|
+
});
|
|
1190
|
+
Object.defineProperty(WordDocument.prototype, 'themes', {
|
|
1191
|
+
get: function () {
|
|
1192
|
+
return themeFor(this);
|
|
1193
|
+
},
|
|
1194
|
+
configurable: true,
|
|
1195
|
+
});
|
|
1196
|
+
/**
|
|
1197
|
+
* Clear `w:pStyle` / `w:rStyle` / table style references that point at `styleId`.
|
|
1198
|
+
* Body + nested tables via document-order visitors; headers/footers when that feature is registered.
|
|
1199
|
+
*
|
|
1200
|
+
* @private
|
|
1201
|
+
*/
|
|
1202
|
+
function purgeStyleReferencesInDocument(document, styleId) {
|
|
1203
|
+
visitParagraphsInDocumentOrder(document, function (paragraph) {
|
|
1204
|
+
purgeParagraphStyleReferences(paragraph, styleId);
|
|
1205
|
+
});
|
|
1206
|
+
visitTablesInDocumentOrder(document, function (table) {
|
|
1207
|
+
if (table.styleId === styleId) {
|
|
1208
|
+
table.styleId = undefined;
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
purgeHeaderFooterStyleReferences(document, styleId);
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Clear paragraph and run style refs on a single paragraph.
|
|
1215
|
+
*
|
|
1216
|
+
* @private
|
|
1217
|
+
*/
|
|
1218
|
+
function purgeParagraphStyleReferences(paragraph, styleId) {
|
|
1219
|
+
var e_8, _a;
|
|
1220
|
+
if (paragraph.styleId === styleId) {
|
|
1221
|
+
paragraph.styleId = undefined;
|
|
1222
|
+
}
|
|
1223
|
+
try {
|
|
1224
|
+
for (var _b = __values(paragraph.items), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1225
|
+
var inline = _c.value;
|
|
1226
|
+
if (!(inline instanceof TextRange)) {
|
|
1227
|
+
continue;
|
|
1228
|
+
}
|
|
1229
|
+
if (inline.characterFormat.characterStyle === styleId) {
|
|
1230
|
+
inline.characterFormat.characterStyle = undefined;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1235
|
+
finally {
|
|
1236
|
+
try {
|
|
1237
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1238
|
+
}
|
|
1239
|
+
finally { if (e_8) throw e_8.error; }
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* When headers-footers is registered, clear style refs in every loaded HF part
|
|
1244
|
+
* (including nested tables). Duck-types the catalog via featurePart so styles
|
|
1245
|
+
* stays free of a hard HF import — registry presence only.
|
|
1246
|
+
*
|
|
1247
|
+
* @private
|
|
1248
|
+
*/
|
|
1249
|
+
function purgeHeaderFooterStyleReferences(document, styleId) {
|
|
1250
|
+
var headersFootersFeatureId = featureId('headers-footers');
|
|
1251
|
+
if (!isFeatureRegistered(headersFootersFeatureId)) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
var part = document.featurePart(headersFootersFeatureId);
|
|
1255
|
+
if (part === undefined || typeof part !== 'object' || part === null) {
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
var catalog = part;
|
|
1259
|
+
if (typeof catalog.relationshipIds !== 'function') {
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
var kinds = ['header', 'footer'];
|
|
1263
|
+
for (var k = 0; k < kinds.length; k += 1) {
|
|
1264
|
+
var ids = catalog.relationshipIds(kinds[k]);
|
|
1265
|
+
for (var i = 0; i < ids.length; i += 1) {
|
|
1266
|
+
var relationshipId = ids[i];
|
|
1267
|
+
if (typeof catalog.paragraphsForRelationship === 'function') {
|
|
1268
|
+
var paragraphs = catalog.paragraphsForRelationship(relationshipId);
|
|
1269
|
+
for (var p = 0; p < paragraphs.length; p += 1) {
|
|
1270
|
+
purgeParagraphStyleReferences(paragraphs[p], styleId);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
if (typeof catalog.itemsForRelationship === 'function') {
|
|
1274
|
+
visitTableBlocks(catalog.itemsForRelationship(relationshipId), function (table) {
|
|
1275
|
+
if (table.styleId === styleId) {
|
|
1276
|
+
table.styleId = undefined;
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Visit every table block in document order, including nested tables.
|
|
1285
|
+
*
|
|
1286
|
+
* @private
|
|
1287
|
+
*/
|
|
1288
|
+
function visitTablesInDocumentOrder(document, visit) {
|
|
1289
|
+
visitTableBlocks(document.listBlocks(), visit);
|
|
1290
|
+
}
|
|
1291
|
+
function asTableStyleMaterializeTarget(value) {
|
|
1292
|
+
if (typeof value !== 'object' || value === null) {
|
|
1293
|
+
return undefined;
|
|
1294
|
+
}
|
|
1295
|
+
var candidate = value;
|
|
1296
|
+
if (typeof candidate.listRows !== 'function') {
|
|
1297
|
+
return undefined;
|
|
1298
|
+
}
|
|
1299
|
+
return value;
|
|
1300
|
+
}
|
|
1301
|
+
function visitTableBlocks(blocks, visit) {
|
|
1302
|
+
for (var i = 0; i < blocks.length; i += 1) {
|
|
1303
|
+
var block = blocks[i];
|
|
1304
|
+
if (typeof block !== 'object' || block === null) {
|
|
1305
|
+
continue;
|
|
1306
|
+
}
|
|
1307
|
+
var candidate = block;
|
|
1308
|
+
var table = asTableStyleMaterializeTarget(block);
|
|
1309
|
+
if (table === undefined && candidate.type === 'feature') {
|
|
1310
|
+
table = asTableStyleMaterializeTarget(candidate.value);
|
|
1311
|
+
}
|
|
1312
|
+
if (table === undefined) {
|
|
1313
|
+
continue;
|
|
1314
|
+
}
|
|
1315
|
+
visit(table);
|
|
1316
|
+
var rows = table.listRows();
|
|
1317
|
+
for (var r = 0; r < rows.length; r += 1) {
|
|
1318
|
+
var cells = rows[r].listCells();
|
|
1319
|
+
for (var c = 0; c < cells.length; c += 1) {
|
|
1320
|
+
visitTableBlocks(cells[c].listBlocks(), visit);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
registerStylesFeature();
|