Skip to content

0.1.4

Choose a tag to compare

@plutext plutext released this 16 Sep 03:26
· 49 commits to main since this release

CR-003 phase A: the helpers @docx4j/core-ts needed from the object model, each replacing a private copy there.

builders/wml

  • Content controls: sdt(content, options) builds all four w:sdt forms, with the form inferred
    from the content (w:tr a row, w:tc a cell, runs a run, else block) or forced with { form }.
    sdtPr writes w:alias, w:tag, w:id and the kind element in that order, with Office JS's
    ContentControlType names as the kinds. nextSdtId(root) gives an id free in a tree, and
    sdtProperty / sdtKindOf read a control's properties and its kind back.
  • Rows and cells: tr(cells, { widths }) and tc(blocks, { width }). tbl is now built over
    them, with its output unchanged.
  • Inline pictures: inlinePicture(relId, { cx, cy, id, name, descr, title }), docx4j's
    BinaryPartAbstractImage.createImageInline, including the wp:docPr/@title that docx4j CR-018
    added (Office JS altTextTitle).
  • Run properties as an element list: rPrToElements / rPrFromElements convert between
    w:rPr's named properties and the EG_RPrBase list that w:rPrChange/w:rPr keeps, in schema
    order and covering every member, the w14 effects included.
  • walkAll: walk plus the DOM elements an xs:any property holds, so a caller can rewrite
    r:embed wherever it appears.
  • runItemsOf (added in 0.1.3) is documented here for the first time.

Facade

  • deepCopyAs(value, typeName, parent?) copies and types the copy as one of the value's base
    types, dropping the properties that type does not declare: a w:pPrChange holds a PPrBase, and a
    copy that stays a PPr marshals as <w:pPr xsi:type="w:CT_PPr">, which is valid but not what Word
    writes.
  • deepCopyAsSync and getContextSync() are the same for a caller that cannot await and
    knows the context is built; getContextSync throws otherwise.

Notes

All additive, so this is a patch release. @docx4j/core-ts reviewed every signature against its call
sites before publication; deepCopyAsSync exists because of that review.

Requires @docx4j/jsonix ^3.2.1.