Functions
attributeKey
function attributeKey(namespace: string, localName: string, attribute: string): string
columnWidthTwips
function columnWidthTwips(section: SectionProperties, columnIndex: number): number
Width available to one column, accounting for the gaps between columns.
Unequal columns declare their own widths; equal ones split the remaining space.
`max(0, …)` rather than the raw arithmetic: `columns-space-12000` asks for a
gap wider than the text area, and Word answers with columns of no width at
all — one character to the line — rather than with columns that overlap.
contentHeightTwips
function contentHeightTwips(section: SectionProperties): number
Height of the text area, i.e. the page minus its vertical margins.
contentWidthTwips
function contentWidthTwips(section: SectionProperties): number
Width of the text area, i.e. the page minus its horizontal margins.
elementKey
function elementKey(namespace: string, localName: string): string
How markup is named in the register, in reports and in error messages.
`w:spacing in pPr` for an element, `w:spacing@w:beforeAutospacing` for an
attribute. The prefix is the canonical one of the specification rather than
the one the file happened to use, so that the same gap in two documents is
one line and not two.
fieldTypeOf
function fieldTypeOf(instruction: string): string
Extracts the field type — the first token of the instruction — in upper case.
formatNumber
function formatNumber(value: number, format: NumberFormat): string
Converts a counter value into the textual form of a number format.
ignoredAttributeReason
function ignoredAttributeReason(key: string, parent: string): string | undefined
Four spellings, from the most specific to the least.
`w:spacing@w:line in pPr` names one attribute of one element in one place;
`@w:rsidR` names one that hangs off half the elements in the format; and
`w:lsdException@*` names an element whose every attribute is bookkeeping —
without which the register would need a line for each of the five hundred
that a `latentStyles` block writes.
ignoredElementReason
function ignoredElementReason(key: string, parent: string): string | undefined
The reason this markup is passed over, or `undefined` when there is none.
inlineText
function inlineText(nodes: readonly InlineNode[]): string
Concatenates the text of inline nodes, expanding links, fields and revisions.
isParagraph
function isParagraph(node: BlockNode): node is ParagraphNode
isTable
function isTable(node: BlockNode): node is TableNode
mathToText
function mathToText(node: MathNode | MathElement): string
Extracts the plain text of a math expression.
Used for text extraction and search, where an equation should contribute its
symbols rather than being silently dropped.
mergeBorders
function mergeBorders(base: Borders, override: Borders): Borders
Merges border sets edge by edge.
observeMarkup
function observeMarkup(observe: (sighting: MarkupSighting) => void): () => void
Watches everything the readers pass over until the returned function is called.
The hooks are static on the parser — the readers are hot loops and threading
an option through every one of them would cost more than the feature is
worth — so this is process-wide and must be undone.
openDocx
function openDocx(source: ByteSource, options?: OpenDocxOptions): Promise<DocxDocument>
Opens a Word document.
The main part is parsed in a single streaming pass, while the supporting parts
that a given rendering may not need — headers, footers, footnotes, comments —
are left to be loaded on demand. That matters more than it sounds: a document
with fifteen section-specific headers pays for the two that are actually
displayed.
parseBorders
function parseBorders(parser: XmlPullParser): Borders
Parses a border container: `w:pBdr`, `w:tblBorders`, `w:tcBorders`, `w:pgBorders`.
parseCellProperties
function parseCellProperties(parser: XmlPullParser): CellProperties
Parses `w:tcPr`.
parseChartfrom @apertura/chart
function parseChart(parser: XmlPullParser): ChartDefinition
Parses a whole chart part.
parseDiagramDrawing
function parseDiagramDrawing(parser: XmlPullParser): DiagramDrawing
Parses the drawing Word cached for a SmartArt diagram.
The part is a flat shape tree with absolute geometry, so it needs no
knowledge of the diagram algorithm that produced it.
parseFontTable
function parseFontTable(parser: XmlPullParser): FontDefinition[]
Parses `fontTable.xml`.
parseNumbering
function parseNumbering(parser: XmlPullParser): NumberingDefinitions
Parses `numbering.xml`.
The part has three kinds of top-level content: abstract definitions holding
the actual level formatting, concrete instances that paragraphs reference and
which may override individual levels, and picture bullets. Keeping the
indirection intact matters — two lists sharing an abstract definition must
still number independently.
parseParagraphProperties
function parseParagraphProperties(parser: XmlPullParser, onSectionProperties?: (parser: XmlPullParser) => void): ParagraphProperties
Parses `w:pPr`.
parseRowProperties
function parseRowProperties(parser: XmlPullParser): RowProperties
Parses `w:trPr`.
parseRunProperties
function parseRunProperties(parser: XmlPullParser): RunProperties
Parses `w:rPr`.
Must be called positioned on the `w:rPr` start tag; returns with the parser on
the matching end tag.
parseSectionProperties
function parseSectionProperties(parser: XmlPullParser, over?: SectionProperties): SectionProperties
Parses `w:sectPr`.
Must be called positioned on the opening tag. Missing values fall back to
{@link DEFAULT_SECTION} rather than to zero: a section that omits `w:pgSz` is
inheriting Word's default page, not declaring a zero-sized one.
parseSettings
function parseSettings(parser: XmlPullParser): DocumentSettings
Parses `settings.xml`.
parseStyles
function parseStyles(parser: XmlPullParser): StyleSheet
Parses `styles.xml`.
Styles are stored exactly as written, with no inheritance resolved. Flattening
`w:basedOn` chains at parse time is tempting but wrong: the resolution order
differs between paragraph properties, run properties and the thirteen
conditional table blocks, and a flattened style can no longer answer "was this
value set here or inherited", which the table style cascade needs.
Resolution lives in {@link StyleResolver }, where it is memoised per style id.
parseTableProperties
function parseTableProperties(parser: XmlPullParser): TableProperties
Parses `w:tblPr` or `w:tblPrEx`.
parseTheme
function parseTheme(parser: XmlPullParser): Theme
Parses `theme1.xml`.
resolveLevel
function resolveLevel(numbering: NumberingDefinitions, numberingId: number, level: number, styleLinkResolver?: (styleId: string) => number | undefined): NumberingLevel | undefined
Resolves the effective definition of a list level.
Walks instance → override → abstract definition, following `numStyleLink`
indirection when an instance points at a numbering style rather than at a
concrete definition.
strictMarkup
function strictMarkup(options?: StrictMarkupOptions): () => void
Makes unaccounted markup an error for the duration of the returned handle.
For development runs and tests, never for a viewer: against real files this
throws constantly, and that is the point — it is a search for the gaps, not a
way to read documents.
walkBlocks
function walkBlocks(blocks: readonly BlockNode[]): Generator<BlockNode>
Walks every block in a subtree, descending into tables and content blocks.
A generator rather than an array: callers usually stop early (finding the
first section break, locating a bookmark) and materialising the whole document
as a flat list would defeat the point of a streaming parser.
walkInline
function walkInline(nodes: readonly InlineNode[]): Generator<InlineNode>
Walks every inline node, descending into hyperlinks, fields and revisions.
withInheritedRunningParts
function withInheritedRunningParts(section: SectionProperties, previous: SectionProperties | undefined): SectionProperties
Carries the running parts of one section forward into the next.
Headers and footers are the one part of a section that is *not* self
contained. Word writes a complete `w:sectPr` for everything else — page size,
margins, columns — but a header reference is written only where the header
changes. Everywhere else the section is linked to the one before it, which is
exactly what the "Link to Previous" button in Word's header editor controls,
and what its absence from the file means.
The link is per type. A section may replace the default header and keep
inheriting the first-page and even-page ones, and a report that changes its
running title at each chapter while keeping one title page does precisely
that. Inheriting all-or-nothing puts the wrong title on every chapter after
the first.
There is no way to declare "no header here": to break the link and show
nothing, Word references a header part that is empty. Absence therefore
always means inherit, never means none — a distinction that matters, because
a section that reserved no room for an inherited header would run its text
under it.
Interfaces
AbstractNumbering
interface AbstractNumbering
An abstract list definition, `w:abstractNum`.
restartAfterBreak?
boolean | undefined
The list starts again at the first item after a section break,
`w15:restartNumberingAfterBreak`.
Word 2013 added it and writes it into every list it saves. A numbered list
that runs on across a chapter boundary and one that restarts at each
chapter are the same markup apart from this.
multiLevelType
string | undefined
`singleLevel`, `multilevel` or `hybridMultilevel`.
styleLink
string | undefined
Identifier shared by lists created from the same gallery entry.
numStyleLink
string | undefined
Numbering style that this definition implements.
levels
ReadonlyMap<number, NumberingLevel>
AltChunkNode
interface AltChunkNode
External content embedded by reference, `w:altChunk`.
BodyParserOptions
interface BodyParserOptions
Options controlling which optional content the body parser keeps.
keepDeletedContent?
boolean | undefined
Keep content marked as deleted by revision tracking.
Off by default, which renders the document as if all changes were accepted —
what a reader expects to see. The viewer can turn it on to show markup.
parseMath?
boolean | undefined
Parse OMML equations. On by default.
onProgress?
((fraction: number) => void) | undefined
Report progress as a fraction of the part consumed.
BookmarkEndNode
interface BookmarkEndNode
BookmarkStartNode
interface BookmarkStartNode
Border
interface Border
sizeEighths
number | undefined
Width in eighths of a point, as stored in `w:sz`.
spacePoints
number | undefined
Distance from the text in points, `w:space`.
color
string | undefined
Colour as `RRGGBB`, or `auto`.
themeColor
string | undefined
Theme colour reference, `w:themeColor`.
themeTint
string | undefined
Lightening applied to `themeColor`, `w:themeTint`.
themeShade
string | undefined
Darkening applied to `themeColor`, `w:themeShade`.
Borders
interface Borders
tl2br?
Border | undefined
Diagonal borders, table cells only.
between?
Border | undefined
Borders between paragraphs sharing a border set.
BreakNode
interface BreakNode
clear
"left" | "right" | "none" | "all" | undefined
Text wrapping around a floating object, `w:br/@w:clear`.
CellMargins
interface CellMargins
CellProperties
interface CellProperties
Cell-level formatting, `w:tcPr`.
gridSpan?
number | undefined
Number of grid columns the cell spans, `w:gridSpan`.
verticalMerge?
"restart" | "continue" | undefined
Vertical merge state, `w:vMerge`.
horizontalMerge?
"restart" | "continue" | undefined
Horizontal merge state, `w:hMerge`; the legacy form of `gridSpan`.
verticalAlignment?
"center" | "top" | "bottom" | "both" | undefined
conditionalFormatting?
ConditionalFormatting | undefined
ChartAxisfrom @apertura/chart
interface ChartAxis
position
"l" | "r" | "b" | "t"
`c:axPos`: `l`, `r`, `b` or `t`.
kind
"category" | "value" | "date" | "series"
Whether the axis is a category axis, a value axis or a date axis.
deleted
boolean
`c:delete`, an axis that is present in the file and not on the page.
reversed
boolean
`c:scaling/c:orientation`; `maxMin` reverses the axis.
numberFormat
string | undefined
`c:numFmt/@formatCode`, the format the tick labels are printed in.
labelled
boolean
Whether tick labels are drawn at all, from `c:tickLblPos`.
line
DiagramOutline | undefined
The axis line itself, `c:spPr/a:ln`.
text
ChartTextStyle | undefined
`c:txPr`: the type its tick labels are set in.
majorTickMark
string | undefined
`c:majorTickMark`: `none`, `in`, `out` or `cross`.
crossBetween
string | undefined
`c:crossBetween`: whether the marks sit between the ticks or on them.
`between` puts a bar in the middle of its band, which is what a bar chart
wants; `midCat` puts a line's first point on the axis itself, which is what
a line chart wants and what makes its curve start at the left edge instead
of half a band in.
ChartDefinitionfrom @apertura/chart
interface ChartDefinition
A chart part, reduced to what is drawn.
legend
ChartLegendPosition | undefined
fill
DiagramColor | undefined
Fill of the whole chart area, `c:chartSpace/c:spPr`.
outline
DiagramOutline | undefined
plotFill
DiagramColor | undefined
Fill of the plot area, which is usually absent and then transparent.
blanks
"gap" | "zero" | "span"
`c:dispBlanksAs`: what a plot does where its data has a hole.
`gap` leaves the mark out, `zero` draws it on the floor, `span` joins across
it. Word's own default is `gap`, and a series of measurements taken weekly
with a fortnight missing looks entirely different under each of the three.
ChartPlotfrom @apertura/chart
interface ChartPlot
One `c:*Chart` inside the plot area.
direction
"bar" | "col"
`c:barDir`: `col` for vertical bars, `bar` for horizontal ones.
gapWidth
number
Space between category groups as a percentage of bar width, `c:gapWidth`.
overlap
number
How far bars of one category overlap, as a percentage, `c:overlap`.
holeSize
number
Hole of a doughnut as a percentage of its diameter, `c:holeSize`.
markers
boolean
Whether a line plot draws markers at its points.
varyColors
boolean
`c:varyColors`: paint each point of the plot differently.
What makes a one-series bar chart a row of coloured bars rather than a row
of identical ones, and it is on by default for a pie — where it is the only
thing that tells one slice from the next.
scatterStyle
string | undefined
`c:scatterStyle`: whether a scatter plot joins its points, and with what.
`marker` is a cloud of points with no line; `line` and `lineMarker` join
them with segments; `smooth` and `smoothMarker` with a curve.
showValues
boolean
Whether the plot asks for its values to be printed beside every mark.
axisIds
readonly string[]
Axis ids this plot is drawn against, in the order they were declared.
ChartPointfrom @apertura/chart
interface ChartPoint
One value of a series, with the point it belongs to.
ChartSeriesfrom @apertura/chart
interface ChartSeries
One series of a plot.
name
string | undefined
`c:tx`, the cached series name.
categories
readonly (string | undefined)[]
Category labels, from `c:cat`; sparse points are `undefined`.
values
readonly (number | undefined)[]
Values, from `c:val` or `c:yVal`.
xValues
readonly (number | undefined)[] | undefined
Horizontal values of a scatter or bubble plot, from `c:xVal`.
sizes
readonly (number | undefined)[] | undefined
Bubble sizes, from `c:bubbleSize`.
outline
DiagramOutline | undefined
invertIfNegative
boolean
`c:invertIfNegative`, a bar below zero drawn in the inverse of its fill.
pointFills
ReadonlyMap<number, DiagramColor>
`c:dPt`, one point painted differently from the rest of its series.
smooth
boolean
`c:smooth`, a line drawn as a spline rather than as segments.
marker
string | undefined
`c:marker/c:symbol`; `none` when the series asks for no marker.
showValues
boolean
Whether the series asked for its values to be printed beside the marks.
order
number
Order the series is drawn and listed in, `c:order`.
ColorReference
interface ColorReference
A colour as DrawingML writes it: a source plus modifiers on it.
srgb
string | undefined
Literal `RRGGBB`, from `a:srgbClr`.
scheme
string | undefined
Theme slot, from `a:schemeClr`.
luminanceModulation?
number | undefined
`a:lumMod`, in thousandths of a percent.
luminanceOffset?
number | undefined
`a:lumOff`, in thousandths of a percent.
alpha?
number | undefined
`a:alpha`, in thousandths of a percent; absent means opaque.
shade?
number | undefined
`a:shade`, in thousandths of a percent.
tint?
number | undefined
`a:tint`, in thousandths of a percent.
saturationModulation?
number | undefined
`a:satMod`, in thousandths of a percent.
saturationOffset?
number | undefined
`a:satOff`, in thousandths of a percent.
hueModulation?
number | undefined
`a:hueMod`, in thousandths of a percent.
hueOffset?
number | undefined
`a:hueOff`, in sixtieths of a thousandth of a degree.
grayscale?
boolean | undefined
`a:gray`: painted in shades of grey.
inverted?
boolean | undefined
`a:inv`: every channel inverted.
ConditionalFormatting
interface ConditionalFormatting
Which conditional table-style formats apply to a row, cell or paragraph.
Word encodes this as a bit string in `w:cnfStyle`; the decoded flags are what
the style resolver needs in order to layer `firstRow`, `band1Horz` and the
rest on top of the base table style.
ContentBlockNode
interface ContentBlockNode
A grouping node produced by flattening a structured document tag.
Content controls carry semantics (a date picker, a repeating section) that the
viewer does not act on, but discarding the wrapper entirely would lose the tag
name that documents and tooling rely on for navigation.
DiagramColorfrom @apertura/chart
interface DiagramColor
kind
"srgb" | "scheme" | "system"
`srgb` is literal, `scheme` refers to the theme, `system` to the host.
value
string
Hex digits, a theme slot name, or the last colour Word saw for a system slot.
transforms
readonly DiagramColorTransform[]
DiagramColorTransformfrom @apertura/chart
interface DiagramColorTransform
One transform applied to a colour, `a:lumMod` and its siblings.
Kept as a list rather than resolved fields because the transforms compose in
document order, and SmartArt relies on that: a colour list shifts hue,
saturation and luminance together to spread one accent colour across the
nodes of a diagram.
name
string
Local name, such as `lumMod`, `satOff`, `hueOff`, `alpha`, `tint`.
value
number
Percentages as a fraction; `hueMod` and `hueOff` in degrees.
DiagramDrawing
interface DiagramDrawing
DiagramFrame
interface DiagramFrame
A position and size in EMU, with the rotation applied about its centre.
rotation
number
Clockwise rotation in degrees.
DiagramOutlinefrom @apertura/chart
interface DiagramOutline
dash
string | undefined
`a:prstDash/@val`, such as `dash` or `sysDot`.
cap?
"round" | "square" | "flat" | undefined
`a:ln/@cap`: how the line ends, `rnd`, `sq` or flat.
join?
"round" | "bevel" | "miter" | undefined
`a:round`/`a:bevel`/`a:miter`: how two segments meet.
headEnd?
DiagramLineEnd | undefined
`a:headEnd` and `a:tailEnd`: what the line carries at each end.
An arrow is the difference between a diagram that says "A causes B" and one
that says the two are related: 185 lines of the corpus carry one, and drawn
without it a flow chart loses its direction.
tailEnd?
DiagramLineEnd | undefined
DiagramParagraph
interface DiagramParagraph
align
"left" | "center" | "right" | "justify" | undefined
level
number
Outline level, `a:pPr/@lvl`; zero for a top-level paragraph.
bullet
string | undefined
`a:buChar/@char`, or undefined when the paragraph is not bulleted.
indentEmu
number | undefined
First-line indent, negative for a hanging indent.
lineSpacing
number | undefined
`a:lnSpc/a:spcPct` as a fraction of a single line.
spaceBefore
number | undefined
`a:spcBef`/`a:spcAft` as a fraction of a line.
DiagramRun
interface DiagramRun
A run of text inside a diagram shape. Properties come from `a:rPr`.
sizePoints
number | undefined
Size in points; `a:rPr/@sz` is in hundredths of a point.
DiagramShape
interface DiagramShape
preset
string
`a:prstGeom/@prst`, defaulting to `rect`.
adjust
ReadonlyMap<string, number>
Adjust values, `a:avLst/a:gd`, keyed by name and in their raw units.
fill
DiagramColor | undefined
Solid fill colour; undefined for `a:noFill` and for fills not yet read.
outline
DiagramOutline | undefined
text
DiagramTextBody | undefined
DiagramTextBody
interface DiagramTextBody
frame
DiagramFrame
Where the text goes, `dsp:txXfrm`.
Separate from the shape's own frame because a preset shape rarely gives its
text the whole box: a chevron reserves the point, a callout the tail. Word
writes the solved rectangle so the reader does not have to know the
geometry of every preset.
anchor
"center" | "top" | "bottom"
paragraphs
readonly DiagramParagraph[]
DocumentSettings
interface DocumentSettings
Selected values from `settings.xml` that affect rendering.
defaultTabStopTwips
number
Default tab stop interval in twips, `w:defaultTabStop`.
evenAndOddHeaders
boolean
Even and odd pages use different headers, `w:evenAndOddHeaders`.
autoHyphenation
boolean
Automatic hyphenation is enabled for the document.
mirrorMargins
boolean
Mirror margins for double-sided printing, `w:mirrorMargins`.
trackRevisions
boolean
Whether tracked changes are being recorded.
footnoteNumberStart
number | undefined
Starting number of footnotes and endnotes.
footnotePosition
string | undefined
Where footnotes are placed, `w:footnotePr/w:pos`.
footnoteNumberFormat
string | undefined
`w:numFmt`: what the note marks are numbered with, document-wide.
footnoteRestart
string | undefined
`w:numRestart`: continuous, each page, or each section.
compatibility
ReadonlyMap<string, string>
Compatibility flags that change layout, `w:compat`.
decimalSymbol
string | undefined
Character used as the decimal separator in fields.
documentProtection
string | undefined
The document is protected; the viewer surfaces this as read-only.
colorSchemeMapping
ReadonlyMap<string, string>
Which theme slot each document colour slot actually names,
`w:clrSchemeMapping`.
A document says `w:themeColor="text1"` and the theme has no `text1`: it has
`dk1`, `lt1`, `dk2` and `lt2`, and this element is the map between them. The
identity mapping is the common case, which is why an implementation without
it looks right — until a document swaps them, as every template with a dark
background does, and then every heading is painted in the colour of the
paper it stands on.
themeFontLanguages
{ latin: string | undefined; eastAsia: string | undefined; complex: string | undefined; } | undefined
The languages the theme's font slots are chosen for, `w:themeFontLang`.
Word resolves `minorHAnsi` differently depending on which of the three
scripts the run is in, and this is what says which language each script is.
bordersSurroundHeader
boolean
Page borders are drawn around the header and the footer as well as the body.
`w:bordersDoNotSurroundHeader` and `w:bordersDoNotSurroundFooter`, inverted
so that the field reads as what happens rather than as what does not. Word's
default is that the border does surround them.
displayBackgroundShape
boolean
`w:displayBackgroundShape`: whether `w:background` is painted at all.
DocxDocument
interface DocxDocument extends AperturaDocument
A parsed Word document.
Everything needed to render, search or convert the document, and nothing that
depends on how it will be displayed. Headers, footers, footnotes and comments
are loaded lazily: a document may carry dozens of header parts of which a
given rendering uses two.
body
readonly BlockNode[]
Body content in document order.
finalSection
SectionProperties
Section properties of the final section, `w:body/w:sectPr`.
fonts
readonly FontDefinition[]
loadHeader
(relationshipId: string) => Promise<HeaderFooter | undefined>
Loads a header part by relationship id.
loadFooter
(relationshipId: string) => Promise<HeaderFooter | undefined>
loadFootnotes
() => Promise<ReadonlyMap<string, Note>>
Footnotes keyed by id; parsed on first access.
loadEndnotes
() => Promise<ReadonlyMap<string, Note>>
loadComments
() => Promise<ReadonlyMap<string, Comment>>
loadDiagram
(dataRelationshipId: string, ownerPart?: string) => Promise<DiagramDrawing | undefined>
Loads the shapes Word laid out for a SmartArt diagram, by its data part id.
diagram
(dataRelationshipId: string, ownerPart?: string) => DiagramDrawing | undefined
Returns a diagram already loaded, for use during synchronous rendering.
preloadDiagrams
(blocks: readonly BlockNode[], ownerPart?: string) => Promise<void>
Loads every diagram reachable from a set of blocks.
loadChart
(relationshipId: string, ownerPart?: string) => Promise<ChartDefinition | undefined>
Loads a chart part by the relationship id the drawing names it with.
chart
(relationshipId: string, ownerPart?: string) => ChartDefinition | undefined
Returns a chart already loaded, for use during synchronous rendering.
preloadCharts
(blocks: readonly BlockNode[], ownerPart?: string) => Promise<void>
Loads every chart reachable from a set of blocks.
resolveImage
(relationshipId: string, ownerPart?: string) => Promise<string | undefined>
Resolves a relationship id into an image URL.
resolveHyperlink
(relationshipId: string, ownerPart?: string) => string | undefined
Resolves a hyperlink relationship id into a URL.
outline
() => readonly OutlineEntry[]
Headings of the document, for a navigation pane.
bookmarks
() => ReadonlyMap<string, number>
Bookmark name → index of the block that contains it.
DrawingNode
interface DrawingNode
An image or shape produced by DrawingML, `w:drawing`.
relationshipId
string | undefined
Relationship id of the embedded image, `r:embed`.
linkRelationshipId
string | undefined
Relationship id of a linked (external) image, `r:link`.
description
string | undefined
Alt text for accessibility.
placement
"inline" | "anchor"
`inline` flows with text; `anchor` is positioned and wrapped.
wrap
DrawingWrap | undefined
Text wrapping mode of an anchored drawing.
rotation
number | undefined
Clockwise rotation in degrees.
crop
{ left: number; top: number; right: number; bottom: number; } | undefined
Source rectangle crop, as fractions of the image size.
textBox
readonly BlockNode[] | undefined
Content of a drawing that holds a text box rather than a picture.
diagramDataId
string | undefined
Relationship id of a SmartArt data part, `dgm:relIds/@r:dm`.
The shapes are not in this part; it is only the handle from which they can
be reached, so it is kept rather than the drawing itself, which lives in a
separate part and is loaded on demand.
chartId
string | undefined
Relationship id of the chart part, `c:chart/@r:id`.
A chart is stored only as its definition, so this is the whole of what the
drawing says about it: the frame's size, and the part that fills it.
effectExtent
{ left: number; top: number; right: number; bottom: number; } | undefined
Space reserved around the drawing for its effects, `wp:effectExtent`, in EMU.
Word adds it to the extent when it reserves room in the flow, so a drawing
with an effect extent starts that far inside the box the paragraph gave it.
shape
ShapeStyle | undefined
Fill, outline and geometry of a shape, `wps:spPr` composed with `wps:style`.
DrawingWrap
interface DrawingWrap
type
"none" | "square" | "tight" | "through" | "topAndBottom"
side
"left" | "right" | "both" | "largest" | undefined
distanceTopEmu
number
Distance Word keeps between the drawing and the text beside it, in EMU.
`distL` and `distR` default to a tenth of an inch for a wrapped drawing —
twelve pixels, not the nine a reader would get by rounding an eighth. Three
pixels sounds like nothing until every line beside every figure starts three
pixels off.
EmbeddedFontReference
interface EmbeddedFontReference
type
"regular" | "bold" | "italic" | "boldItalic"
fontKey
string | undefined
Obfuscation key; embedded fonts are XOR-scrambled with it.
FieldNode
interface FieldNode
A field: `PAGE`, `NUMPAGES`, `TOC`, `REF`, `HYPERLINK`, and so on.
Both the simple form (`w:fldSimple`) and the complex form (a `w:fldChar`
begin/separate/end sequence) are normalised into this single node, because the
distinction is a serialisation detail that no consumer should have to know
about. `result` holds the text Word last computed, which is what gets
displayed for any field the viewer does not evaluate itself.
instruction
string
The full instruction text, e.g. `PAGE \\* MERGEFORMAT`.
fieldType
string
Field type in upper case, e.g. `PAGE`; the first token of the instruction.
result
readonly InlineNode[]
Cached result as computed by Word.
FontDefinition
interface FontDefinition
A font declared in `fontTable.xml`.
pitch
string | undefined
Pitch: `fixed`, `variable` or `default`.
altName
string | undefined
Fonts Word will substitute if this one is unavailable.
charset
string | undefined
`w:charset` value, needed to interpret symbol fonts.
embedded
readonly EmbeddedFontReference[]
Embedded font references keyed by style.
FontReference
interface FontReference
The four script slots Word resolves a font family from.
ascii
string | undefined
Font for Latin text.
hAnsi
string | undefined
Font for high-ANSI text; usually equal to `ascii`.
eastAsia
string | undefined
Font for East Asian text.
cs
string | undefined
Font for complex-script text, which includes Arabic and Hebrew.
asciiTheme
string | undefined
Theme slots: `minorHAnsi`, `majorHAnsi`, and so on.
hint
"default" | "eastAsia" | "cs" | undefined
How the font of a symbol run is chosen, `w:hint`.
FrameProperties
interface FrameProperties
HyperlinkNode
interface HyperlinkNode
relationshipId
string | undefined
Relationship id pointing at an external URL.
anchor
string | undefined
Bookmark name for an internal link.
LineEnd
interface LineEnd
An arrowhead at one end of a line, `a:headEnd` and `a:tailEnd`.
type
string
`triangle`, `stealth`, `diamond`, `oval`, `arrow`, or `none`.
width
string | undefined
`sm`, `med` or `lg`; absent means medium.
LineNumbering
interface LineNumbering
Line numbering in the margin, `w:lnNumType`.
restart
"continuous" | "newPage" | "newSection" | undefined
MarkupSighting
interface MarkupSighting
One piece of markup nothing read, as the observer receives it.
key
string
`w:zoom`, or `w:spacing@w:beforeAutospacing`.
parent
string
Local name of the element it was found in.
reason
string | undefined
Why it is passed over, when the register says so.
MathElement
interface MathElement
A node of the OMML tree, kept close to the source markup.
name
string
Local name of the OMML element, e.g. `f` for a fraction.
text?
string | undefined
Text content for `m:t` nodes.
children?
readonly MathElement[] | undefined
attributes?
Readonly<Record<string, string>> | undefined
Selected attributes needed for rendering, e.g. delimiter characters.
properties?
RunProperties | undefined
MathNode
interface MathNode
An Office Math (OMML) expression, converted to MathML by the renderer.
display
"inline" | "block"
`inline` for `m:oMath`, `block` for `m:oMathPara`.
Measurement
interface Measurement
A measurement together with the unit it was declared in, `ST_TblWidth`.
type
"auto" | "nil" | "dxa" | "pct"
`dxa` twips, `pct` fiftieths of a percent, `auto`, `nil`.
Note
interface Note
A footnote or endnote.
type
"normal" | "separator" | "continuationSeparator" | "continuationNotice"
`normal` is a real note; `separator` and `continuationSeparator` are chrome.
NoteReferenceNode
interface NoteReferenceNode
kind
NodeKind.FootnoteReference | NodeKind.EndnoteReference
customMark
boolean
A custom mark suppresses automatic numbering.
mark?
boolean | undefined
The number printed at the head of the note itself, `w:footnoteRef`.
The same number as the reference in the body, in the place and the type the
note's own text puts it — which is not always at the very start, and is
never in the type the body used. It carries no id: the note it belongs to
is the one it is written inside.
NumberingCounterState
interface NumberingCounterState
counters
ReadonlyMap<string, number>
NumberingDefinitions
interface NumberingDefinitions
The parsed contents of `numbering.xml`.
abstract
ReadonlyMap<number, AbstractNumbering>
instances
ReadonlyMap<number, NumberingInstance>
pictureBullets
ReadonlyMap<number, PictureBullet>
NumberingInstance
interface NumberingInstance
A concrete list instance, `w:num`.
Paragraphs reference instances, not abstract definitions. The indirection
exists so two lists can share formatting while numbering independently, and it
is also where per-instance level overrides live.
overrides
ReadonlyMap<number, NumberingLevelOverride>
Level overrides applied on top of the abstract definition.
NumberingLevel
interface NumberingLevel
One level of a list definition, `w:lvl`.
level
number
Zero-based level index, 0..8.
text
string
Number text pattern, `w:lvlText`.
Placeholders `%1`..`%9` are substituted with the counter of the
corresponding level, which is what produces "1.2.3" style numbering.
alignment
"left" | "center" | "right" | undefined
styleId
string | undefined
Paragraph style this level is attached to, `w:pStyle`.
paragraph
ParagraphProperties | undefined
Indentation and tab settings for the level.
run
RunProperties | undefined
Formatting of the number itself.
restart
number | undefined
Level after which the counter restarts, `w:lvlRestart`.
pictureBulletId
number | undefined
Picture bullet id, `w:lvlPicBulletId`.
isLegal
boolean
The level is a legal-numbering variant, `w:isLgl`.
legacy
{ readonly indentTwips: number | undefined; readonly spaceTwips: number | undefined; } | undefined
Word 6 numbering compatibility, `w:legacy`.
A list converted from a document old enough to predate `w:numPr` keeps its
original geometry: the number sits in a box of a stated width and the text
is indented by a stated amount, rather than the number hanging in the
paragraph's own indent. Ignoring it moves every line of such a list.
NumberingLevelOverride
interface NumberingLevelOverride
startOverride
number | undefined
Restart value, `w:startOverride`.
definition
NumberingLevel | undefined
A fully redefined level.
NumberingReference
interface NumberingReference
numberingId
number
`w:numId`, referencing an instance in `numbering.xml`.
level
number
Zero-based list level, `w:ilvl`.
NumberLabel
interface NumberLabel
The computed label of one numbered paragraph.
text
string
The rendered text, e.g. `2.3.` or `•`.
suffix
"tab" | "space" | "nothing"
What separates the label from the paragraph text.
level
NumberingLevel
The level definition the label came from.
value
number
The raw counter value, useful for cross references.
OpenDocxOptions
interface OpenDocxOptions extends OpenOptions
Options accepted when opening a Word document.
keepDeletedContent?
boolean | undefined
Keep content marked deleted by revision tracking. Off by default.
parseMath?
boolean | undefined
Parse OMML equations. On by default.
maxCacheBytes?
number | undefined
Maximum bytes of inflated package parts held in memory.
Defaults to 64 MB. Raising it speeds up documents whose images are viewed
repeatedly; lowering it bounds memory on very large files.
Outline
interface Outline
How the edge of a shape is drawn, `a:ln`.
widthEmu
number | undefined
Line width in EMU, `a:ln/@w`; absent means the theme's.
dash?
string | undefined
`a:prstDash/@val`, the pattern by name: `dash`, `sysDot`, `lgDashDot`…
cap?
"round" | "square" | "flat" | undefined
`a:ln/@cap`: how the line ends.
join?
"round" | "bevel" | "miter" | undefined
The corner treatment: `a:miter`, `a:round` or `a:bevel`.
OutlineEntry
interface OutlineEntry
An entry of the document outline, derived from heading paragraphs.
level
number
Heading level, 1..9.
blockIndex
number
Index of the paragraph in the flattened body, for navigation.
bookmark
string | undefined
Bookmark name when the heading carries one.
PageBorders
interface PageBorders
The frame Word draws round a page, `w:pgBorders`.
Where it sits is as much a part of it as which edges are drawn: the same
border set measured from the paper and measured from the text is two
different frames, one round the sheet and one round the type area.
offsetFrom
"page" | "text"
`page` measures each edge's `w:space` from the paper, `text` from the type area.
display
"allPages" | "firstPage" | "notFirstPage"
Which pages get the frame, `w:display`.
PageMargins
interface PageMargins
headerTwips
number
Distance from the page edge to the header, `w:header`.
gutterTwips
number
Extra binding margin, `w:gutter`.
PageNumbering
interface PageNumbering
Page number format for the section, `w:pgNumType`.
PageSize
interface PageSize
ParagraphNode
interface ParagraphNode
sectionProperties
SectionProperties | undefined
Section properties attached to this paragraph mark.
Present only on the last paragraph of a section; it defines the page setup
of the section that *ends* here, which is the part of the format that most
often trips up implementations.
ParagraphProperties
interface ParagraphProperties
Paragraph-level formatting, `w:pPr`.
styleId?
string | undefined
Paragraph style id, `w:pStyle`.
indentLeftTwips?
number | undefined
Left indent in twips; `w:start` in newer files.
indentFirstLineTwips?
number | undefined
First-line indent in twips.
Mutually exclusive with {@link indentHangingTwips}: Word writes one or the
other, and a hanging indent is a negative first-line indent applied together
with a matching left indent.
indentLeftChars?
number | undefined
The same four indents in hundredths of a character, `w:leftChars` and kin.
A character is as wide as the paragraph's font makes it, which is why East
Asian documents measure indents this way: two characters must stay two
characters at any size. Word prefers this form where both are written, and
only the renderer knows the font size that turns it into a length.
spaceBeforeAuto?
boolean | undefined
Automatic spacing overrides the explicit value when set.
lineSpacing?
number | undefined
Line spacing; interpretation depends on {@link lineSpacingRule}.
lineSpacingRule?
LineSpacingRule | undefined
contextualSpacing?
boolean | undefined
Suppress spacing between paragraphs of the same style, `w:contextualSpacing`.
wordWrap?
boolean | undefined
Whether a line may break only between words, `w:wordWrap`.
On by default and interesting only when a paragraph turns it off: Word then
breaks a line inside a word rather than let it hang past the margin. A
narrow column of a URL, a table cell holding a long identifier, and East
Asian text set in a measure narrower than one of its words all rely on it —
without it the word overhangs the column and the page reads as one whose
text does not fit its own frame.
autoSpaceLatin?
boolean | undefined
Space automatically inserted between East Asian and Latin text,
`w:autoSpaceDE`; and between East Asian text and digits, `w:autoSpaceDN`.
Both are on unless the paragraph turns them off, which is why they are
modelled as "off when false" rather than "on when true".
snapToGrid?
boolean | undefined
Whether the paragraph's lines sit on the document grid, `w:snapToGrid`.
On unless the paragraph says otherwise, and only meaningful where the
section declares a grid.
kinsoku?
boolean | undefined
East Asian line-breaking rules, `w:kinsoku`.
On by default, and what stops a line from ending in an opening bracket or
beginning with a full stop. CSS says the same thing as `line-break`, so the
rule reaches the page rather than only the model.
overflowPunctuation?
boolean | undefined
`w:overflowPunct`: punctuation may hang past the margin rather than wrap.
topLinePunctuation?
boolean | undefined
`w:topLinePunct`: punctuation is compressed at the start of a line.
adjustRightIndent?
boolean | undefined
`w:adjustRightInd`: the right indent is adjusted to the document grid.
Only meaningful with `w:docGrid`, which is what makes it an East Asian
setting written into western documents by every converter that has ever
touched one.
suppressOverlap?
boolean | undefined
`w:suppressOverlap`: a framed paragraph may not overlap another.
tabs?
readonly TabStop[] | undefined
numbering?
NumberingReference | undefined
List membership, `w:numPr`.
outlineLevel?
number | undefined
Outline level 0..8 as stored; 9 means body text.
markRunProperties?
RunProperties | undefined
Formatting of the paragraph mark itself, `w:pPr/w:rPr`.
conditionalFormatting?
ConditionalFormatting | undefined
Conditional formatting flags inherited from the table style.
textAlignment?
"center" | "top" | "bottom" | "baseline" | "auto" | undefined
revision?
RevisionInfo | undefined
Set when the paragraph mark is part of a tracked change.
frame?
FrameProperties | undefined
Frame properties for a text frame, `w:framePr`.
PictureBullet
interface PictureBullet
A picture used as a bullet, `w:numPicBullet`.
relationshipId
string | undefined
Relationship id of the image.
PictureFill
interface PictureFill
A picture used as a fill rather than drawn as itself, `a:blipFill`.
crop
{ left: number; top: number; right: number; bottom: number; } | undefined
`a:srcRect`, as fractions of the source size.
mode
"stretch" | "tile"
`a:stretch` fills the box with one copy; `a:tile` repeats the picture.
The distinction is not decoration: a tiled logo at its natural size and the
same logo stretched over a full-width banner are different pictures on the
page, and the tiled one is what a watermark and every textured panel use.
tileScaleX
number | undefined
Scale of one tile, from `a:tile/@sx` and `@sy`, as a fraction.
ResolvedStyle
interface ResolvedStyle
The fully resolved property sets of a style chain.
chain
readonly Style[]
The chain itself, from the requested style up to the root.
RevisionInfo
interface RevisionInfo
Tracked-change metadata attached to a run, paragraph mark, row or cell.
type
"inserted" | "deleted" | "formatChange" | "moveFrom" | "moveTo"
RevisionNode
interface RevisionNode
A tracked insertion or deletion wrapping inline content.
RowProperties
interface RowProperties
Row-level formatting, `w:trPr`.
heightTwips?
number | undefined
Row height in twips together with its rule.
heightRule?
"auto" | "exact" | "atLeast" | undefined
isHeader?
boolean | undefined
Repeat this row as a header on every page, `w:tblHeader`.
cantSplit?
boolean | undefined
Forbid splitting the row across pages, `w:cantSplit`.
gridBefore?
number | undefined
Grid cells skipped before the first cell, `w:gridBefore`.
conditionalFormatting?
ConditionalFormatting | undefined
tableExceptions?
TableProperties | undefined
Table properties this row overrides, `w:tblPrEx`.
Word writes them when rows of one table came from two tables that were
joined: the second keeps its own borders, cell margins and indent, and the
table's own `w:tblPr` no longer describes it. Read as the table's, such a
row draws the wrong rules and sits at the wrong indent — and since the
overrides are almost always borders, the visible result is a table whose
lower half is gridded and whose upper half is not.
RunProperties
interface RunProperties
Character-level formatting, `w:rPr`.
styleId?
string | undefined
Character style id, `w:rStyle`.
fonts?
FontReference | undefined
hidden?
boolean | undefined
Hidden text, `w:vanish`.
color?
string | undefined
Colour as `RRGGBB` or `auto`.
themeShade?
string | undefined
Theme colour luminance modulation, thousandths of a percent.
sizeHalfPoints?
number | undefined
Font size in half-points, `w:sz`.
highlight?
string | undefined
Named highlight colour, `w:highlight`.
spacingTwips?
number | undefined
Character spacing in twips, `w:spacing`; may be negative.
scalePercent?
number | undefined
Horizontal scaling as a percentage, `w:w`.
positionHalfPoints?
number | undefined
Baseline offset in half-points, `w:position`; positive raises the text.
kerningHalfPoints?
number | undefined
Minimum size in half-points at which kerning applies, `w:kern`.
verticalAlign?
"baseline" | "superscript" | "subscript" | undefined
rtl?
boolean | undefined
Right-to-left run, `w:rtl`.
emphasisMark?
"none" | "dot" | "comma" | "circle" | "underDot" | undefined
Emphasis mark placed above or below the text, `w:em`.
language?
string | undefined
Language tags, used for spell-check and for correct hyphenation.
fitTextTwips?
number | undefined
Text is stretched to fit the given width in twips, `w:fitText`.
snapToGrid?
boolean | undefined
`w:snapToGrid`: the run's characters sit on the document grid.
textOutline?
{ readonly widthEmu: number | undefined; readonly color: ColorReference | undefined; } | undefined
`w14:textOutline`: the glyphs are drawn as outlines.
A heading set in outline and one set solid are the same markup apart from
this element, and dropping it paints a hollow title in solid black.
textFill?
Fill | undefined
`w14:textFill`: what the inside of the glyphs is painted with.
textShadow?
ShapeShadow | undefined
`w14:shadow`: the one text effect a page draws without a filter.
complexScript?
boolean | undefined
`w:cs`: the run is set in a complex script.
Which of two sets of properties applies to it — `w:bCs` and `w:iCs` rather
than `w:b` and `w:i`, and the complex-script size rather than `w:sz`.
revision?
RevisionInfo | undefined
Set when the run is inside a tracked insertion or deletion.
SectionProperties
interface SectionProperties
pageNumbering
PageNumbering | undefined
lineNumbering
LineNumbering | undefined
headers
readonly HeaderFooterReference[]
footers
readonly HeaderFooterReference[]
titlePage
boolean
The first page uses a distinct header and footer, `w:titlePg`.
verticalAlignment
"center" | "top" | "bottom" | "both" | undefined
Vertical alignment of text on the page, `w:vAlign`.
rtl
boolean
Right-to-left section, `w:bidi`.
documentGrid
{ type: string; linePitchTwips: number; } | undefined
Distance between the text grid lines, used by East Asian layouts.
textDirection?
string | undefined
The direction the section's text runs in, `w:textDirection`.
`tbRl` and `tbRlV` are vertical setting: the lines run top to bottom and
the columns right to left, so the page's width and height swap roles. It is
a property of the section rather than of any paragraph in it.
footnoteProperties?
SectionNoteProperties | undefined
Footnote and endnote numbering stated for this section alone.
endnoteProperties?
SectionNoteProperties | undefined
suppressEndnotes?
boolean | undefined
`w:noEndnote`: endnotes are suppressed in this section.
Shading
interface Shading
pattern
ShadingPattern | undefined
fill
string | undefined
Background colour as `RRGGBB`, or `auto`.
color
string | undefined
Pattern foreground colour.
themeFillTint
string | undefined
Lightening applied to `themeFill`, `w:themeFillTint`; `FF` means none.
themeFillShade
string | undefined
Darkening applied to `themeFill`, `w:themeFillShade`; `FF` means none.
themeTint
string | undefined
Lightening applied to `themeColor`, `w:themeTint`.
themeShade
string | undefined
Darkening applied to `themeColor`, `w:themeShade`.
ShapeShadow
interface ShapeShadow
An outer shadow cast by a shape, `a:effectLst/a:outerShdw`.
directionDegrees
number
Degrees clockwise from east, the direction the shadow falls in.
color
ColorReference | undefined
ShapeStyle
interface ShapeStyle
The visual style of a DrawingML shape.
geometry
string | undefined
`a:prstGeom/@prst`, or `custom` for a `a:custGeom`.
geometryDetail?
DiagramGeometry | undefined
The geometry as DrawingML states it: adjust values, or the outline itself.
The name alone says a shape is not a rectangle; this says what it is, and
it is the same record a slide and a worksheet carry, drawn by the same
code. Before it, a chevron in a document was a box.
shadow?
ShapeShadow | undefined
`a:effectLst/a:outerShdw`, the only effect a page shows without a filter.
insets
{ left: number; top: number; right: number; bottom: number; } | undefined
Text insets of `wps:bodyPr`, in EMU.
verticalAlignment
"center" | "top" | "bottom" | undefined
Vertical anchor of the text inside the shape, `wps:bodyPr/@anchor`.
textDirection?
string | undefined
`wps:bodyPr/@vert`: the direction the text in the box is set in.
A writing mode rather than a rotation — the lines still stack, they stack
across the box instead of down it — which is what a title down the edge of
a cover page is, and what a rotated `div` would get wrong.
fontColor
ColorReference | undefined
Colour the shape's theme reference gives its text, `a:fontRef`.
StrictMarkupOptions
interface StrictMarkupOptions
What strict mode refuses to walk past.
attributes?
boolean | undefined
Stop on an unaccounted attribute as well as an unaccounted element.
Style
interface Style
A named style from `styles.xml`.
name
string
Display name, `w:name`; what the user sees in the Word style gallery.
basedOn
string | undefined
Parent style id, `w:basedOn`.
next
string | undefined
Style applied to the following paragraph, `w:next`.
link
string | undefined
Paired character style of a paragraph style, `w:link`.
semiHidden
boolean
Hidden from the UI but still applicable.
paragraph
ParagraphProperties | undefined
run
RunProperties | undefined
table
TableProperties | undefined
row
RowProperties | undefined
cell
CellProperties | undefined
tableOverrides
readonly TableStyleOverride[]
Conditional blocks; present on table styles only.
StyleSheet
interface StyleSheet
The complete style table of a document.
Holds both the named styles and the document defaults, which sit at the bottom
of the cascade and are the reason an empty paragraph still has a font.
styles
ReadonlyMap<string, Style>
defaultParagraph
ParagraphProperties | undefined
`w:docDefaults/w:pPrDefault`.
defaultParagraphDeclared
boolean
Whether the package wrote a `w:pPrDefault` at all, empty or not.
Not the same question as whether it holds anything. An empty element is a
statement — the defaults are the format's own, single spaced with no gap —
where its absence leaves the question to Word, which answers with the
defaults of its blank template. See `BUILT_IN_PARAGRAPH_DEFAULTS`.
defaultRun
RunProperties | undefined
`w:docDefaults/w:rPrDefault`.
defaultStyleIds
Readonly<Record<StyleType, string | undefined>>
Id of the style marked default for each type.
byName
ReadonlyMap<string, Style>
Look-up by display name, needed because numbering references styles by name.
latentStyleCount
number
Latent style defaults; controls visibility of styles not defined explicitly.
SymbolNode
interface SymbolNode
A character from a symbol font, `w:sym`.
char
number
Character code, usually in the private use area (0xF000 and up).
TableCellNode
interface TableCellNode
TableCellPosition
interface TableCellPosition
Where a cell sits in its table, used to select conditional formats.
headerRowCount
number
Number of header rows, which shifts band numbering.
explicit?
ConditionalFormatting | undefined
Explicit flags from `w:cnfStyle`, which override positional inference.
TableFloatPosition
interface TableFloatPosition
TableLook
interface TableLook
noHorizontalBanding
boolean
When true, row banding is suppressed.
TableNode
interface TableNode
grid
readonly number[]
Column widths in twips from `w:tblGrid`.
TableProperties
interface TableProperties
Table-level formatting, `w:tblPr`.
cellMargins?
CellMargins | undefined
Default cell margins, `w:tblCellMar`.
cellSpacing?
Measurement | undefined
Spacing between cells, `w:tblCellSpacing`.
layout?
"fixed" | "autofit" | undefined
`fixed` or `autofit`, `w:tblLayout`.
look?
TableLook | undefined
Which conditional formats the table style should apply, `w:tblLook`.
bidiVisual?
boolean | undefined
Right-to-left column order, `w:bidiVisual`.
floatPosition?
TableFloatPosition | undefined
Floating table position, `w:tblpPr`.
allowOverlap?
boolean | undefined
`w:tblOverlap`: whether a floating table may be overlapped by another.
TableRowNode
interface TableRowNode
TableStyleContext
interface TableStyleContext
Formatting contributed by a table style to the content of one cell.
cacheKey
string
Identifies this context for caching.
TableStyleOverride
interface TableStyleOverride
One conditional block of a table style.
paragraph
ParagraphProperties | undefined
run
RunProperties | undefined
table
TableProperties | undefined
row
RowProperties | undefined
cell
CellProperties | undefined
TabNode
interface TabNode
position?
{ readonly alignment: "left" | "center" | "right"; readonly relativeTo: string; readonly leader: string | undefined; } | undefined
An absolute position tab, `w:ptab`, which names a place rather than a stop.
Ordinary tabs advance to the next stop on the ruler; this one goes to the
left, the middle or the right of the text column whatever the ruler says,
which is how a running head puts a title on the left and a page number on
the right without either being declared anywhere.
TabStop
interface TabStop
Tab stop, `w:tab`.
alignment
"left" | "center" | "right" | "bar" | "start" | "end" | "clear" | "decimal"
positionTwips
number
Position in twips from the left text margin.
leader
"none" | "dot" | "hyphen" | "underscore" | "heavy" | "middleDot" | undefined
Leader character drawn in the space before the stop.
TextColumn
interface TextColumn
TextNode
interface TextNode
properties
RunProperties
Formatting shared with other runs; interned by the parser.
Theme
interface Theme
colorScheme
ThemeColorScheme | undefined
fontScheme
ThemeFontScheme | undefined
ThemeColorScheme
interface ThemeColorScheme
A theme colour scheme, from `theme1.xml`.
colors
ReadonlyMap<string, string>
Slot name (`accent1`, `dk1`, `lt2`, ...) → `RRGGBB`.
ThemeFontScheme
interface ThemeFontScheme
majorLatin
string | undefined
Font of the heading slot, used by `majorHAnsi` references.
Underline
interface Underline
VmlShapeNode
interface VmlShapeNode
A legacy VML shape, `w:pict`. Word still writes these for text boxes.
style
string | undefined
Inline CSS-like style string from the VML `style` attribute.
textBox
readonly BlockNode[] | undefined
textBoxInset
{ left: number; top: number; right: number; bottom: number; } | undefined
Padding inside the text box, `v:textbox/@inset`, in points.
Word's default is a tenth of an inch at the sides and half that above and
below, and a converter that wants none says so. Assuming a constant instead
is not a rounding error: a badge 49 points wide whose text is indented 31
points has eighteen points to set two digits in, and ten points of invented
padding leaves too few — the number then wraps one digit per line.
path
string | undefined
The shape's own outline, `v:shape/@path`, in its own coordinate space.
A converter does not use the preset shapes: it writes every circle, rounded
panel and arrow as an explicit polygon. Drawn as the rectangle it occupies,
a circle is a square — which is what a page number in a round badge looks
like on every page of a converted report.
pathBox
{ originX: number; originY: number; width: number; height: number; } | undefined
The coordinate space `path` is drawn in, `@coordsize` and `@coordorigin`.
strokeStyle?
VmlStroke | undefined
How the outline is drawn, `v:stroke`.
crop?
{ left: number; top: number; right: number; bottom: number; } | undefined
`v:imagedata` crop fractions, the VML spelling of `a:srcRect`.
A logo cropped to its wordmark and the same logo drawn whole are the same
relationship id and two different pictures on the page.
shadow?
{ color: string | undefined; offsetXPoints: number; offsetYPoints: number; } | undefined
`v:shadow`, offsets in points.
wordArtText?
string | undefined
The text of a WordArt shape, `v:textpath/@string`.
Not a text box: WordArt carries its text as an attribute of the shape, so a
reader that walks past `v:textpath` loses the words entirely — and WordArt
is what a converted document uses for its title.
wordArtStyle?
string | undefined
The font `v:textpath/@style` sets that text in, as a CSS style string.
children
readonly VmlShapeNode[] | undefined
Shapes of a `v:group`, positioned inside its box.
A group is a coordinate system: it declares a box on the page in real units
and a grid inside it in arbitrary ones, and its children give their places
in that grid. Keeping the group as a node rather than flattening it into
page positions is what makes an *inline* group work — a badge sitting in a
line of text is a group too, and a flattened one would be torn out of the
flow and pinned to the corner of the paragraph.
A child's `floating` offsets are measured from the group's own box, not
from the page.
floating
VmlFloat | undefined
How the shape sits in the text, the VML counterpart of `wp:inline` and
`wp:anchor`.
Undefined for a shape that flows with the text. A floating shape is the
common case in documents produced by converters, which use a page-sized
rectangle behind the text for the background of a cover page.
Type aliases
Alignment
type Alignment = 'left' | 'center' | 'right' | 'justify' | 'distribute' | 'start' | 'end'
BlockNode
type BlockNode = ParagraphNode | TableNode | AltChunkNode | ContentBlockNode
BorderStyle
type BorderStyle = | 'none'
| 'nil'
| 'single'
| 'thick'
| 'double'
| 'dotted'
| 'dashed'
| 'dotDash'
| 'dotDotDash'
| 'triple'
| 'thinThickSmallGap'
| 'thickThinSmallGap'
| 'thinThickThinSmallGap'
| 'thinThickMediumGap'
| 'thickThinMediumGap'
| 'thinThickThinMediumGap'
| 'thinThickLargeGap'
| 'thickThinLargeGap'
| 'thinThickThinLargeGap'
| 'wave'
| 'doubleWave'
| 'dashSmallGap'
| 'dashDotStroked'
| 'threeDEmboss'
| 'threeDEngrave'
| 'outset'
| 'inset'
Border style, `ST_Border`.
BreakType
type BreakType = 'line' | 'page' | 'column'
ChartGroupingfrom @apertura/chart
type ChartGrouping = 'clustered' | 'stacked' | 'percentStacked' | 'standard'
`c:grouping`, which decides whether values stack.
ChartKindfrom @apertura/chart
type ChartKind = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'scatter' | 'bubble' | 'radar' | 'stock' | 'surface'
How the marks of one plot are laid out.
ChartLegendPositionfrom @apertura/chart
type ChartLegendPosition = 'l' | 'r' | 't' | 'b' | 'tr'
Where the legend goes, `c:legendPos`.
Fill
type Fill = | { readonly kind: 'none' }
| { readonly kind: 'solid'; readonly color: ColorReference | undefined }
| {
readonly kind: 'gradient';
readonly stops: readonly {
readonly position: number;
readonly color: ColorReference | undefined;
}[];
/** Degrees clockwise from east, from `a:lin/@ang`. */
readonly angle: number | undefined;
/** `a:path/@path` for a radial or rectangular gradient; absent means linear. */
readonly path: 'circle' | 'rect' | 'shape' | undefined;
}
| PictureFill
| {
/** `a:pattFill`: a two-colour hatch named by preset. */
readonly kind: 'pattern';
readonly preset: string | undefined;
readonly foreground: ColorReference | undefined;
readonly background: ColorReference | undefined;
}
/**
* `a:grpFill`: whatever the enclosing group is filled with.
*
* Kept rather than resolved, because the group is not in scope here — a shape
* is parsed before anything knows what contains it — and because "inherit"
* and "no fill" are different answers that a reader collapsing them would
* paint the same.
*/
| { readonly kind: 'group' }
How the interior of a shape is painted.
InlineNode
type InlineNode = | TextNode
| BreakNode
| TabNode
| SymbolNode
| DrawingNode
| VmlShapeNode
| HyperlinkNode
| BookmarkStartNode
| BookmarkEndNode
| NoteReferenceNode
| CommentReferenceNode
| CommentRangeNode
| FieldNode
| MathNode
| RubyNode
| RevisionNode
LineSpacingRule
type LineSpacingRule = 'auto' | 'exact' | 'atLeast'
Line spacing rule, `w:spacing/@w:lineRule`.
NumberFormat
type NumberFormat = | 'decimal'
| 'upperRoman'
| 'lowerRoman'
| 'upperLetter'
| 'lowerLetter'
| 'ordinal'
| 'cardinalText'
| 'ordinalText'
| 'bullet'
| 'none'
| 'decimalZero'
| 'decimalEnclosedCircle'
| 'decimalEnclosedFullstop'
| 'decimalEnclosedParen'
| 'chicago'
| 'russianLower'
| 'russianUpper'
| 'hebrew1'
| 'hebrew2'
| 'aiueo'
| 'iroha'
| 'japaneseCounting'
| 'chineseCounting'
| 'koreanCounting'
| 'taiwaneseCounting'
Number format of a list level, `ST_NumberFormat`.
Only the values that actually occur in documents are enumerated; the schema
defines several dozen more for East Asian numbering systems, which fall back
to decimal.
NumberSuffix
type NumberSuffix = 'tab' | 'space' | 'nothing'
What separates the number from the paragraph text, `w:suff`.
SectionStart
type SectionStart = 'continuous' | 'nextPage' | 'nextColumn' | 'evenPage' | 'oddPage'
How a section starts relative to the previous one, `w:type`.
ShadingPattern
type ShadingPattern = | 'nil'
| 'clear'
| 'solid'
| 'horzStripe'
| 'vertStripe'
| 'reverseDiagStripe'
| 'diagStripe'
| 'horzCross'
| 'diagCross'
| 'thinHorzStripe'
| 'thinVertStripe'
| 'thinReverseDiagStripe'
| 'thinDiagStripe'
| 'thinHorzCross'
| 'thinDiagCross'
| 'pct5'
| 'pct10'
| 'pct12'
| 'pct15'
| 'pct20'
| 'pct25'
| 'pct30'
| 'pct35'
| 'pct37'
| 'pct40'
| 'pct45'
| 'pct50'
| 'pct55'
| 'pct60'
| 'pct62'
| 'pct65'
| 'pct70'
| 'pct75'
| 'pct80'
| 'pct85'
| 'pct87'
| 'pct90'
| 'pct95'
Fill pattern, `ST_Shd`.
StyleType
type StyleType = 'paragraph' | 'character' | 'table' | 'numbering'
TableStyleOverrideType
type TableStyleOverrideType = | 'wholeTable'
| 'firstRow'
| 'lastRow'
| 'firstCol'
| 'lastCol'
| 'band1Vert'
| 'band2Vert'
| 'band1Horz'
| 'band2Horz'
| 'neCell'
| 'nwCell'
| 'seCell'
| 'swCell'
Conditional formatting slot of a table style, `w:tblStylePr/@w:type`.
A table style is not one set of properties but up to thirteen, each applying
to a different region of the table. Getting banding and header rows right is
impossible without modelling them separately.
UnderlineStyle
type UnderlineStyle = | 'none'
| 'single'
| 'words'
| 'double'
| 'thick'
| 'dotted'
| 'dottedHeavy'
| 'dash'
| 'dashedHeavy'
| 'dashLong'
| 'dashLongHeavy'
| 'dotDash'
| 'dashDotHeavy'
| 'dotDotDash'
| 'dashDotDotHeavy'
| 'wave'
| 'wavyHeavy'
| 'wavyDouble'
Text underline, `ST_Underline`.