Commit Graph
238 Commits
Author SHA1 Message Date
DolanandClaude Opus 5.5 e7b568f4e6 feat(shapes): custom shapes with several paths, holes, text areas and connection points (#3539)
- `paths` draws a custom shape from several paths, each filled with the
  shape's fill, not at all, or lighter or darker, and with or without its line
- A closed part of a path inside another is a hole, whichever way round it
  is drawn: parts are turned round so both fill rules cut the same holes
- `textArea` sets where a custom shape's text goes, and "fitText" fits it
- `connectionPoints` gives a custom shape its own connection points
- Connection sites and text areas are guides that keep their share of the
  shape when it is resized, as PowerPoint writes freeforms
- Demo 120, with a reference render, and docs in shapes.md


Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 16:10:17 +01:00
DolanandClaude Opus 5.5 be95a8c1bb feat: theme colours for the page background, and templates' themes in patchDocument (#3538)
- Document's background.color takes a ThemeColor, written with w:themeColor,
  w:themeTint or w:themeShade and the hex colour it comes to. The released
  themeColor, themeTint and themeShade strings still work, and are deprecated.
- patchDocument reads the template's theme colours (a:srgbClr, a:sysClr), so
  theme colours in patches get the template's hex value rather than Office's.
- Demo 119 has a page background in a theme colour. Docs updated.


Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 00:46:30 +01:00
Dolan 764d5423f3 feat: theme colours for text, underlines, borders and shading (#3537) 2026-09-24 23:34:57 +01:00
Dolan 811e5d9b97 feat: write a theme part, with theme fonts for text and theme colours for shapes (#3536) 2026-09-24 20:23:52 +01:00
Dolan 91cd6398e2 feat(shapes): text in document styles, swimlanes, routing, descriptions, percentages and text flows (#3535) 2026-09-24 18:46:00 +01:00
Dolan 494ed78138 feat: shapes in docx/shapes and watermarks in docx/watermarks (#3534) 2026-09-24 15:38:43 +01:00
Dolan bf7eb857df feat(shapes): automatic layout, text sizing, connector polish and visual regression tests (#3533) 2026-09-24 13:18:04 +01:00
Dolan 859ea7ec7b feat(shapes): effects, pattern and picture fills, text layout, custom shapes and richer diagrams (#3523) 2026-09-24 11:52:04 +01:00
DolanandClaude Opus 5.5 ee37e5b38c feat(shapes): connectors and drawing canvases (#3522)
Shapes in a ShapeGroupRun or the new ShapeCanvasRun can have an `id`, and a
child with `type: "connector"` joins two of them:

    { type: "connector", from: "start", to: { id: "step", side: "top" }, route: "elbow" }

The connector is drawn from one shape to the other, so it needs no size or
position. It attaches at the shapes' connection sites (a:stCxn/a:endCxn),
choosing the facing sides unless a side is given, and routes as Word does:
a straight line, or elbow and curved connectors that leave and arrive at right
angles and loop around shapes when they have to.

Word only keeps connectors attached when shapes move on a drawing canvas, so
ShapeCanvasRun writes a wpc:wpc canvas with an optional background and outline.

Connection sites come from the preset shape definitions of ECMA-376:
scripts/generate-preset-shape-geometry.ts extracts each shape's sites and the
guides they depend on, and a small evaluator calculates them for a shape's size
and adjustments. A test also checks the adjustments table against the
definitions.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 09:36:03 +01:00
Dolan MiuandClaude Opus 5.5 576e76ac26 feat(shapes): name shape types, dashes and arrowhead sizes in plain English
OOXML abbreviates or numbers many names (roundRect, snip2DiagRect, ribbon2,
bentConnector3, sysDot, lgDash, sm/med/lg). The public API now uses names
that say what each value is, and maps them to OOXML names when writing XML:

- 49 of the 187 preset shape types, e.g. rectangle, roundedRectangle,
  diagonalSnippedCornersRectangle, ribbonUp, elbowConnector, lineCallout
- Line dashes: longDash, shortDot, shortDashDot, ...
- Arrowhead sizes: small, medium, large
- Gradient path: rectangle

Passing an OOXML shape name throws an error that suggests the new name.
A new Shape Types docs page lists every shape with its OOXML name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:19:02 +01:00
Dolan 3bd3afd6e4 feat: add shapes with ShapeRun and ShapeGroupRun (#3521)
* feat: Add shapes

* Make API more friendly
2026-09-24 01:54:16 +01:00
6d73c49d14 feat: Watermarks (#3221)
* watermark added

* fix: resolve final eslint identifier denylist error for string key

* fix: resolve verbatimModuleSyntax errors by using type-only imports

* style: format watermark files with prettier

* style: format watermark files with prettier

* fix: bypass prettier and eslint conflict using computed property for string key

* fix: replace explicit any with unknown array in mock context

* fix: replace explicit any with unknown array in mock context

* fix: replace explicit any with unknown array in mock context

* feat: add text and image watermarks on a generic VML drawing layer

Adds TextWatermark and ImageWatermark, inline elements that go inside a
header paragraph and emit the same markup Word writes for its own
watermarks (WordArt shape type 136 for text, picture frame type 75 for
images, PowerPlusWaterMarkObject / WordPictureWatermark ids), so Word
recognizes them and can remove or replace them from Design > Watermark.

The watermarks are built on a new src/file/vml module: typed builders for
w:pict, v:shape, v:shapetype, v:fill, v:stroke, v:textpath, v:imagedata,
v:path, v:formulas, v:handles and o:lock, plus the Word preset shape types.
The existing Textbox now uses the same builders, and future VML drawing
features can compose them too.

Compared with the original draft, rotation is written in degrees in the
shape style as Word does (not 65536-based fixed point), the shape type
definition is included, colours are normalized for VML, the default height
keeps letters in proportion for the text length, and image watermarks
register their media and header relationship like ImageRun.

Also adds docs/usage/watermarks.md, a sidebar entry, a cross-link from the
headers and footers page, and two demos.

Resolves #3017

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: unknown <yusuf.unal@nordisglobal.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-23 21:38:41 +01:00
DolanandClaude Fable 5.1 0e09be861d docs: fix "Get Started" cover link and GitHub corner overlap (#3518)
The cover page linked to "#Welcome", but the README heading was renamed to
"Welcome to docx", so docsify resolved it to "#/?id=welcome" which matches
nothing. Point it at the current heading id instead.

Also lift the GitHub corner above the cover page. The theme gives both
".cover-main" and ".github-corner" z-index 1 and the cover is rendered later
in the DOM, so once scrolled the cover overlapped the corner and made the
link unclickable.

Fixes #3477

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-23 17:55:04 +01:00
99517e0c1c fix(table): emit numeric pct widths in fiftieths of a percent (#3476)
* fix(table): emit numeric pct widths in fiftieths of a percent

createTableWidthElement wrote a numeric PERCENTAGE size as a "50%" string.
Both that string and the fiftieths-of-a-percent integer (50% = 2500) are
valid under ST_MeasurementOrPercent, but Word writes the integer, and
stricter consumers — Google Docs and Apple Pages/QuickLook/Mail — misread
the string form and collapse table columns to one character.

Emit the integer (Math.round(size * 50)) for numeric pct sizes to match
Word's output. Callers who want the literal percent string can still pass a
Percentage (e.g. "50%"), which is left untouched. Adds table-width.spec.ts
and updates the two specs that asserted the old string output.

* fix(table): derive tblGrid from table and cell widths so tables render in Google Docs and Pages

Writing pct widths as fiftieths of a percent (previous commit) is correct but
does not fix #1457 on its own. Google Docs, Apple Pages, QuickLook and other
consumers lay a table out from w:tblGrid alone and ignore w:tblW / w:tcW
percentages, while docx wrote a placeholder grid of 100 twips per column
whenever columnWidths was omitted. Every percentage-width table therefore
collapsed to one character per column in those readers (#1457, #349, #216,
#3015). Word recomputes the layout from the preferred widths, which is why it
was never affected.

When columnWidths is omitted the grid is now derived, in twips, the way Word
writes it after laying the table out:

- percentages resolve against the text width of the section the table is in
  (page width minus margins and gutter, per column in multi-column sections),
  or against the parent cell for nested tables, at serialization time
- dxa and universal-measure widths are used as they are
- columns without a width share what is left of the table width equally
- column spans and the continuation cells inserted for rowSpan are honoured

Explicit columnWidths are written unchanged. Tables formatted without a
document (bare Formatter, patcher) resolve against the default A4 page, and
formatting a table more than once is idempotent.

New: SectionProperties.AvailableTextWidth, Body.getSectionPropertiesFor,
universalMeasureToTwips, Table.ColumnWidths and Table.getCellWidth. Adds a
demo, documents columnWidths, and applies the review nits on table-width.spec.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test: use a cspell-friendly malformed measure in the universalMeasureToTwips spec

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-23 17:29:48 +01:00
Salman Shaikh 5a9806ce09 Add support for cropping images (#3505)
* feat: add image crop option

* test: source rectangle tests
2026-09-23 15:35:53 +01:00
f734656001 build(deps-dev): bump prettier from 3.8.3 to 3.9.8 (#3509)
* build(deps-dev): bump prettier from 3.8.3 to 3.9.8

Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.8.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.8)

---
updated-dependencies:
- dependency-name: prettier
  dependency-version: 3.9.8
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* style(docs): reformat code samples for prettier 3.9

Prettier 3.9 keeps arrays and objects containing only a block comment
on a single line (e.g. `[/* ... */]`), which failed the Prettier CI check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 14:03:29 +01:00
DolanandDolan Miu 224b95a25e docs: Improve documentation, JSDoc comments, and troubleshooting guides (#3433)
* docs: Write documentation and comments

Upgrade and remove dependencies

* Add more demos to the run

* Add more tests to fill coverage to 100%

---------

Co-authored-by: Dolan Miu <>
2026-05-24 17:52:35 +01:00
hehecat 6a32b4e163 feat(paragraph): add firstLineChars indent support (#3420) 2026-05-24 14:31:46 +01:00
SerhiiShcheh 462fc75ea0 Feature/comment replies and resolved state (#3424)
* Add comment replies and resolved property

* Add comment replies demo file

* Add comment replies documentation, fix comment id type in documentation
2026-05-24 14:31:19 +01:00
DolanandDolan Miu 74bf48f8c1 feat: Migrate to new component authoring (#3332)
* feat: Migrate to new component authoring

# Conflicts:
#	src/file/table-of-contents/table-of-contents.ts

# Conflicts:
#	src/file/content-types/content-types.ts
#	src/file/paragraph/properties.ts
#	src/file/table/table-properties/table-properties.ts

# Conflicts:
#	src/file/document/body/section-properties/section-properties.ts
#	src/file/paragraph/run/run.ts
#	src/file/table-of-contents/table-of-contents.ts
#	src/file/table/grid.ts
#	src/file/table/table-cell/table-cell-properties.ts
#	src/file/table/table.ts

* Clarify public api

* Add docs

* Fix tests and linting

* Fix readonly array

* Fix spelling

* Update ToC docs

* Update WPS to use BuilderElement

* Migrate components to use Builder element

Add ESLint rules

* Comment out the template demos

* Ignore demo 90 until we fix schema validation

* Disable demo validation

* Disable doc

* Disable validation for now

---------

Co-authored-by: Dolan Miu <>
2026-02-22 21:23:05 +00:00
7d70f508b7 feat: WPS text box (#3369)
* feat: basic wps text box support

# Conflicts:
#	src/file/drawing/anchor/anchor.ts
#	src/file/drawing/drawing.ts
#	src/file/drawing/inline/graphic/graphic-data/graphic-data.ts
#	src/file/drawing/inline/graphic/graphic.ts
#	src/file/drawing/inline/inline.ts
#	src/file/media/data.ts

* fix: wps-export

* wps

* chore: publish workaround

* Add tests

* Add tests

* Add docs

* Add demo

---------

Co-authored-by: Piotr Buszka <pbu@fidgate.com>
Co-authored-by: Piotr Buszka <potr.buszka@innect.eu>
Co-authored-by: Dolan Miu <>
2026-02-22 02:29:51 +00:00
Alexander NortungandDolan Miu fb1d7aacee feat(table-of-contents): cached data (#3319)
* chore(gitignore): build folder

* chore(demo): passing demo number as argument will run that demo

* feat(table-of-contents): cached data

* chore(table-of-contents): clean up

This commit can be squashed with the previous one if necessary

* test(table-of-contents): cached entries

* docs(table-of-contents): added cached entries section

* Improve coverage

* Fix tests

* feat(table-of-contents): use style with levels in cached entries

---------

Co-authored-by: Dolan Miu <>
2026-02-19 23:55:55 +00:00
SerhiiShcheh 6de8a8fbe8 feat: extend track changes support (#3326)
* Add table row track changes

* Add table cell track changes

* Add revision information for table row properties

* Add revision information for table cell properties

* Add revision information for table properties

* Add revision information for table grid

* Add paragraph properties revision

* Add section properties revision

* Add includeIfEmpty to prevent skipping IgnoreIfEmptyXmlComponent inside revisions

* Add documentation for new track changes

* Add paragrah run properties revision

* Add demo example for track changes

* Refactor ICellMergeAttributes type
2026-02-18 16:18:56 +00:00
NicoandDolan da20f94a28 feat: Add table look support for conditional table formatting (#3317)
* Added the table look parameter to new Table class to enable controlling various conditional formatting table properties (first row, first column etc)

* Improve documentation

---------

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2026-02-16 01:45:14 +00:00
James FitzsimmonsandDolan e79c69ca99 feat(footnotes): Support lists and images in footnotes (#3325)
* feat(footnotes): Support lists and images in footnotes

* fix numbering in headers/footers

* Fix tests and add documentation

---------

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2026-02-16 01:24:06 +00:00
Dolanandmatt b44ac388df feat: add endnotes support to docx library (#3354)
* feat: add endnotes support to docx library

- Add comprehensive endnotes implementation with EndnoteReferenceRun component
- Create Endnotes class and EndnotesWrapper for document integration
- Add endnote attributes, reference runs, and separator components
- Update documentation to cover both footnotes and endnotes usage
- Include demo file demonstrating endnotes functionality with multiple sections
- Integrate endnotes into compiler pipeline and content types
- Add comprehensive test coverage for endnote components

Endnotes appear at the end of the document, unlike footnotes which appear at the bottom of each page, making them ideal for academic papers and formal documents.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

# Conflicts:
#	src/export/packer/next-compiler.ts
#	src/file/paragraph/run/empty-children.ts
#	src/file/styles/style/default-styles.ts

* Fix tests

* Add documentation

* Add and fix test

---------

Co-authored-by: matt <matthew.ed.keller@gmail.com>
2026-02-16 00:12:28 +00:00
Dolan 3539c06e92 docs: Improve inline docs and docs website (#3353)
* docs: Improve inline docs and docs website

* Fix lint

* Fix spelling
2026-02-14 03:54:25 +00:00
Dolan 58b4469364 docs: Improve JSDoc documentation in components (#3343)
* docs: Improve JSDoc documentation in components

* Fix spelling
2026-02-13 02:24:21 +00:00
Ecaratti 1994e00c98 Add between borders for paragraphs following http://officeopenxml.com/WPborders.php (#3312) 2025-11-21 01:19:59 +00:00
Mayank 6d76429a6d docs(numbering): add docs for instance option and update full example (#3267)
* docs(numbering): add docs for `instance` option and update full example

- Documented `numbering.instance` for ordered lists
  - Explains continuation vs restart behavior
  - Added example usage with multiple instances
- Updated full example to reflect latest numbering behavior

resolves 3037, fixes 3037

* clean up lock file

* fix numbering reference

* Remove example update
2025-11-05 03:39:19 +00:00
Devin Brown bd01690b66 fix: MS article URL in docs (#3197) 2025-08-23 12:30:53 +01:00
Firat Ciftci 7d1129900f Fix: separate vertical alignment enums for ITableCellOptions and ISectionPropertiesOptions (#3079)
* fix: separate vertical alignment enums for table and section properties

- Introduced `VerticalAlignTable` for table-cell vertical alignment with valid values: `top`, `center`, and `bottom`.
- Added `VerticalAlignSection` for section properties, extending `VerticalAlignTable` with an additional value `both`.
- Marked the original `VerticalAlign` as deprecated for backward compatibility, directing users to the new enums.
- Updated type definitions for better clarity on valid vertical alignments.

* refactor: update vertical alignment imports and types for section and table properties

- Renamed `VerticalAlign` to `VerticalAlignSection` in section properties and `VerticalAlignTable` in table-cell properties for clarity.
- Updated type definitions to reflect the new enum names, ensuring better organization and understanding of vertical alignment options.
- Adjusted related test cases to utilize the new imports and types.

* refactor: update demos to use new enums for table and section properties for vertical alignment
2025-05-02 19:58:10 +01:00
Dolan Miu 03d47658d6 Fix guidelines 2025-04-17 00:41:04 +01:00
Dolan 1403ac664b Update contribution guidelines (#3053) 2025-04-16 23:51:30 +01:00
DolanandAlexander Nortung 7f26badbc9 feat: Added NumberedItemReference (#3042)
* feat: Added NumberedItemReference

* Fix linting

* ts-ignore until TypeScript upgrade

---------

Co-authored-by: Alexander Nortung <alexander.nortung@oakdigital.dk>
2025-04-16 08:54:50 +01:00
Josh Kelley 4e2befb7ef Update docs for new Packer methods (#2961)
To cover #2920
2025-02-17 21:22:07 +00:00
adamSherwoodGenieAI 05fcf6edd4 Feat: subfile overrides (#2941)
* Adds overrides parameter to Packer methods and compiler

* Adds tests for overrides parameter

* Update Packer usage examples
2025-01-27 10:39:23 +00:00
3654eb0800 New Textbox Component (#2718)
* Adding textbox with no props

* Fixing namings and adding shape style

* simplify usage

* Fix linting issues

* Re-name demo

* Use new shape authoring style

* Add tests

Simplify API

* Add better types for styles

* Add more options to TextBox and add documentation

---------

Co-authored-by: zohar11 <zohar@sumit-ai.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-11-28 10:33:19 +00:00
Bálint TáborszkiandDolan Miu c6bb255641 Add hyphenation support (#2678)
* Add hyphenation support

* Remove unneeded linebreaks

* Add documentation and fix eslint

* Add tests

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-11-21 10:41:31 +00:00
Renan Duarte LealandDolan 021f1b0c4d Update bullet-points.md (#2684)
Excluding ; from example

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:13:26 +01:00
YousefandDolan f212cf0251 Update styling-with-js.md (#2734)
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:57:11 +01:00
Lê Anh Vũ 28029f4c1c chore[tables.md]: replace semicolon to commas (#2708) 2024-10-10 00:14:09 +01:00
Max Lay f98f852a55 Allow disabling numbering inherited from a paragraph style (#2531) 2024-05-20 03:15:11 +01:00
younesspotmasterandDolan e379a7fe04 Document the 'keepOriginalStyles' options (#2549)
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-05-20 03:13:05 +01:00
yaokailun c4ed19e589 Add math limit component (#2510) 2024-01-03 00:13:13 +00:00
Dolan 24c159de37 Add SVG image suport (#2487)
* Add SVG blip extentions

* SVG Image feature now works

* Add and simplify tests

* Fix falsey issue with file

Write tests
100% Coverage
2023-12-31 18:54:35 +00:00
hshoja 968c3aed0f Update styling-with-xml doc 2023-09-10 15:57:48 +02:00
Dolan Miu 5f26ca1c94 Update numbering docs 2023-08-06 20:10:03 +01:00
Dolan Miu a368ed7fd3 Add docsify-terminal-block to documentation 2023-06-15 21:29:10 +01:00
Dolan Miu 6288bb0701 Bump sign off sheet 2023-06-14 02:48:56 +01:00