§ 03 · API reference

Every public export, grouped by area.

@office-kit/docx exposes 121 standalone functions and constants. Each one takes a Docx as its first argument (where applicable) and is side-effect-free at the module level, so bundlers can tree-shake anything you don't import. For full signatures and parameter shapes, see src/index.ts and the repository.

01

Lifecycle

06
  • createDocx ({ paragraphs? }?) => Docx
  • openDocx (bytes: Uint8Array) => Docx
  • fromBlob (blob: Blob) => Promise<Docx>
  • toUint8Array (doc: Docx) => Uint8Array
  • toBlob (doc: Docx) => Blob
  • clone (doc: Docx) => Docx
02

Paragraphs & blocks

09
  • appendParagraph
  • insertParagraphAt
  • removeParagraph
  • appendHeading
  • appendPageBreak
  • appendLineBreak
  • appendSectionBreak
  • clearBody
  • paragraphs
03

Inline & text

20
  • replaceText
  • replaceTextEverywhere
  • findText
  • findTextEverywhere
  • appendTextRun
  • setParagraphText
  • paragraphText
  • setRunFormat
  • clearRunFormat
  • getRunFormat
  • setParagraphAlignment
  • getParagraphAlignment
  • setParagraphIndent
  • setParagraphSpacing
  • setParagraphBorders
  • setParagraphShading
  • getParagraphStyle
  • getParagraphNumbering
  • mergeAdjacentRuns
  • mergeAdjacentRunsInBody
04

Styles & numbering

10
  • addStyle
  • removeStyle
  • listStyles
  • ensureHeadingStyles
  • findStyleIdByName
  • setParagraphStyle
  • addBulletList
  • addNumberedList
  • applyListToParagraph
  • mergeStylesFromTemplate
05

Tables

14
  • addTable
  • tables
  • removeTable
  • removeAllTables
  • unwrapTable
  • appendTableRow
  • removeTableRow
  • setTableRowAsHeader
  • setTableRowHeight
  • setTableBorders
  • setTableCellText
  • getTableCellText
  • setTableCellShading
  • setTableCellVerticalAlign
06

Images

08
  • addImage
  • addImageRun
  • insertImageInto
  • images
  • imageReferences
  • replaceImage
  • replaceImageByAltText
  • removeAllImages
07

Headers, footers, sections

10
  • addHeader
  • addFooter
  • addPageNumberFooter
  • setPageSize
  • setPageMargins
  • setPageOrientation
  • headers
  • footers
  • removeAllHeaders
  • removeAllFooters
08

Comments, notes, hyperlinks, bookmarks

15
  • addComment
  • addFootnote
  • addEndnote
  • removeAllComments
  • removeAllFootnotes
  • removeAllEndnotes
  • addHyperlink
  • addInternalHyperlink
  • externalHyperlinks
  • setHyperlinkUrl
  • removeAllHyperlinks
  • addBookmark
  • removeBookmark
  • removeAllBookmarks
  • bookmarks
09

Fields & tracked changes

05
  • appendField
  • addTableOfContents
  • appendMergeField
  • acceptAllRevisions
  • rejectAllRevisions
10

Document properties

08
  • coreProperties
  • setCoreProperties
  • appProperties
  • setAppProperties
  • title
  • author
  • setTitle
  • setAuthor
11

Diagnostics

06
  • validate
  • validatePackage
  • statistics
  • outline
  • fields
  • text
12

Low-level part access

05
  • stylesPart
  • numberingPart
  • commentsPart
  • footnotesPart
  • endnotesPart
13

Page-size & margin constants

04
  • PAGE_SIZE_A4
  • PAGE_SIZE_LETTER
  • MARGINS_NORMAL
  • VERSION
14

Browser preview (@office-kit/docx-preview)

01
  • previewToDOM (source, container, options?) => Promise<Handle>

Need usage shapes? Read the getting-started page or the type-checked recipes.