Skip to main content

List

OfficeJS-shaped handle for one numbering definition. Import from @reductoai/docx/node, @reductoai/docx/officejs.

List properties

fork()

Mint a second list instance over the same definition: identical look, its own counters restarted at 1 — Word’s “Restart numbering”. Detach a list item first, then paragraph.attachToList(fork.id, level).

getLevelFormat()

The resolved w:numFmt token of one level (“decimal”, “hebrew1”, …). Levels the definition never declares report "", like getLevelString.

getLevelParagraphs()

Paragraphs at exactly one of Word’s nine list levels.

getLevelString()

The level’s marker as its first item shows it: the bullet character, or “%1.%2.” at each level’s start.

getLevelTrailingCharacter()

Extension: the level’s w:suff in Office.js TrailingCharacter words.

insertParagraph()

Insert in or immediately outside the list, matching Word’s four locations. Start/End clone the adjacent item.

resetLevelFont()

Drop the level marker’s run formatting; resetFontName drops its w:rFonts too.

setLevelAlignment()

Marker alignment inside its own field: Left, Centered, or Right.

setLevelBullet()

Turn a level into a bullet level. charCode is required for Custom and rejected otherwise; fontName writes the marker’s w:rFonts.

setLevelFont()

Extension: the marker’s own character formatting, on bullet AND number levels — this is how a clause number is bolded without touching the paragraph text. null removes one property; a level left with no marker formatting keeps no w:rPr. Size is in points, color “auto” or hex.

setLevelIndents()

Both indents in points. bulletNumberPictureIndent is relative to the text indent and must be 0 or negative (it becomes the hanging indent).

setLevelNumbering()

Turn a level into a numbered level. Accepts OfficeJS ListNumbering spellings in any casing plus the other ST_NumberFormat tokens verbatim (decimalZero, hebrew1, chineseCounting, …). In formatString, numbers are 0-based level indices (never above level) and strings are literals: ["(", 1, ")"] writes ”(%2)”. A plain string is taken as the raw w:lvlText pattern (“%1.”, 1-based).

setLevelStartingNumber()

First number this level counts from.

setLevelTrailingCharacter()

Extension (VBA ListLevel.TrailingCharacter, Office.js ListLevel.trailingCharacter): what follows the marker, w:suff. Tab is Word’s default. Not implemented. These Office.js members throw: getLevelFont, getLevelPicture, setLevelPicture.