Skip to main content

Body

Block-level content in address order: the document body, one table cell, or one textbox story. Import from @reductoai/docx/node, @reductoai/docx/officejs.

Body properties

clear()

Remove all content in scope, leaving a single empty paragraph.

getComments()

getContentControls()

getHtml()

As Word: tables as <table> (merges as colspan/rowspan), <h1>-<h6> for headings, list markers as text, b/i/u/s/sup/sub and links inline.

getOoxml()

getRange()

“Whole” and “Content” span the first paragraph’s start to the last one’s end; “Start”/“End” are collapsed.

getReviewedText()

getTrackedChanges()

Word lists a story’s own changes: the main body’s leave out headers, footers and notes.

insertChart()

Insert an inline chart (extension); data comes from the spec’s literal caches.

insertContentControl()

insertDiagram()

Insert an inline SmartArt diagram (extension); the frame is painted from a cache.

insertFileFromBase64()

Insert a .docx’s body at the edge (or in place of the content), with its images, links, styles, numbering, notes and comments. Async here: unlike Word, the file is unpacked on this side.

insertHtml()

Insert a strict named subset of HTML at the story boundary; any tag outside the subset throws, listing every offender.

insertInlinePictureFromBase64()

insertMath()

Extension: TeX math as a native Office Math equation in a new paragraph at the story edge.

insertOoxml()

insertParagraph()

Insert a paragraph at the start or end of the scope, as Office.js does: Start splits the first paragraph before its text, End types a new paragraph after the last one. Both keep the edge paragraph’s style, numbering and paragraph formatting. When the body’s last paragraph is empty (a new document’s, or the one Word keeps after a final table), End lands before it and that empty paragraph stays last, as in Word. In a table cell, End types the text at the end of the cell’s last paragraph and puts an empty paragraph after it, as Word does.

insertTable()

Insert a table at the start or end of the body; values fills cells row-major. Cells are born plain — the table style owns their appearance.

insertText()

Insert into the scope’s text: “Start”/“End” edit the first/last paragraph; “Replace” clears the scope and leaves the text in one paragraph.
Literal search across the scope, table cells included. Returns a plain snapshot array by design: collections are live queries, but a search hit is a point-in-time span that re-anchors (or goes stale) on its own terms.

set()

Not implemented. These Office.js members throw: parentBody, parentContentControl, insertBreak, select.