A paragraph with both `heading` and `style` wrote a w:pStyle for each, and
CT_PPrBase has one, so the Open XML SDK validator rejected the document.
Word applies the last of the two, `style`, so `style` now takes the place
of `heading`, and Word shows the paragraph as it did. The layout module and
the table of contents' heading entries read the first w:pStyle, the
heading, and now read the style Word shows.
The ListParagraph that a bullet or numbered paragraph gets without a style
of its own goes in the same if/else.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: explain that wordWrap lets lines break inside words
The option writes <w:wordWrap w:val="0"/>, Word's "Allow Latin text to
wrap in the middle of a word", so Word also breaks Korean words when it
is set. Say so in the option's JSDoc and the demo comment, as
docs/usage/layout.md already does.
* docs: note that an unset wordWrap keeps the style's setting
* docs: limit the wordWrap default note to space-separated text
* docs: say that wordWrap breaks only the words of East Asian runs
w:wordWrap w:val="0" lets Word break inside the words of runs in an East
Asian font or language, as docs/usage/layout.md and docx/layout's
isEastAsianRun have it. Words in other runs, such as English in Calibri,
still break at their spaces. The demo's comment says so too, and that an
unset wordWrap keeps words whole only when the paragraph's style doesn't
set it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: leave ListParagraph off a bullet paragraph that has its own style
* docs: say when a bullet paragraph is given ListParagraph
The bullet option's JSDoc didn't say that a bullet paragraph takes Word's
ListParagraph style, nor that one with a style or heading of its own keeps
that, as a numbered paragraph does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A paragraph with both options got a w:pBdr from each, and CT_PPrBase has
one, so the Open XML SDK validator rejects the document. The same went for
paragraph styles, and for htmlToContent with an <hr> in a <div> with a
border.
The thematic break's line is now written in the w:pBdr of border, in place
of its bottom, as Word reads the two elements: ThematicBreak extends Border
and takes the paragraph's other borders. The layout module, which read only
the first w:pBdr, now gives the line its room, as Word does.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A paragraph's revision takes the paragraph's options, run included, and run
was written as w:rPr in the w:pPr of w:pPrChange. That w:pPr is a CT_PPrBase,
which has no rPr, so the Open XML SDK validator rejects the document.
run is kept in IParagraphPropertiesChangeOptions, deprecated, and has no
effect. The earlier formatting of the paragraph mark goes in revision of the
paragraph's own run, which writes w:rPrChange. The change tracking docs now
show that, and the JSDoc of the paragraph's run says it formats the paragraph
mark rather than the paragraph's runs.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: write a paragraph mark's w:ins and w:del before its formatting
A paragraph's run options format the paragraph mark, and their insertion and
deletion mark the paragraph mark as inserted or deleted. ParagraphRunProperties
added w:ins and w:del after everything RunProperties writes, so with any
formatting, or a revision, they came after it. CT_ParaRPr puts them first,
before the formatting and w:rPrChange, so the Open XML SDK validator rejects
such a document for every version of Office. Word opens it either way.
They now come first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: describe a paragraph mark's insertion and deletion options
insertion and deletion on IParagraphRunPropertiesOptions had no JSDoc. On
a paragraph mark they mean a paragraph break typed with track changes on,
and one whose deletion joins the paragraph to the next when accepted. The
JSDoc says so, and where each is written in the mark's w:rPr.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
* perf: write XML in one pass without an intermediate tree
* perf: prepare children in one loop without flatMap and filter
* perf: build attribute objects in place
* fix: keep an attribute with the key __proto__
* build(deps-dev): bump typescript-eslint packages from 8.72.2 to 8.74.0
Bumps typescript-eslint, @typescript-eslint/parser and
@typescript-eslint/eslint-plugin together. Each release peers on the other
two at the same version, so the separate Dependabot PRs (#3923, #3924,
#3925) each failed npm ci.
* build: resolve typescript-eslint's optional @typescript/native peer to our own
typescript-eslint 8.73 and later have an optional peer on
@typescript/native >=7.1.0-dev, which our TypeScript 7.0.2 alias doesn't
satisfy. npm 11 lets that through, but npm 10 (Node 20 and 22, and the
ubuntu-24.04 runner of the shape demos job) wants that day's 7.1 dev build
and fails npm ci as the lockfile doesn't have it. The override points the
peer at the @typescript/native we already install, which typescript-eslint
doesn't use while TypeScript 6 is "typescript".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(layout): lay out rows that repeat their table's properties, split rows at multiple line spacing and overfull text boxes, as Word does
estimatePageNumbers stopped at three things report templates have (#3912):
- A row whose w:tblPrEx repeats the table's own w:tblW, w:tblLayout or
w:tblInd. Properties that are the same as the table's change nothing,
so only those that differ still stop the layout.
- A cell's line at multiple spacing at the foot of a row that breaks
across pages, where it fits only without the space below its text.
word-split-rows-and-boxes.docx shows Word moves it to the next page,
unlike in the body: 69 probes, with and without borders and above a
cell's bottom margin, all now on Word's pages.
- An inline VML text box of its own height whose text is taller than
it. Word cuts the text off and keeps the box's height (OB1 in the same
probe), so the box is laid out at its own height.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(layout): compare a row's table properties with the table's whatever order their attributes are in
XML gives attributes no order, so a row's w:tblPrEx written with
w:type before w:w is the same as the table's w:tblW written the other
way round. The comparison now sorts each element's attributes first,
as a text frame's are compared, rather than stopping the layout there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(layout): put the probe's text box shape type before whichever box ONLY leaves first
The shape type was added to OB1a's box, so a run with ONLY=OB1b wrote a
box referring to a shape type the document didn't declare. It now goes
before the first box in the document, whichever that is. A full run
writes the same document as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Word can put a small space between Chinese, Japanese or Korean text and
a Latin letter or a digit beside it. autoSpaceEastAsianText controls the
space beside digits (w:autoSpaceDN), and autoSpaceLatinAndEastAsianText
now does the same for Latin letters (w:autoSpaceDE).
Both can be set in paragraph styles, numbering levels and the document
defaults too, and are written after w:overflowPunct and before w:bidi,
the order CT_PPrBase gives them. To keep that order, w:suppressLineNumbers
moves to its place after w:numPr, and w:wordWrap and w:overflowPunct now
come after w:tabs. A test sets an option for each element
ParagraphProperties writes and checks their order against the schema.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs: point the README's Node examples at demo/ instead of RunKit
runkit.com no longer serves the demos: its TLS certificate expired on
2026-01-18 and the site answers 503. Link the equivalent files in demo/
and say how to run them.
* docs: say the demos need a build, and where they write the document
The demos that import docx/shapes, docx/charts, docx/html, docx/layout and
the other subpath entries (51 of the 172) load them from dist/, so in a
fresh clone they stop with ERR_MODULE_NOT_FOUND until `npm run build` has
run. CI builds before it runs the demos too.
npm runs scripts from the package's folder, so the document is written to
the root of the repository, whichever folder the command is run from.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* docs: link the demos that the RunKit Margins and Advanced paragraphs links ran
RunKit's demo 6, "Margins", was demo/demo6.js, which sets the page's
margins to zero. It is demo/page-layout/page-borders.ts now, and still
does that, so the list keeps it.
RunKit's demo 2, "Advanced Paragraphs and text", was demo/demo2.js, with
its own heading and paragraph styles and numbering. It is
demo/styles/default-styles.ts now, so the list links that, in place of the
paragraph spacing demo.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
---------
Co-authored-by: fstandhartinger <florian.standhartinger@gmail.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>