docx 7.8.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/build/export/formatter.d.ts +4 -4
- package/build/export/index.d.ts +1 -1
- package/build/export/packer/image-replacer.d.ts +5 -5
- package/build/export/packer/next-compiler.d.ts +11 -11
- package/build/export/packer/numbering-replacer.d.ts +4 -4
- package/build/export/packer/packer.d.ts +18 -18
- package/build/file/app-properties/app-properties-attributes.d.ts +10 -10
- package/build/file/app-properties/app-properties.d.ts +4 -4
- package/build/file/border/border.d.ts +39 -39
- package/build/file/border/index.d.ts +1 -1
- package/build/file/content-types/content-types-attributes.d.ts +8 -8
- package/build/file/content-types/content-types.d.ts +6 -6
- package/build/file/content-types/default/default-attributes.d.ts +10 -10
- package/build/file/content-types/default/default.d.ts +4 -4
- package/build/file/content-types/override/override-attributes.d.ts +10 -10
- package/build/file/content-types/override/override.d.ts +4 -4
- package/build/file/core-properties/index.d.ts +1 -1
- package/build/file/core-properties/properties.d.ts +40 -40
- package/build/file/custom-properties/custom-properties-attributes.d.ts +10 -10
- package/build/file/custom-properties/custom-properties.d.ts +9 -9
- package/build/file/custom-properties/custom-property-attributes.d.ts +12 -12
- package/build/file/custom-properties/custom-property.d.ts +11 -11
- package/build/file/custom-properties/index.d.ts +2 -2
- package/build/file/document/body/body.d.ts +10 -10
- package/build/file/document/body/index.d.ts +2 -2
- package/build/file/document/body/section-properties/index.d.ts +2 -2
- package/build/file/document/body/section-properties/properties/column.d.ts +10 -14
- package/build/file/document/body/section-properties/properties/columns.d.ts +13 -20
- package/build/file/document/body/section-properties/properties/doc-grid.d.ts +22 -22
- package/build/file/document/body/section-properties/properties/header-footer-reference.d.ts +17 -17
- package/build/file/document/body/section-properties/properties/index.d.ts +12 -12
- package/build/file/document/body/section-properties/properties/line-number.d.ts +16 -23
- package/build/file/document/body/section-properties/properties/page-borders.d.ts +30 -30
- package/build/file/document/body/section-properties/properties/page-margin.d.ts +14 -24
- package/build/file/document/body/section-properties/properties/page-number.d.ts +24 -24
- package/build/file/document/body/section-properties/properties/page-size.d.ts +14 -20
- package/build/file/document/body/section-properties/properties/page-text-direction.d.ts +8 -8
- package/build/file/document/body/section-properties/properties/section-type.d.ts +18 -18
- package/build/file/document/body/section-properties/section-properties.d.ts +53 -53
- package/build/file/document/document-attributes.d.ts +85 -85
- package/build/file/document/document-background/document-background.d.ts +23 -23
- package/build/file/document/document-background/index.d.ts +1 -1
- package/build/file/document/document.d.ts +15 -15
- package/build/file/document/index.d.ts +4 -4
- package/build/file/document-wrapper.d.ts +16 -16
- package/build/file/drawing/anchor/anchor-attributes.d.ts +24 -24
- package/build/file/drawing/anchor/anchor.d.ts +6 -6
- package/build/file/drawing/anchor/index.d.ts +2 -2
- package/build/file/drawing/doc-properties/doc-properties-children.d.ts +3 -0
- package/build/file/drawing/doc-properties/doc-properties.d.ts +10 -9
- package/build/file/drawing/drawing.d.ts +18 -18
- package/build/file/drawing/effect-extent/effect-extent-attributes.d.ts +14 -14
- package/build/file/drawing/effect-extent/effect-extent.d.ts +4 -4
- package/build/file/drawing/extent/extent-attributes.d.ts +10 -10
- package/build/file/drawing/extent/extent.d.ts +5 -5
- package/build/file/drawing/floating/align.d.ts +5 -5
- package/build/file/drawing/floating/floating-position.d.ts +49 -49
- package/build/file/drawing/floating/horizontal-position.d.ts +5 -5
- package/build/file/drawing/floating/index.d.ts +4 -4
- package/build/file/drawing/floating/position-offset.d.ts +4 -4
- package/build/file/drawing/floating/simple-pos.d.ts +4 -4
- package/build/file/drawing/floating/vertical-position.d.ts +5 -5
- package/build/file/drawing/graphic-frame/graphic-frame-locks/graphic-frame-lock-attributes.d.ts +10 -10
- package/build/file/drawing/graphic-frame/graphic-frame-locks/graphic-frame-locks.d.ts +4 -4
- package/build/file/drawing/graphic-frame/graphic-frame-properties.d.ts +4 -4
- package/build/file/drawing/index.d.ts +3 -3
- package/build/file/drawing/inline/graphic/graphic-data/graphic-data-attribute.d.ts +8 -8
- package/build/file/drawing/inline/graphic/graphic-data/graphic-data.d.ts +6 -6
- package/build/file/drawing/inline/graphic/graphic-data/index.d.ts +1 -1
- package/build/file/drawing/inline/graphic/graphic-data/pic/blip/blip-fill.d.ts +5 -5
- package/build/file/drawing/inline/graphic/graphic-data/pic/blip/blip.d.ts +5 -5
- package/build/file/drawing/inline/graphic/graphic-data/pic/blip/source-rectangle.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/blip/stretch.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/index.d.ts +1 -1
- package/build/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/child-non-visual-pic-properties/child-non-visual-pic-properties.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/child-non-visual-pic-properties/pic-locks/pic-locks-attributes.d.ts +10 -10
- package/build/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/child-non-visual-pic-properties/pic-locks/pic-locks.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-pic-properties.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties-attributes.d.ts +12 -12
- package/build/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties.d.ts +5 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/pic-attributes.d.ts +8 -8
- package/build/file/drawing/inline/graphic/graphic-data/pic/pic.d.ts +5 -5
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents-attributes.d.ts +10 -10
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents.d.ts +5 -5
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/form.d.ts +17 -17
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/index.d.ts +1 -1
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off-attributes.d.ts +10 -10
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/no-fill.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/adjustment-values/adjustment-values.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/preset-geometry-attributes.d.ts +8 -8
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/preset-geometry.d.ts +4 -4
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties-attributes.d.ts +8 -8
- package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties.d.ts +6 -6
- package/build/file/drawing/inline/graphic/graphic.d.ts +6 -6
- package/build/file/drawing/inline/graphic/index.d.ts +1 -1
- package/build/file/drawing/inline/index.d.ts +1 -1
- package/build/file/drawing/inline/inline-attributes.d.ts +10 -10
- package/build/file/drawing/inline/inline.d.ts +14 -14
- package/build/file/drawing/text-wrap/index.d.ts +5 -5
- package/build/file/drawing/text-wrap/text-wrapping.d.ts +18 -18
- package/build/file/drawing/text-wrap/wrap-none.d.ts +4 -4
- package/build/file/drawing/text-wrap/wrap-square.d.ts +6 -6
- package/build/file/drawing/text-wrap/wrap-tight.d.ts +5 -5
- package/build/file/drawing/text-wrap/wrap-top-and-bottom.d.ts +5 -5
- package/build/file/file-child.d.ts +4 -0
- package/build/file/file.d.ts +69 -72
- package/build/file/footer/footer-attributes.d.ts +50 -50
- package/build/file/footer/footer.d.ts +9 -9
- package/build/file/footer/index.d.ts +1 -1
- package/build/file/footer-wrapper.d.ts +23 -23
- package/build/file/footnotes/footnote/footnote-attributes.d.ts +10 -10
- package/build/file/footnotes/footnote/footnote.d.ts +14 -14
- package/build/file/footnotes/footnote/index.d.ts +1 -1
- package/build/file/footnotes/footnote/run/continuation-seperator-run.d.ts +4 -4
- package/build/file/footnotes/footnote/run/continuation-seperator.d.ts +4 -4
- package/build/file/footnotes/footnote/run/footnote-ref-run.d.ts +4 -4
- package/build/file/footnotes/footnote/run/footnote-ref.d.ts +4 -4
- package/build/file/footnotes/footnote/run/index.d.ts +1 -1
- package/build/file/footnotes/footnote/run/reference-run.d.ts +15 -15
- package/build/file/footnotes/footnote/run/seperator-run.d.ts +4 -4
- package/build/file/footnotes/footnote/run/seperator.d.ts +4 -4
- package/build/file/footnotes/footnotes-attributes.d.ts +40 -40
- package/build/file/footnotes/footnotes.d.ts +6 -6
- package/build/file/footnotes/index.d.ts +2 -2
- package/build/file/footnotes-wrapper.d.ts +10 -10
- package/build/file/header/header-attributes.d.ts +72 -72
- package/build/file/header/header.d.ts +9 -9
- package/build/file/header/index.d.ts +1 -1
- package/build/file/header-wrapper.d.ts +23 -23
- package/build/file/header.d.ts +13 -13
- package/build/file/index.d.ts +19 -20
- package/build/file/media/data.d.ts +22 -22
- package/build/file/media/index.d.ts +2 -2
- package/build/file/media/media.d.ts +16 -19
- package/build/file/numbering/abstract-numbering.d.ts +6 -6
- package/build/file/numbering/index.d.ts +4 -4
- package/build/file/numbering/level.d.ts +96 -96
- package/build/file/numbering/multi-level-type.d.ts +4 -4
- package/build/file/numbering/num.d.ts +22 -20
- package/build/file/numbering/numbering.d.ts +19 -19
- package/build/file/paragraph/formatting/alignment.d.ts +26 -26
- package/build/file/paragraph/formatting/border.d.ts +14 -14
- package/build/file/paragraph/formatting/break.d.ts +11 -11
- package/build/file/paragraph/formatting/indent.d.ts +13 -12
- package/build/file/paragraph/formatting/index.d.ts +8 -8
- package/build/file/paragraph/formatting/spacing.d.ts +18 -18
- package/build/file/paragraph/formatting/style.d.ts +13 -13
- package/build/file/paragraph/formatting/tab-stop.d.ts +44 -44
- package/build/file/paragraph/formatting/unordered-list.d.ts +4 -4
- package/build/file/paragraph/formatting/word-wrap.d.ts +11 -11
- package/build/file/paragraph/frame/frame-properties.d.ts +90 -90
- package/build/file/paragraph/frame/index.d.ts +1 -1
- package/build/file/paragraph/index.d.ts +7 -7
- package/build/file/paragraph/links/bookmark-attributes.d.ts +17 -17
- package/build/file/paragraph/links/bookmark.d.ts +17 -17
- package/build/file/paragraph/links/hyperlink-attributes.d.ts +13 -13
- package/build/file/paragraph/links/hyperlink.d.ts +26 -26
- package/build/file/paragraph/links/index.d.ts +4 -4
- package/build/file/paragraph/links/outline-level.d.ts +5 -5
- package/build/file/paragraph/links/pageref-field-instruction.d.ts +5 -5
- package/build/file/paragraph/links/pageref-properties.d.ts +4 -4
- package/build/file/paragraph/links/pageref.d.ts +5 -5
- package/build/file/paragraph/math/brackets/index.d.ts +4 -4
- package/build/file/paragraph/math/brackets/math-angled-brackets.d.ts +7 -7
- package/build/file/paragraph/math/brackets/math-beginning-character.d.ts +4 -4
- package/build/file/paragraph/math/brackets/math-bracket-properties.d.ts +7 -7
- package/build/file/paragraph/math/brackets/math-curly-brackets.d.ts +7 -7
- package/build/file/paragraph/math/brackets/math-ending-char.d.ts +4 -4
- package/build/file/paragraph/math/brackets/math-round-brackets.d.ts +7 -7
- package/build/file/paragraph/math/brackets/math-square-brackets.d.ts +7 -7
- package/build/file/paragraph/math/fraction/index.d.ts +3 -3
- package/build/file/paragraph/math/fraction/math-denominator.d.ts +5 -5
- package/build/file/paragraph/math/fraction/math-fraction.d.ts +9 -9
- package/build/file/paragraph/math/fraction/math-numerator.d.ts +5 -5
- package/build/file/paragraph/math/function/index.d.ts +3 -3
- package/build/file/paragraph/math/function/math-function-name.d.ts +5 -5
- package/build/file/paragraph/math/function/math-function-properties.d.ts +4 -4
- package/build/file/paragraph/math/function/math-function.d.ts +9 -9
- package/build/file/paragraph/math/index.d.ts +9 -9
- package/build/file/paragraph/math/math-component.d.ts +9 -9
- package/build/file/paragraph/math/math-run.d.ts +4 -4
- package/build/file/paragraph/math/math-text.d.ts +4 -4
- package/build/file/paragraph/math/math.d.ts +8 -8
- package/build/file/paragraph/math/n-ary/index.d.ts +8 -8
- package/build/file/paragraph/math/n-ary/math-accent-character.d.ts +4 -4
- package/build/file/paragraph/math/n-ary/math-base.d.ts +5 -5
- package/build/file/paragraph/math/n-ary/math-integral.d.ts +10 -10
- package/build/file/paragraph/math/n-ary/math-limit-location.d.ts +4 -4
- package/build/file/paragraph/math/n-ary/math-n-ary-properties.d.ts +4 -4
- package/build/file/paragraph/math/n-ary/math-sub-script-hide.d.ts +4 -4
- package/build/file/paragraph/math/n-ary/math-sub-script.d.ts +5 -5
- package/build/file/paragraph/math/n-ary/math-sum.d.ts +10 -10
- package/build/file/paragraph/math/n-ary/math-super-script-hide.d.ts +4 -4
- package/build/file/paragraph/math/n-ary/math-super-script.d.ts +5 -5
- package/build/file/paragraph/math/radical/index.d.ts +3 -3
- package/build/file/paragraph/math/radical/math-degree-hide.d.ts +4 -4
- package/build/file/paragraph/math/radical/math-degree.d.ts +5 -5
- package/build/file/paragraph/math/radical/math-radical-properties.d.ts +4 -4
- package/build/file/paragraph/math/radical/math-radical.d.ts +9 -9
- package/build/file/paragraph/math/script/index.d.ts +4 -4
- package/build/file/paragraph/math/script/pre-sub-super-script/index.d.ts +2 -2
- package/build/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.d.ts +4 -4
- package/build/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.d.ts +10 -10
- package/build/file/paragraph/math/script/sub-script/index.d.ts +2 -2
- package/build/file/paragraph/math/script/sub-script/math-sub-script-function-properties.d.ts +4 -4
- package/build/file/paragraph/math/script/sub-script/math-sub-script-function.d.ts +9 -9
- package/build/file/paragraph/math/script/sub-super-script/index.d.ts +2 -2
- package/build/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.d.ts +4 -4
- package/build/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.d.ts +10 -10
- package/build/file/paragraph/math/script/super-script/index.d.ts +2 -2
- package/build/file/paragraph/math/script/super-script/math-super-script-function-properties.d.ts +4 -4
- package/build/file/paragraph/math/script/super-script/math-super-script-function.d.ts +9 -9
- package/build/file/paragraph/paragraph.d.ts +21 -20
- package/build/file/paragraph/properties.d.ts +53 -52
- package/build/file/paragraph/run/break.d.ts +4 -4
- package/build/file/paragraph/run/comment-run.d.ts +27 -26
- package/build/file/paragraph/run/emphasis-mark.d.ts +13 -13
- package/build/file/paragraph/run/empty-children.d.ts +52 -0
- package/build/file/paragraph/run/field.d.ts +10 -10
- package/build/file/paragraph/run/formatting.d.ts +14 -13
- package/build/file/paragraph/run/image-run.d.ts +19 -19
- package/build/file/paragraph/run/index.d.ts +13 -12
- package/build/file/paragraph/run/language.d.ts +7 -0
- package/build/file/paragraph/run/page-number.d.ts +10 -10
- package/build/file/paragraph/run/positional-tab.d.ts +25 -0
- package/build/file/paragraph/run/properties.d.ts +76 -59
- package/build/file/paragraph/run/run-components/symbol.d.ts +4 -4
- package/build/file/paragraph/run/run-components/text.d.ts +10 -10
- package/build/file/paragraph/run/run-fonts.d.ts +12 -12
- package/build/file/paragraph/run/run.d.ts +22 -20
- package/build/file/paragraph/run/script.d.ts +10 -10
- package/build/file/paragraph/run/sequential-identifier-instruction.d.ts +4 -4
- package/build/file/paragraph/run/sequential-identifier.d.ts +4 -4
- package/build/file/paragraph/run/simple-field.d.ts +7 -7
- package/build/file/paragraph/run/symbol-run.d.ts +8 -8
- package/build/file/paragraph/run/text-attributes.d.ts +9 -9
- package/build/file/paragraph/run/text-run.d.ts +4 -4
- package/build/file/paragraph/run/underline.d.ts +24 -24
- package/build/file/relationships/attributes.d.ts +8 -8
- package/build/file/relationships/index.d.ts +1 -1
- package/build/file/relationships/relationship/relationship-attributes.d.ts +14 -14
- package/build/file/relationships/relationship/relationship.d.ts +8 -8
- package/build/file/relationships/relationships.d.ts +7 -8
- package/build/file/settings/compatibility-setting/compatibility-setting.d.ts +15 -15
- package/build/file/settings/compatibility.d.ts +72 -72
- package/build/file/settings/index.d.ts +1 -1
- package/build/file/settings/settings.d.ts +51 -51
- package/build/file/shading/index.d.ts +1 -1
- package/build/file/shading/shading.d.ts +48 -48
- package/build/file/shared/alignment.d.ts +14 -14
- package/build/file/shared/index.d.ts +3 -3
- package/build/file/shared/number-format.d.ts +64 -64
- package/build/file/shared/space-type.d.ts +4 -4
- package/build/file/styles/defaults/document-defaults.d.ts +12 -12
- package/build/file/styles/defaults/index.d.ts +3 -3
- package/build/file/styles/defaults/paragraph-properties.d.ts +5 -5
- package/build/file/styles/defaults/run-properties.d.ts +5 -5
- package/build/file/styles/external-styles-factory.d.ts +4 -4
- package/build/file/styles/factory.d.ts +22 -22
- package/build/file/styles/index.d.ts +4 -4
- package/build/file/styles/latent-styles/exceptions.d.ts +20 -20
- package/build/file/styles/latent-styles/index.d.ts +1 -1
- package/build/file/styles/latent-styles/latent-styles.d.ts +5 -5
- package/build/file/styles/sample/default-style.d.ts +1 -1
- package/build/file/styles/sample/index.d.ts +1 -1
- package/build/file/styles/style/character-style.d.ts +13 -13
- package/build/file/styles/style/components.d.ts +11 -11
- package/build/file/styles/style/default-styles.d.ts +44 -44
- package/build/file/styles/style/index.d.ts +4 -4
- package/build/file/styles/style/paragraph-style.d.ts +15 -15
- package/build/file/styles/style/style.d.ts +20 -20
- package/build/file/styles/styles.d.ts +15 -15
- package/build/file/table/grid.d.ts +8 -7
- package/build/file/table/index.d.ts +5 -5
- package/build/file/table/table-cell/index.d.ts +2 -2
- package/build/file/table/table-cell/table-cell-components.d.ts +31 -31
- package/build/file/table/table-cell/table-cell-properties.d.ts +20 -20
- package/build/file/table/table-cell/table-cell.d.ts +12 -12
- package/build/file/table/table-properties/index.d.ts +4 -4
- package/build/file/table/table-properties/table-borders.d.ts +45 -45
- package/build/file/table/table-properties/table-cell-margin.d.ts +16 -16
- package/build/file/table/table-properties/table-float-properties.d.ts +42 -55
- package/build/file/table/table-properties/table-layout.d.ts +8 -8
- package/build/file/table/table-properties/table-properties.d.ts +23 -23
- package/build/file/table/table-row/index.d.ts +3 -3
- package/build/file/table/table-row/table-row-height.d.ts +19 -18
- package/build/file/table/table-row/table-row-properties.d.ts +14 -13
- package/build/file/table/table-row/table-row.d.ts +16 -16
- package/build/file/table/table-width.d.ts +15 -14
- package/build/file/table/table.d.ts +23 -23
- package/build/file/table-of-contents/field-instruction.d.ts +6 -6
- package/build/file/table-of-contents/index.d.ts +2 -2
- package/build/file/table-of-contents/sdt-content.d.ts +4 -4
- package/build/file/table-of-contents/sdt-properties.d.ts +4 -4
- package/build/file/table-of-contents/table-of-contents-properties.d.ts +23 -23
- package/build/file/table-of-contents/table-of-contents.d.ts +5 -5
- package/build/file/track-revision/index.d.ts +2 -2
- package/build/file/track-revision/track-revision-components/deleted-page-number.d.ts +10 -10
- package/build/file/track-revision/track-revision-components/deleted-text-run.d.ts +13 -13
- package/build/file/track-revision/track-revision-components/deleted-text.d.ts +4 -4
- package/build/file/track-revision/track-revision-components/inserted-text-run.d.ts +9 -9
- package/build/file/track-revision/track-revision.d.ts +13 -13
- package/build/file/vertical-align/index.d.ts +1 -1
- package/build/file/vertical-align/vertical-align.d.ts +16 -16
- package/build/file/xml-components/attributes.d.ts +46 -46
- package/build/file/xml-components/base.d.ts +13 -12
- package/build/file/xml-components/default-attributes.d.ts +25 -11
- package/build/file/xml-components/imported-xml-component.d.ts +14 -14
- package/build/file/xml-components/index.d.ts +8 -8
- package/build/file/xml-components/initializable-xml-component.d.ts +4 -4
- package/build/file/xml-components/simple-elements.d.ts +29 -19
- package/build/file/xml-components/xml-component.d.ts +12 -12
- package/build/file/xml-components/xmlable-object.d.ts +7 -7
- package/build/index.d.ts +5 -5
- package/build/index.js +1 -1
- package/build/patcher/content-types-manager.d.ts +2 -0
- package/build/patcher/from-docx.d.ts +25 -0
- package/build/patcher/index.d.ts +1 -0
- package/build/patcher/paragraph-split-inject.d.ts +6 -0
- package/build/patcher/paragraph-token-replacer.d.ts +8 -0
- package/build/patcher/relationship-manager.d.ts +4 -0
- package/build/patcher/replacer.d.ts +5 -0
- package/build/patcher/run-renderer.d.ts +22 -0
- package/build/patcher/traverser.d.ts +8 -0
- package/build/patcher/util.d.ts +5 -0
- package/build/tests/utility.d.ts +3 -3
- package/build/util/convenience-functions.d.ts +4 -4
- package/build/util/index.d.ts +2 -2
- package/build/util/values.d.ts +20 -17
- package/package.json +10 -8
- package/src/export/formatter.ts +1 -1
- package/src/export/packer/next-compiler.ts +23 -5
- package/src/file/document/body/section-properties/properties/column.ts +13 -15
- package/src/file/document/body/section-properties/properties/columns.ts +10 -19
- package/src/file/document/body/section-properties/properties/line-number.ts +13 -17
- package/src/file/document/body/section-properties/properties/page-borders.ts +1 -1
- package/src/file/document/body/section-properties/properties/page-margin.ts +26 -38
- package/src/file/document/body/section-properties/properties/page-size.ts +11 -19
- package/src/file/document/body/section-properties/section-properties.ts +5 -5
- package/src/file/drawing/doc-properties/doc-properties-children.spec.ts +61 -0
- package/src/file/drawing/doc-properties/doc-properties-children.ts +57 -0
- package/src/file/drawing/doc-properties/doc-properties.ts +49 -19
- package/src/file/drawing/drawing.spec.ts +254 -0
- package/src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties.ts +31 -1
- package/src/file/file-child.ts +5 -0
- package/src/file/file.spec.ts +1 -25
- package/src/file/file.ts +5 -31
- package/src/file/index.ts +0 -1
- package/src/file/media/media.spec.ts +13 -79
- package/src/file/media/media.ts +0 -49
- package/src/file/numbering/concrete-numbering.spec.ts +185 -10
- package/src/file/numbering/num.ts +10 -6
- package/src/file/numbering/numbering.ts +6 -4
- package/src/file/paragraph/formatting/indent.ts +54 -40
- package/src/file/paragraph/paragraph.spec.ts +1 -0
- package/src/file/paragraph/paragraph.ts +3 -2
- package/src/file/paragraph/properties.spec.ts +16 -0
- package/src/file/paragraph/properties.ts +9 -0
- package/src/file/paragraph/run/comment-run.spec.ts +10 -8
- package/src/file/paragraph/run/comment-run.ts +6 -6
- package/src/file/paragraph/run/empty-children.spec.ts +229 -0
- package/src/file/paragraph/run/empty-children.ts +127 -0
- package/src/file/paragraph/run/formatting.ts +2 -2
- package/src/file/paragraph/run/image-run.spec.ts +4 -0
- package/src/file/paragraph/run/index.ts +2 -1
- package/src/file/paragraph/run/language.spec.ts +29 -0
- package/src/file/paragraph/run/language.ts +35 -0
- package/src/file/paragraph/run/positional-tab.spec.ts +27 -0
- package/src/file/paragraph/run/positional-tab.ts +80 -0
- package/src/file/paragraph/run/properties.ts +44 -2
- package/src/file/paragraph/run/run.spec.ts +143 -0
- package/src/file/paragraph/run/run.ts +83 -2
- package/src/file/paragraph/run/symbol-run.ts +1 -1
- package/src/file/relationships/relationships.ts +1 -5
- package/src/file/styles/sample/default-style.ts +7 -1
- package/src/file/table/grid.ts +9 -9
- package/src/file/table/table-properties/table-float-properties.spec.ts +1 -3
- package/src/file/table/table-properties/table-float-properties.ts +56 -42
- package/src/file/table/table-row/table-row-height.ts +2 -2
- package/src/file/table/table-row/table-row-properties.ts +2 -1
- package/src/file/table/table-width.ts +12 -10
- package/src/file/table/table.ts +2 -2
- package/src/file/table-of-contents/table-of-contents.ts +2 -2
- package/src/file/xml-components/base.ts +2 -0
- package/src/file/xml-components/default-attributes.ts +18 -5
- package/src/file/xml-components/imported-xml-component.spec.ts +1 -1
- package/src/file/xml-components/simple-elements.spec.ts +41 -0
- package/src/file/xml-components/simple-elements.ts +29 -3
- package/src/file/xml-components/xml-component.ts +11 -0
- package/src/index.ts +1 -1
- package/src/patcher/content-types-manager.spec.ts +51 -0
- package/src/patcher/content-types-manager.ts +16 -0
- package/src/patcher/from-docx.spec.ts +370 -0
- package/src/patcher/from-docx.ts +233 -0
- package/src/patcher/index.ts +1 -0
- package/src/patcher/paragraph-split-inject.spec.ts +224 -0
- package/src/patcher/paragraph-split-inject.ts +54 -0
- package/src/patcher/paragraph-token-replacer.spec.ts +165 -0
- package/src/patcher/paragraph-token-replacer.ts +69 -0
- package/src/patcher/relationship-manager.spec.ts +87 -0
- package/src/patcher/relationship-manager.ts +42 -0
- package/src/patcher/replacer.spec.ts +206 -0
- package/src/patcher/replacer.ts +83 -0
- package/src/patcher/run-renderer.spec.ts +96 -0
- package/src/patcher/run-renderer.ts +109 -0
- package/src/patcher/traverser.spec.ts +599 -0
- package/src/patcher/traverser.ts +45 -0
- package/src/patcher/util.spec.ts +50 -0
- package/src/patcher/util.ts +30 -0
- package/src/util/values.spec.ts +0 -22
- package/src/util/values.ts +29 -25
- package/build/file/file-properties.d.ts +0 -5
- package/build/file/paragraph/run/tab.d.ts +0 -4
- package/build/import-dotx/import-dotx.d.ts +0 -23
- package/build/import-dotx/index.d.ts +0 -1
- package/src/file/file-properties.ts +0 -11
- package/src/file/paragraph/run/tab.spec.ts +0 -22
- package/src/file/paragraph/run/tab.ts +0 -14
- package/src/import-dotx/import-dotx.spec.ts +0 -26
- package/src/import-dotx/import-dotx.ts +0 -266
- package/src/import-dotx/index.ts +0 -1
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
|
|
3
|
+
import { findLocationOfText } from "./traverser";
|
|
4
|
+
|
|
5
|
+
const MOCK_JSON = {
|
|
6
|
+
elements: [
|
|
7
|
+
{
|
|
8
|
+
type: "element",
|
|
9
|
+
name: "w:document",
|
|
10
|
+
attributes: {
|
|
11
|
+
"xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
|
|
12
|
+
"xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
|
|
13
|
+
"xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
|
|
14
|
+
"xmlns:cx2": "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
|
|
15
|
+
"xmlns:cx3": "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
|
|
16
|
+
"xmlns:cx4": "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
|
|
17
|
+
"xmlns:cx5": "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
|
|
18
|
+
"xmlns:cx6": "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
|
|
19
|
+
"xmlns:cx7": "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
|
|
20
|
+
"xmlns:cx8": "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
|
|
21
|
+
"xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
22
|
+
"xmlns:aink": "http://schemas.microsoft.com/office/drawing/2016/ink",
|
|
23
|
+
"xmlns:am3d": "http://schemas.microsoft.com/office/drawing/2017/model3d",
|
|
24
|
+
"xmlns:o": "urn:schemas-microsoft-com:office:office",
|
|
25
|
+
"xmlns:oel": "http://schemas.microsoft.com/office/2019/extlst",
|
|
26
|
+
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
27
|
+
"xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
|
|
28
|
+
"xmlns:v": "urn:schemas-microsoft-com:vml",
|
|
29
|
+
"xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
|
|
30
|
+
"xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
|
|
31
|
+
"xmlns:w10": "urn:schemas-microsoft-com:office:word",
|
|
32
|
+
"xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
33
|
+
"xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
|
|
34
|
+
"xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml",
|
|
35
|
+
"xmlns:w16cex": "http://schemas.microsoft.com/office/word/2018/wordml/cex",
|
|
36
|
+
"xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
|
|
37
|
+
"xmlns:w16": "http://schemas.microsoft.com/office/word/2018/wordml",
|
|
38
|
+
"xmlns:w16sdtdh": "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",
|
|
39
|
+
"xmlns:w16se": "http://schemas.microsoft.com/office/word/2015/wordml/symex",
|
|
40
|
+
"xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
|
|
41
|
+
"xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
|
|
42
|
+
"xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
|
|
43
|
+
"xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
|
|
44
|
+
},
|
|
45
|
+
elements: [
|
|
46
|
+
{
|
|
47
|
+
type: "element",
|
|
48
|
+
name: "w:body",
|
|
49
|
+
elements: [
|
|
50
|
+
{
|
|
51
|
+
type: "element",
|
|
52
|
+
name: "w:p",
|
|
53
|
+
attributes: {
|
|
54
|
+
"w14:paraId": "2499FE9F",
|
|
55
|
+
"w14:textId": "0A3D130F",
|
|
56
|
+
"w:rsidR": "00B51233",
|
|
57
|
+
"w:rsidRDefault": "007B52ED",
|
|
58
|
+
"w:rsidP": "007B52ED",
|
|
59
|
+
},
|
|
60
|
+
elements: [
|
|
61
|
+
{
|
|
62
|
+
type: "element",
|
|
63
|
+
name: "w:pPr",
|
|
64
|
+
elements: [{ type: "element", name: "w:pStyle", attributes: { "w:val": "Title" } }],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: "element",
|
|
68
|
+
name: "w:r",
|
|
69
|
+
elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "Hello World" }] }],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "element",
|
|
75
|
+
name: "w:p",
|
|
76
|
+
attributes: {
|
|
77
|
+
"w14:paraId": "6410D9A0",
|
|
78
|
+
"w14:textId": "7579AB49",
|
|
79
|
+
"w:rsidR": "007B52ED",
|
|
80
|
+
"w:rsidRDefault": "007B52ED",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "element",
|
|
85
|
+
name: "w:p",
|
|
86
|
+
attributes: {
|
|
87
|
+
"w14:paraId": "57ACF964",
|
|
88
|
+
"w14:textId": "315D7A05",
|
|
89
|
+
"w:rsidR": "007B52ED",
|
|
90
|
+
"w:rsidRDefault": "007B52ED",
|
|
91
|
+
},
|
|
92
|
+
elements: [
|
|
93
|
+
{
|
|
94
|
+
type: "element",
|
|
95
|
+
name: "w:r",
|
|
96
|
+
elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "Hello {{name}}," }] }],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "element",
|
|
100
|
+
name: "w:r",
|
|
101
|
+
attributes: { "w:rsidR": "008126CB" },
|
|
102
|
+
elements: [
|
|
103
|
+
{
|
|
104
|
+
type: "element",
|
|
105
|
+
name: "w:t",
|
|
106
|
+
attributes: { "xml:space": "preserve" },
|
|
107
|
+
elements: [{ type: "text", text: " how are you?" }],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: "element",
|
|
115
|
+
name: "w:p",
|
|
116
|
+
attributes: {
|
|
117
|
+
"w14:paraId": "38C7DF4A",
|
|
118
|
+
"w14:textId": "66CDEC9A",
|
|
119
|
+
"w:rsidR": "007B52ED",
|
|
120
|
+
"w:rsidRDefault": "007B52ED",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: "element",
|
|
125
|
+
name: "w:p",
|
|
126
|
+
attributes: {
|
|
127
|
+
"w14:paraId": "04FABE2B",
|
|
128
|
+
"w14:textId": "3DACA001",
|
|
129
|
+
"w:rsidR": "007B52ED",
|
|
130
|
+
"w:rsidRDefault": "007B52ED",
|
|
131
|
+
},
|
|
132
|
+
elements: [
|
|
133
|
+
{
|
|
134
|
+
type: "element",
|
|
135
|
+
name: "w:r",
|
|
136
|
+
elements: [
|
|
137
|
+
{ type: "element", name: "w:t", elements: [{ type: "text", text: "{{paragraph_replace}}" }] },
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "element",
|
|
144
|
+
name: "w:p",
|
|
145
|
+
attributes: {
|
|
146
|
+
"w14:paraId": "7AD7975D",
|
|
147
|
+
"w14:textId": "77777777",
|
|
148
|
+
"w:rsidR": "00EF161F",
|
|
149
|
+
"w:rsidRDefault": "00EF161F",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "element",
|
|
154
|
+
name: "w:p",
|
|
155
|
+
attributes: {
|
|
156
|
+
"w14:paraId": "3BD6D75A",
|
|
157
|
+
"w14:textId": "19AE3121",
|
|
158
|
+
"w:rsidR": "00EF161F",
|
|
159
|
+
"w:rsidRDefault": "00EF161F",
|
|
160
|
+
},
|
|
161
|
+
elements: [
|
|
162
|
+
{
|
|
163
|
+
type: "element",
|
|
164
|
+
name: "w:r",
|
|
165
|
+
elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "{{table}}" }] }],
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: "element",
|
|
171
|
+
name: "w:p",
|
|
172
|
+
attributes: {
|
|
173
|
+
"w14:paraId": "76023962",
|
|
174
|
+
"w14:textId": "4E606AB9",
|
|
175
|
+
"w:rsidR": "007B52ED",
|
|
176
|
+
"w:rsidRDefault": "007B52ED",
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: "element",
|
|
181
|
+
name: "w:tbl",
|
|
182
|
+
elements: [
|
|
183
|
+
{
|
|
184
|
+
type: "element",
|
|
185
|
+
name: "w:tblPr",
|
|
186
|
+
elements: [
|
|
187
|
+
{ type: "element", name: "w:tblStyle", attributes: { "w:val": "TableGrid" } },
|
|
188
|
+
{ type: "element", name: "w:tblW", attributes: { "w:w": "0", "w:type": "auto" } },
|
|
189
|
+
{
|
|
190
|
+
type: "element",
|
|
191
|
+
name: "w:tblLook",
|
|
192
|
+
attributes: {
|
|
193
|
+
"w:val": "04A0",
|
|
194
|
+
"w:firstRow": "1",
|
|
195
|
+
"w:lastRow": "0",
|
|
196
|
+
"w:firstColumn": "1",
|
|
197
|
+
"w:lastColumn": "0",
|
|
198
|
+
"w:noHBand": "0",
|
|
199
|
+
"w:noVBand": "1",
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: "element",
|
|
206
|
+
name: "w:tblGrid",
|
|
207
|
+
elements: [
|
|
208
|
+
{ type: "element", name: "w:gridCol", attributes: { "w:w": "3003" } },
|
|
209
|
+
{ type: "element", name: "w:gridCol", attributes: { "w:w": "3003" } },
|
|
210
|
+
{ type: "element", name: "w:gridCol", attributes: { "w:w": "3004" } },
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: "element",
|
|
215
|
+
name: "w:tr",
|
|
216
|
+
attributes: {
|
|
217
|
+
"w:rsidR": "00EF161F",
|
|
218
|
+
"w14:paraId": "1DEC5955",
|
|
219
|
+
"w14:textId": "77777777",
|
|
220
|
+
"w:rsidTr": "00EF161F",
|
|
221
|
+
},
|
|
222
|
+
elements: [
|
|
223
|
+
{
|
|
224
|
+
type: "element",
|
|
225
|
+
name: "w:tc",
|
|
226
|
+
elements: [
|
|
227
|
+
{
|
|
228
|
+
type: "element",
|
|
229
|
+
name: "w:tcPr",
|
|
230
|
+
elements: [
|
|
231
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3003", "w:type": "dxa" } },
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: "element",
|
|
236
|
+
name: "w:p",
|
|
237
|
+
attributes: {
|
|
238
|
+
"w14:paraId": "54DA5587",
|
|
239
|
+
"w14:textId": "625BAC60",
|
|
240
|
+
"w:rsidR": "00EF161F",
|
|
241
|
+
"w:rsidRDefault": "00EF161F",
|
|
242
|
+
},
|
|
243
|
+
elements: [
|
|
244
|
+
{
|
|
245
|
+
type: "element",
|
|
246
|
+
name: "w:r",
|
|
247
|
+
elements: [
|
|
248
|
+
{
|
|
249
|
+
type: "element",
|
|
250
|
+
name: "w:t",
|
|
251
|
+
elements: [{ type: "text", text: "{{table_heading_1}}" }],
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: "element",
|
|
261
|
+
name: "w:tc",
|
|
262
|
+
elements: [
|
|
263
|
+
{
|
|
264
|
+
type: "element",
|
|
265
|
+
name: "w:tcPr",
|
|
266
|
+
elements: [
|
|
267
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3003", "w:type": "dxa" } },
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
type: "element",
|
|
272
|
+
name: "w:p",
|
|
273
|
+
attributes: {
|
|
274
|
+
"w14:paraId": "57100910",
|
|
275
|
+
"w14:textId": "71FD5616",
|
|
276
|
+
"w:rsidR": "00EF161F",
|
|
277
|
+
"w:rsidRDefault": "00EF161F",
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
type: "element",
|
|
284
|
+
name: "w:tc",
|
|
285
|
+
elements: [
|
|
286
|
+
{
|
|
287
|
+
type: "element",
|
|
288
|
+
name: "w:tcPr",
|
|
289
|
+
elements: [
|
|
290
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3004", "w:type": "dxa" } },
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
type: "element",
|
|
295
|
+
name: "w:p",
|
|
296
|
+
attributes: {
|
|
297
|
+
"w14:paraId": "1D388FAB",
|
|
298
|
+
"w14:textId": "77777777",
|
|
299
|
+
"w:rsidR": "00EF161F",
|
|
300
|
+
"w:rsidRDefault": "00EF161F",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
type: "element",
|
|
309
|
+
name: "w:tr",
|
|
310
|
+
attributes: {
|
|
311
|
+
"w:rsidR": "00EF161F",
|
|
312
|
+
"w14:paraId": "0F53D2DC",
|
|
313
|
+
"w14:textId": "77777777",
|
|
314
|
+
"w:rsidTr": "00EF161F",
|
|
315
|
+
},
|
|
316
|
+
elements: [
|
|
317
|
+
{
|
|
318
|
+
type: "element",
|
|
319
|
+
name: "w:tc",
|
|
320
|
+
elements: [
|
|
321
|
+
{
|
|
322
|
+
type: "element",
|
|
323
|
+
name: "w:tcPr",
|
|
324
|
+
elements: [
|
|
325
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3003", "w:type": "dxa" } },
|
|
326
|
+
],
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
type: "element",
|
|
330
|
+
name: "w:p",
|
|
331
|
+
attributes: {
|
|
332
|
+
"w14:paraId": "0F2BCCED",
|
|
333
|
+
"w14:textId": "3C3B6706",
|
|
334
|
+
"w:rsidR": "00EF161F",
|
|
335
|
+
"w:rsidRDefault": "00EF161F",
|
|
336
|
+
},
|
|
337
|
+
elements: [
|
|
338
|
+
{
|
|
339
|
+
type: "element",
|
|
340
|
+
name: "w:r",
|
|
341
|
+
elements: [
|
|
342
|
+
{
|
|
343
|
+
type: "element",
|
|
344
|
+
name: "w:t",
|
|
345
|
+
elements: [{ type: "text", text: "Item: {{item_1}}" }],
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
type: "element",
|
|
355
|
+
name: "w:tc",
|
|
356
|
+
elements: [
|
|
357
|
+
{
|
|
358
|
+
type: "element",
|
|
359
|
+
name: "w:tcPr",
|
|
360
|
+
elements: [
|
|
361
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3003", "w:type": "dxa" } },
|
|
362
|
+
],
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
type: "element",
|
|
366
|
+
name: "w:p",
|
|
367
|
+
attributes: {
|
|
368
|
+
"w14:paraId": "1E6158AC",
|
|
369
|
+
"w14:textId": "77777777",
|
|
370
|
+
"w:rsidR": "00EF161F",
|
|
371
|
+
"w:rsidRDefault": "00EF161F",
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
type: "element",
|
|
378
|
+
name: "w:tc",
|
|
379
|
+
elements: [
|
|
380
|
+
{
|
|
381
|
+
type: "element",
|
|
382
|
+
name: "w:tcPr",
|
|
383
|
+
elements: [
|
|
384
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3004", "w:type": "dxa" } },
|
|
385
|
+
],
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
type: "element",
|
|
389
|
+
name: "w:p",
|
|
390
|
+
attributes: {
|
|
391
|
+
"w14:paraId": "17937748",
|
|
392
|
+
"w14:textId": "77777777",
|
|
393
|
+
"w:rsidR": "00EF161F",
|
|
394
|
+
"w:rsidRDefault": "00EF161F",
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
],
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
type: "element",
|
|
403
|
+
name: "w:tr",
|
|
404
|
+
attributes: {
|
|
405
|
+
"w:rsidR": "00EF161F",
|
|
406
|
+
"w14:paraId": "781DAC1A",
|
|
407
|
+
"w14:textId": "77777777",
|
|
408
|
+
"w:rsidTr": "00EF161F",
|
|
409
|
+
},
|
|
410
|
+
elements: [
|
|
411
|
+
{
|
|
412
|
+
type: "element",
|
|
413
|
+
name: "w:tc",
|
|
414
|
+
elements: [
|
|
415
|
+
{
|
|
416
|
+
type: "element",
|
|
417
|
+
name: "w:tcPr",
|
|
418
|
+
elements: [
|
|
419
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3003", "w:type": "dxa" } },
|
|
420
|
+
],
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
type: "element",
|
|
424
|
+
name: "w:p",
|
|
425
|
+
attributes: {
|
|
426
|
+
"w14:paraId": "1DCD0343",
|
|
427
|
+
"w14:textId": "77777777",
|
|
428
|
+
"w:rsidR": "00EF161F",
|
|
429
|
+
"w:rsidRDefault": "00EF161F",
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
type: "element",
|
|
436
|
+
name: "w:tc",
|
|
437
|
+
elements: [
|
|
438
|
+
{
|
|
439
|
+
type: "element",
|
|
440
|
+
name: "w:tcPr",
|
|
441
|
+
elements: [
|
|
442
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3003", "w:type": "dxa" } },
|
|
443
|
+
],
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
type: "element",
|
|
447
|
+
name: "w:p",
|
|
448
|
+
attributes: {
|
|
449
|
+
"w14:paraId": "5D02E3CD",
|
|
450
|
+
"w14:textId": "77777777",
|
|
451
|
+
"w:rsidR": "00EF161F",
|
|
452
|
+
"w:rsidRDefault": "00EF161F",
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
type: "element",
|
|
459
|
+
name: "w:tc",
|
|
460
|
+
elements: [
|
|
461
|
+
{
|
|
462
|
+
type: "element",
|
|
463
|
+
name: "w:tcPr",
|
|
464
|
+
elements: [
|
|
465
|
+
{ type: "element", name: "w:tcW", attributes: { "w:w": "3004", "w:type": "dxa" } },
|
|
466
|
+
],
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
type: "element",
|
|
470
|
+
name: "w:p",
|
|
471
|
+
attributes: {
|
|
472
|
+
"w14:paraId": "52EA0DBB",
|
|
473
|
+
"w14:textId": "77777777",
|
|
474
|
+
"w:rsidR": "00EF161F",
|
|
475
|
+
"w:rsidRDefault": "00EF161F",
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
],
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
type: "element",
|
|
486
|
+
name: "w:p",
|
|
487
|
+
attributes: {
|
|
488
|
+
"w14:paraId": "47CD1FBC",
|
|
489
|
+
"w14:textId": "23474CBC",
|
|
490
|
+
"w:rsidR": "007B52ED",
|
|
491
|
+
"w:rsidRDefault": "007B52ED",
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
type: "element",
|
|
496
|
+
name: "w:p",
|
|
497
|
+
attributes: {
|
|
498
|
+
"w14:paraId": "0ACCEE90",
|
|
499
|
+
"w14:textId": "67907499",
|
|
500
|
+
"w:rsidR": "00EF161F",
|
|
501
|
+
"w:rsidRDefault": "0077578F",
|
|
502
|
+
},
|
|
503
|
+
elements: [
|
|
504
|
+
{
|
|
505
|
+
type: "element",
|
|
506
|
+
name: "w:r",
|
|
507
|
+
elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "{{image_test}}" }] }],
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
type: "element",
|
|
513
|
+
name: "w:p",
|
|
514
|
+
attributes: {
|
|
515
|
+
"w14:paraId": "23FA9862",
|
|
516
|
+
"w14:textId": "77777777",
|
|
517
|
+
"w:rsidR": "0077578F",
|
|
518
|
+
"w:rsidRDefault": "0077578F",
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
type: "element",
|
|
523
|
+
name: "w:p",
|
|
524
|
+
attributes: {
|
|
525
|
+
"w14:paraId": "01578F2F",
|
|
526
|
+
"w14:textId": "3BDC6C85",
|
|
527
|
+
"w:rsidR": "007B52ED",
|
|
528
|
+
"w:rsidRDefault": "007B52ED",
|
|
529
|
+
},
|
|
530
|
+
elements: [
|
|
531
|
+
{
|
|
532
|
+
type: "element",
|
|
533
|
+
name: "w:r",
|
|
534
|
+
elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "Thank you" }] }],
|
|
535
|
+
},
|
|
536
|
+
],
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
type: "element",
|
|
540
|
+
name: "w:sectPr",
|
|
541
|
+
attributes: { "w:rsidR": "007B52ED", "w:rsidSect": "0072043F" },
|
|
542
|
+
elements: [
|
|
543
|
+
{ type: "element", name: "w:headerReference", attributes: { "w:type": "default", "r:id": "rId6" } },
|
|
544
|
+
{ type: "element", name: "w:footerReference", attributes: { "w:type": "default", "r:id": "rId7" } },
|
|
545
|
+
{ type: "element", name: "w:pgSz", attributes: { "w:w": "11900", "w:h": "16840" } },
|
|
546
|
+
{
|
|
547
|
+
type: "element",
|
|
548
|
+
name: "w:pgMar",
|
|
549
|
+
attributes: {
|
|
550
|
+
"w:top": "1440",
|
|
551
|
+
"w:right": "1440",
|
|
552
|
+
"w:bottom": "1440",
|
|
553
|
+
"w:left": "1440",
|
|
554
|
+
"w:header": "708",
|
|
555
|
+
"w:footer": "708",
|
|
556
|
+
"w:gutter": "0",
|
|
557
|
+
},
|
|
558
|
+
},
|
|
559
|
+
{ type: "element", name: "w:cols", attributes: { "w:space": "708" } },
|
|
560
|
+
{ type: "element", name: "w:docGrid", attributes: { "w:linePitch": "360" } },
|
|
561
|
+
],
|
|
562
|
+
},
|
|
563
|
+
],
|
|
564
|
+
},
|
|
565
|
+
],
|
|
566
|
+
},
|
|
567
|
+
],
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
describe("traverser", () => {
|
|
571
|
+
describe("findLocationOfText", () => {
|
|
572
|
+
it("should find the location of text", () => {
|
|
573
|
+
const output = findLocationOfText(MOCK_JSON, "{{table_heading_1}}");
|
|
574
|
+
expect(output).to.deep.equal([
|
|
575
|
+
{
|
|
576
|
+
index: 1,
|
|
577
|
+
path: [0, 0, 0, 8, 2, 0, 1],
|
|
578
|
+
runs: [
|
|
579
|
+
{
|
|
580
|
+
end: 18,
|
|
581
|
+
index: 0,
|
|
582
|
+
parts: [
|
|
583
|
+
{
|
|
584
|
+
end: 18,
|
|
585
|
+
index: 0,
|
|
586
|
+
start: 0,
|
|
587
|
+
text: "{{table_heading_1}}",
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
start: 0,
|
|
591
|
+
text: "{{table_heading_1}}",
|
|
592
|
+
},
|
|
593
|
+
],
|
|
594
|
+
text: "{{table_heading_1}}",
|
|
595
|
+
},
|
|
596
|
+
]);
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Element } from "xml-js";
|
|
2
|
+
|
|
3
|
+
import { IRenderedParagraphNode, renderParagraphNode } from "./run-renderer";
|
|
4
|
+
|
|
5
|
+
export interface ElementWrapper {
|
|
6
|
+
readonly element: Element;
|
|
7
|
+
readonly index: number;
|
|
8
|
+
readonly parent: ElementWrapper | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const elementsToWrapper = (wrapper: ElementWrapper): readonly ElementWrapper[] =>
|
|
12
|
+
wrapper.element.elements?.map((e, i) => ({
|
|
13
|
+
element: e,
|
|
14
|
+
index: i,
|
|
15
|
+
parent: wrapper,
|
|
16
|
+
})) ?? [];
|
|
17
|
+
|
|
18
|
+
export const findLocationOfText = (node: Element, text: string): readonly IRenderedParagraphNode[] => {
|
|
19
|
+
let renderedParagraphs: readonly IRenderedParagraphNode[] = [];
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line functional/prefer-readonly-type
|
|
22
|
+
const queue: ElementWrapper[] = [
|
|
23
|
+
...elementsToWrapper({
|
|
24
|
+
element: node,
|
|
25
|
+
index: 0,
|
|
26
|
+
parent: undefined,
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line functional/immutable-data
|
|
31
|
+
let currentNode: ElementWrapper | undefined;
|
|
32
|
+
while (queue.length > 0) {
|
|
33
|
+
// eslint-disable-next-line functional/immutable-data
|
|
34
|
+
currentNode = queue.shift()!; // This is safe because we check the length of the queue
|
|
35
|
+
|
|
36
|
+
if (currentNode.element.name === "w:p") {
|
|
37
|
+
renderedParagraphs = [...renderedParagraphs, renderParagraphNode(currentNode)];
|
|
38
|
+
} else {
|
|
39
|
+
// eslint-disable-next-line functional/immutable-data
|
|
40
|
+
queue.push(...elementsToWrapper(currentNode));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return renderedParagraphs.filter((p) => p.text.includes(text));
|
|
45
|
+
};
|