diff --git a/api/classes/index.AbstractNumbering.html b/api/classes/index.AbstractNumbering.html
index 007144cd7d..1f7b70cf19 100644
--- a/api/classes/index.AbstractNumbering.html
+++ b/api/classes/index.AbstractNumbering.html
@@ -35,7 +35,7 @@ Each abstract definition can contain up to 9 levels.
diff --git a/api/classes/index.Body.html b/api/classes/index.Body.html
index d4b1f94b18..20417a03da 100644
--- a/api/classes/index.Body.html
+++ b/api/classes/index.Body.html
@@ -37,7 +37,7 @@ section. The last section's properties are stored as a direct child of the body
diff --git a/api/classes/index.Bookmark.html b/api/classes/index.Bookmark.html
index 520df110a1..87bbff9783 100644
--- a/api/classes/index.Bookmark.html
+++ b/api/classes/index.Bookmark.html
@@ -31,7 +31,7 @@ of a start marker, content, and an end marker.
diff --git a/api/classes/index.BookmarkEnd.html b/api/classes/index.BookmarkEnd.html
index dd5ea848a6..139b9ae6ce 100644
--- a/api/classes/index.BookmarkEnd.html
+++ b/api/classes/index.BookmarkEnd.html
@@ -35,7 +35,7 @@ taken from bookmarkUniqueNumericId (see BookmarkStart)
diff --git a/api/classes/index.BookmarkStart.html b/api/classes/index.BookmarkStart.html
index 7a50be4d10..f813e38369 100644
--- a/api/classes/index.BookmarkStart.html
+++ b/api/classes/index.BookmarkStart.html
@@ -37,7 +37,7 @@ same as a Bookmark's.
diff --git a/api/classes/index.CellMerge.html b/api/classes/index.CellMerge.html
index 28b3489e44..3a048df253 100644
--- a/api/classes/index.CellMerge.html
+++ b/api/classes/index.CellMerge.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.CellMergeAttributes.html b/api/classes/index.CellMergeAttributes.html
index 3bb0efcf4c..94793d9fa5 100644
--- a/api/classes/index.CellMergeAttributes.html
+++ b/api/classes/index.CellMergeAttributes.html
@@ -23,14 +23,14 @@ can define an xmlKeys map to specify the transformation.
diff --git a/api/classes/index.CheckBoxSymbolElement.html b/api/classes/index.CheckBoxSymbolElement.html
index 6e021e02c3..abff97303a 100644
--- a/api/classes/index.CheckBoxSymbolElement.html
+++ b/api/classes/index.CheckBoxSymbolElement.html
@@ -26,14 +26,14 @@ specifying the Unicode character and font to render.
diff --git a/api/classes/index.CheckBoxUtil.html b/api/classes/index.CheckBoxUtil.html
index 37ad4cdc98..60ec19753b 100644
--- a/api/classes/index.CheckBoxUtil.html
+++ b/api/classes/index.CheckBoxUtil.html
@@ -26,14 +26,14 @@ including its checked state and the symbols used for checked and unchecked state
diff --git a/api/classes/index.CommentRangeEnd.html b/api/classes/index.CommentRangeEnd.html
index 8225275517..88c2d0aca9 100644
--- a/api/classes/index.CommentRangeEnd.html
+++ b/api/classes/index.CommentRangeEnd.html
@@ -36,7 +36,7 @@ Must be paired with a CommentRangeStart with the same ID.
diff --git a/api/classes/index.CommentRangeStart.html b/api/classes/index.CommentRangeStart.html
index 33a2bf7954..95f539c0fa 100644
--- a/api/classes/index.CommentRangeStart.html
+++ b/api/classes/index.CommentRangeStart.html
@@ -36,7 +36,7 @@ Must be paired with a CommentRangeEnd with the same ID.
diff --git a/api/classes/index.CommentReference.html b/api/classes/index.CommentReference.html
index 91dd8fb1fa..aba437fa90 100644
--- a/api/classes/index.CommentReference.html
+++ b/api/classes/index.CommentReference.html
@@ -36,7 +36,7 @@ It should be placed after the CommentRangeEnd element.
diff --git a/api/classes/index.Comments.html b/api/classes/index.Comments.html
index b4522b5509..edf5ba3f76 100644
--- a/api/classes/index.Comments.html
+++ b/api/classes/index.Comments.html
@@ -35,7 +35,7 @@ threading is activated and thread data is generated for commentsExtended.xml.
diff --git a/api/classes/index.CommentsIds.html b/api/classes/index.CommentsIds.html
index 955b9bfa90..e0c86f0057 100644
--- a/api/classes/index.CommentsIds.html
+++ b/api/classes/index.CommentsIds.html
@@ -27,7 +27,7 @@ to a stable w16cid:durableId preserved by Word across edits.
diff --git a/api/classes/index.ConcreteHyperlink.html b/api/classes/index.ConcreteHyperlink.html
index c6365babac..36461b63cc 100644
--- a/api/classes/index.ConcreteHyperlink.html
+++ b/api/classes/index.ConcreteHyperlink.html
@@ -30,7 +30,7 @@ Use InternalHyperlink or ExternalHyperlink for creating hyperlinks in documents.
diff --git a/api/classes/index.DeletedTableCell.html b/api/classes/index.DeletedTableCell.html
index a9b6542043..a79404c0da 100644
--- a/api/classes/index.DeletedTableCell.html
+++ b/api/classes/index.DeletedTableCell.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.DeletedTableRow.html b/api/classes/index.DeletedTableRow.html
index a195436322..127cfad330 100644
--- a/api/classes/index.DeletedTableRow.html
+++ b/api/classes/index.DeletedTableRow.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.DocumentDefaults.html b/api/classes/index.DocumentDefaults.html
index a21646c76b..f0b959b279 100644
--- a/api/classes/index.DocumentDefaults.html
+++ b/api/classes/index.DocumentDefaults.html
@@ -27,14 +27,14 @@ paragraphs and runs in a document unless overridden by a style or direct formatt
diff --git a/api/classes/index.DrawingPatch.html b/api/classes/index.DrawingPatch.html
index 7f48861101..1595a8d7ec 100644
--- a/api/classes/index.DrawingPatch.html
+++ b/api/classes/index.DrawingPatch.html
@@ -20,14 +20,14 @@ is one: it replaces the data of a chart made in Word.
diff --git a/api/classes/index.EndnoteIdReference.html b/api/classes/index.EndnoteIdReference.html
index 885bb990a2..9cd178ca33 100644
--- a/api/classes/index.EndnoteIdReference.html
+++ b/api/classes/index.EndnoteIdReference.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.EndnoteReferenceRunAttributes.html b/api/classes/index.EndnoteReferenceRunAttributes.html
index 9891a1da38..f4fdf76c13 100644
--- a/api/classes/index.EndnoteReferenceRunAttributes.html
+++ b/api/classes/index.EndnoteReferenceRunAttributes.html
@@ -23,14 +23,14 @@ can define an xmlKeys map to specify the transformation.
diff --git a/api/classes/index.Endnotes.html b/api/classes/index.Endnotes.html
index 486e0370ff..4414f51e59 100644
--- a/api/classes/index.Endnotes.html
+++ b/api/classes/index.Endnotes.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.ExternalHyperlink.html b/api/classes/index.ExternalHyperlink.html
index ad4feec62a..66f2e4b120 100644
--- a/api/classes/index.ExternalHyperlink.html
+++ b/api/classes/index.ExternalHyperlink.html
@@ -37,7 +37,7 @@ is converted to a ConcreteHyperlink with the relationship ID.
diff --git a/api/classes/index.FileChild.html b/api/classes/index.FileChild.html
index e87e117f75..ba78a0bfb9 100644
--- a/api/classes/index.FileChild.html
+++ b/api/classes/index.FileChild.html
@@ -28,7 +28,7 @@ to the document body. Examples include Paragraph and Table.
diff --git a/api/classes/index.FootNotes.html b/api/classes/index.FootNotes.html
index 8fda757cbe..7fe3a7ca14 100644
--- a/api/classes/index.FootNotes.html
+++ b/api/classes/index.FootNotes.html
@@ -29,14 +29,14 @@ line used when footnotes continue across pages.
diff --git a/api/classes/index.FooterWrapper.html b/api/classes/index.FooterWrapper.html
index 6676e1c1f5..147b45d286 100644
--- a/api/classes/index.FooterWrapper.html
+++ b/api/classes/index.FooterWrapper.html
@@ -29,7 +29,7 @@ Each section can have multiple footers for different page types.
diff --git a/api/classes/index.FootnoteReference.html b/api/classes/index.FootnoteReference.html
index 3a7958c95b..59ac12ebb3 100644
--- a/api/classes/index.FootnoteReference.html
+++ b/api/classes/index.FootnoteReference.html
@@ -20,14 +20,14 @@ and the footnote content by using a unique identifier.
@@ -76,9 +76,9 @@ and the footnote content by using a unique identifier.
such as a run with another run in its children. Undefined when it is written as itself.
@@ -86,9 +86,9 @@ Clicking this marker navigates to the corresponding footnote content.
such as a run with another run in its children. Undefined when it is written as itself.
diff --git a/api/classes/index.GridSpan.html b/api/classes/index.GridSpan.html
index 8d112e5445..68e2ff2c97 100644
--- a/api/classes/index.GridSpan.html
+++ b/api/classes/index.GridSpan.html
@@ -34,7 +34,7 @@ in the table grid. This is used to merge cells horizontally (column span).
diff --git a/api/classes/index.HeaderWrapper.html b/api/classes/index.HeaderWrapper.html
index 8f136b600a..2a3199d254 100644
--- a/api/classes/index.HeaderWrapper.html
+++ b/api/classes/index.HeaderWrapper.html
@@ -29,7 +29,7 @@ Each section can have multiple headers for different page types.
diff --git a/api/classes/index.HpsMeasureElement.html b/api/classes/index.HpsMeasureElement.html
index 36c995bebb..59babc21e6 100644
--- a/api/classes/index.HpsMeasureElement.html
+++ b/api/classes/index.HpsMeasureElement.html
@@ -26,14 +26,14 @@ Values can be specified as numbers (interpreted as half-points) or with explicit
diff --git a/api/classes/index.IgnoreIfEmptyXmlComponent.html b/api/classes/index.IgnoreIfEmptyXmlComponent.html
index 68bb8cf981..6255cc7c2b 100644
--- a/api/classes/index.IgnoreIfEmptyXmlComponent.html
+++ b/api/classes/index.IgnoreIfEmptyXmlComponent.html
@@ -24,7 +24,7 @@ to be excluded from the output.
diff --git a/api/classes/index.ImageRun.html b/api/classes/index.ImageRun.html
index 33bf64e60e..d7295ae47c 100644
--- a/api/classes/index.ImageRun.html
+++ b/api/classes/index.ImageRun.html
@@ -33,7 +33,7 @@ including JPG, PNG, GIF, BMP, and SVG. Optionally wraps the run in
diff --git a/api/classes/index.ImportedXmlComponent.html b/api/classes/index.ImportedXmlComponent.html
index 5530455a6a..29c6d04490 100644
--- a/api/classes/index.ImportedXmlComponent.html
+++ b/api/classes/index.ImportedXmlComponent.html
@@ -23,14 +23,14 @@ templates or when you need to include pre-existing XML fragments.
diff --git a/api/classes/index.InitializableXmlComponent.html b/api/classes/index.InitializableXmlComponent.html
index 7248262dd8..1db1481a37 100644
--- a/api/classes/index.InitializableXmlComponent.html
+++ b/api/classes/index.InitializableXmlComponent.html
@@ -23,14 +23,14 @@ create a new component that shares or extends the children of an existing compon
diff --git a/api/classes/index.InsertedTableCell.html b/api/classes/index.InsertedTableCell.html
index ff80b3f5e6..55b9a76e22 100644
--- a/api/classes/index.InsertedTableCell.html
+++ b/api/classes/index.InsertedTableCell.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.InsertedTableRow.html b/api/classes/index.InsertedTableRow.html
index 1aeacd626b..86ec9c0381 100644
--- a/api/classes/index.InsertedTableRow.html
+++ b/api/classes/index.InsertedTableRow.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.InsertedTextRun.html b/api/classes/index.InsertedTextRun.html
index 6ce283185a..7bb934cfca 100644
--- a/api/classes/index.InsertedTextRun.html
+++ b/api/classes/index.InsertedTextRun.html
@@ -30,14 +30,14 @@ made the insertion and when.
diff --git a/api/classes/index.InternalHyperlink.html b/api/classes/index.InternalHyperlink.html
index f1e57d8f40..5355296f1c 100644
--- a/api/classes/index.InternalHyperlink.html
+++ b/api/classes/index.InternalHyperlink.html
@@ -36,7 +36,7 @@ The bookmark must exist in the document for the hyperlink to function.
diff --git a/api/classes/index.LastRenderedPageBreak.html b/api/classes/index.LastRenderedPageBreak.html
index 60e74fc80d..813a78404f 100644
--- a/api/classes/index.LastRenderedPageBreak.html
+++ b/api/classes/index.LastRenderedPageBreak.html
@@ -23,7 +23,7 @@ This is typically generated by Word and not created manually.
diff --git a/api/classes/index.MathDegree.html b/api/classes/index.MathDegree.html
index 93230faea7..fa5cff6259 100644
--- a/api/classes/index.MathDegree.html
+++ b/api/classes/index.MathDegree.html
@@ -28,7 +28,7 @@ For square roots, this element is typically hidden.
diff --git a/api/classes/index.MathFunctionName.html b/api/classes/index.MathFunctionName.html
index e43a08caf1..eba693fb25 100644
--- a/api/classes/index.MathFunctionName.html
+++ b/api/classes/index.MathFunctionName.html
@@ -28,7 +28,7 @@ that appears before the function argument.
diff --git a/api/classes/index.MathFunctionProperties.html b/api/classes/index.MathFunctionProperties.html
index dd6f961e4f..260320de99 100644
--- a/api/classes/index.MathFunctionProperties.html
+++ b/api/classes/index.MathFunctionProperties.html
@@ -28,7 +28,7 @@ such as function name alignment and spacing.
diff --git a/api/classes/index.MathLimitUpper.html b/api/classes/index.MathLimitUpper.html
index 69e6dc2607..8cda87f1d9 100644
--- a/api/classes/index.MathLimitUpper.html
+++ b/api/classes/index.MathLimitUpper.html
@@ -36,7 +36,7 @@ commonly used for mathematical notation like lim with conditions above.
diff --git a/api/classes/index.MathPreSubSuperScript.html b/api/classes/index.MathPreSubSuperScript.html
index 9801d8b734..6aedd3c7b9 100644
--- a/api/classes/index.MathPreSubSuperScript.html
+++ b/api/classes/index.MathPreSubSuperScript.html
@@ -36,7 +36,7 @@ positioned before (to the left of) the base, commonly used in tensor notation.
diff --git a/api/classes/index.MathRadicalProperties.html b/api/classes/index.MathRadicalProperties.html
index 750b8f76d9..a89a682481 100644
--- a/api/classes/index.MathRadicalProperties.html
+++ b/api/classes/index.MathRadicalProperties.html
@@ -28,7 +28,7 @@ such as whether to hide the degree (for square roots).
diff --git a/api/classes/index.MathRun.html b/api/classes/index.MathRun.html
index 36e7603145..0d5e85a9d0 100644
--- a/api/classes/index.MathRun.html
+++ b/api/classes/index.MathRun.html
@@ -36,7 +36,7 @@ similar to how Run contains text in regular paragraphs.
diff --git a/api/classes/index.MathSubSuperScript.html b/api/classes/index.MathSubSuperScript.html
index 7ac938de22..3e96781292 100644
--- a/api/classes/index.MathSubSuperScript.html
+++ b/api/classes/index.MathSubSuperScript.html
@@ -36,7 +36,7 @@ commonly used for tensor notation or indexed variables with exponents.
diff --git a/api/classes/index.Media.html b/api/classes/index.Media.html
index 8dab3f6fb7..56990bb359 100644
--- a/api/classes/index.Media.html
+++ b/api/classes/index.Media.html
@@ -24,7 +24,7 @@ is stored with a unique key for retrieval.
diff --git a/api/classes/index.NextAttributeComponent.html b/api/classes/index.NextAttributeComponent.html
index d4ee0a35c6..a39d6471bc 100644
--- a/api/classes/index.NextAttributeComponent.html
+++ b/api/classes/index.NextAttributeComponent.html
@@ -27,14 +27,14 @@ This gives more control but is more verbose than XmlAttributeComponent.
diff --git a/api/classes/index.OnOffElement.html b/api/classes/index.OnOffElement.html
index 5b3bdb6f65..29fc71f76a 100644
--- a/api/classes/index.OnOffElement.html
+++ b/api/classes/index.OnOffElement.html
@@ -27,14 +27,14 @@ it is explicitly disabled. When the value is true, the attribute is often omitte
diff --git a/api/classes/index.Packer.html b/api/classes/index.Packer.html
index cb41e244d6..b1ade03006 100644
--- a/api/classes/index.Packer.html
+++ b/api/classes/index.Packer.html
@@ -26,7 +26,7 @@ of the document structure into OOXML format and compression into a .docx ZIP arc
diff --git a/api/classes/index.PageBorders.html b/api/classes/index.PageBorders.html
index 0668fb03e1..3bc60a984b 100644
--- a/api/classes/index.PageBorders.html
+++ b/api/classes/index.PageBorders.html
@@ -27,14 +27,14 @@ including which pages display the borders and how they are positioned.
diff --git a/api/classes/index.PageReference.html b/api/classes/index.PageReference.html
index 6385f6c665..bb1f90dd14 100644
--- a/api/classes/index.PageReference.html
+++ b/api/classes/index.PageReference.html
@@ -31,7 +31,7 @@ the specified bookmark, useful for cross-references like "see page 5".
diff --git a/api/classes/index.PageTextDirection.html b/api/classes/index.PageTextDirection.html
index 52be6dd0b2..bf4d399ebb 100644
--- a/api/classes/index.PageTextDirection.html
+++ b/api/classes/index.PageTextDirection.html
@@ -23,14 +23,14 @@ for all pages in a section.
diff --git a/api/classes/index.Paragraph.html b/api/classes/index.Paragraph.html
index 887b6c4ce1..9112e3fc27 100644
--- a/api/classes/index.Paragraph.html
+++ b/api/classes/index.Paragraph.html
@@ -36,7 +36,7 @@ various inline elements such as text runs, images, hyperlinks, and bookmarks.
diff --git a/api/classes/index.ParagraphPropertiesChange.html b/api/classes/index.ParagraphPropertiesChange.html
index 9a8c11b96e..b4c2eaab59 100644
--- a/api/classes/index.ParagraphPropertiesChange.html
+++ b/api/classes/index.ParagraphPropertiesChange.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.ParagraphPropertiesDefaults.html b/api/classes/index.ParagraphPropertiesDefaults.html
index 8f18074308..68a0395a45 100644
--- a/api/classes/index.ParagraphPropertiesDefaults.html
+++ b/api/classes/index.ParagraphPropertiesDefaults.html
@@ -27,14 +27,14 @@ to all paragraphs in the document unless overridden.
diff --git a/api/classes/index.PositionalTab.html b/api/classes/index.PositionalTab.html
index d5c9d67921..93b06bc13f 100644
--- a/api/classes/index.PositionalTab.html
+++ b/api/classes/index.PositionalTab.html
@@ -37,7 +37,7 @@ an exact alignment and position within the paragraph.
diff --git a/api/classes/index.RunPropertiesDefaults.html b/api/classes/index.RunPropertiesDefaults.html
index 22cf284e26..0c31d9755e 100644
--- a/api/classes/index.RunPropertiesDefaults.html
+++ b/api/classes/index.RunPropertiesDefaults.html
@@ -27,14 +27,14 @@ to all text runs in the document unless overridden by styles or direct formattin
diff --git a/api/classes/index.SectionProperties.html b/api/classes/index.SectionProperties.html
index 98638b7bfd..c30d51e426 100644
--- a/api/classes/index.SectionProperties.html
+++ b/api/classes/index.SectionProperties.html
@@ -28,14 +28,14 @@ A document can contain multiple sections with different properties.
diff --git a/api/classes/index.SectionPropertiesChange.html b/api/classes/index.SectionPropertiesChange.html
index b698b9ef1d..7d9675a4ae 100644
--- a/api/classes/index.SectionPropertiesChange.html
+++ b/api/classes/index.SectionPropertiesChange.html
@@ -24,14 +24,14 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.SimpleField.html b/api/classes/index.SimpleField.html
index a72d04a674..febcedfeb1 100644
--- a/api/classes/index.SimpleField.html
+++ b/api/classes/index.SimpleField.html
@@ -40,7 +40,7 @@ Simple fields are typically used for fields that don't require complex nesting.<
diff --git a/api/classes/index.SimpleMailMergeField.html b/api/classes/index.SimpleMailMergeField.html
index 4bac9664fa..e43de30d7c 100644
--- a/api/classes/index.SimpleMailMergeField.html
+++ b/api/classes/index.SimpleMailMergeField.html
@@ -30,7 +30,7 @@ It creates a MERGEFIELD that will be populated with data during mail merge.
diff --git a/api/classes/index.StringContainer.html b/api/classes/index.StringContainer.html
index 4bf97bbda5..39a6fda48c 100644
--- a/api/classes/index.StringContainer.html
+++ b/api/classes/index.StringContainer.html
@@ -23,14 +23,14 @@ rather than an attribute.
diff --git a/api/classes/index.StringEnumValueElement.html b/api/classes/index.StringEnumValueElement.html
index f561c17f4d..1523498e41 100644
--- a/api/classes/index.StringEnumValueElement.html
+++ b/api/classes/index.StringEnumValueElement.html
@@ -26,14 +26,14 @@ type parameter to enforce type safety for enum values.
diff --git a/api/classes/index.StyleForParagraph.html b/api/classes/index.StyleForParagraph.html
index 2608d55446..a79b46ba65 100644
--- a/api/classes/index.StyleForParagraph.html
+++ b/api/classes/index.StyleForParagraph.html
@@ -28,14 +28,14 @@ run-level properties (font, size, color) for text within the paragraph.
diff --git a/api/classes/index.StyleLevel.html b/api/classes/index.StyleLevel.html
index 62dedcc2a7..6d7552f160 100644
--- a/api/classes/index.StyleLevel.html
+++ b/api/classes/index.StyleLevel.html
@@ -20,7 +20,7 @@ custom styles to be included in the table of contents at specific levels.
diff --git a/api/classes/index.Styles.html b/api/classes/index.Styles.html
index 7d4f27f4b8..78f28272f5 100644
--- a/api/classes/index.Styles.html
+++ b/api/classes/index.Styles.html
@@ -28,14 +28,14 @@ a way to define consistent formatting across a document.
diff --git a/api/classes/index.TDirection.html b/api/classes/index.TDirection.html
index a344b1fc7d..cd8e056d89 100644
--- a/api/classes/index.TDirection.html
+++ b/api/classes/index.TDirection.html
@@ -34,7 +34,7 @@ useful for creating rotated text or supporting different writing systems.
diff --git a/api/classes/index.Table.html b/api/classes/index.Table.html
index b3cd0b2c60..ebd75f3638 100644
--- a/api/classes/index.Table.html
+++ b/api/classes/index.Table.html
@@ -36,7 +36,7 @@ Tables are used to organize content into a grid structure.
Its borders and shading are declared with hex colors, as they were before they took colors of the document's
theme, so that code reading them still compiles. A cell given a theme color has it here as it was given.
diff --git a/api/classes/index.TableCellBorders.html b/api/classes/index.TableCellBorders.html
index c6766ec6cc..210e0eb8a1 100644
--- a/api/classes/index.TableCellBorders.html
+++ b/api/classes/index.TableCellBorders.html
@@ -34,7 +34,7 @@ can be configured independently with different styles, colors, and widths.
Represents a Table of Contents in a WordprocessingML document.
TableOfContents creates an auto-generated list of document headings
with page numbers. It uses a TOC field code to generate entries.
+
Unless it is given cachedEntries or contentChildren, it is written with an
+entry for each heading its options include, linked to a bookmark on the heading,
+so it isn't empty before Word updates it or in applications that don't update it.
+The page numbers are left for Word to fill in when it updates the field.
Prepares this component and its children for XML serialization.
-
This method is called by the Formatter to convert the component tree into
-an object structure compatible with the xml library (https://www.npmjs.com/package/xml).
-It recursively processes all children and handles special cases like
-attribute-only elements and empty elements.
-
The method can be overridden by subclasses to customize XML representation
-or execute side effects during serialization (e.g., creating relationships).
+
Written empty, and filled in from the headings once the body it is in is written, unless it was given its content.
+The page numbers are aligned to the right of the text in its section.
diff --git a/api/classes/index.TableRow.html b/api/classes/index.TableRow.html
index 29b021eedc..df7eaaf124 100644
--- a/api/classes/index.TableRow.html
+++ b/api/classes/index.TableRow.html
@@ -36,7 +36,7 @@ one or more table cells that hold the actual content.
diff --git a/api/classes/index.TableRowProperties.html b/api/classes/index.TableRowProperties.html
index 4e92e82594..f95b11b7af 100644
--- a/api/classes/index.TableRowProperties.html
+++ b/api/classes/index.TableRowProperties.html
@@ -30,7 +30,7 @@ whether it can split across pages, and whether it's a header row.
diff --git a/api/classes/index.TableRowPropertiesChange.html b/api/classes/index.TableRowPropertiesChange.html
index 7b5ac664e3..3cbf4bfef2 100644
--- a/api/classes/index.TableRowPropertiesChange.html
+++ b/api/classes/index.TableRowPropertiesChange.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.VerticalMerge.html b/api/classes/index.VerticalMerge.html
index 9b00a80459..95c1f4feac 100644
--- a/api/classes/index.VerticalMerge.html
+++ b/api/classes/index.VerticalMerge.html
@@ -35,7 +35,7 @@ This is used to create row spans in tables.
diff --git a/api/classes/index.WpsShapeRun.html b/api/classes/index.WpsShapeRun.html
index 059130ea52..a921c8e128 100644
--- a/api/classes/index.WpsShapeRun.html
+++ b/api/classes/index.WpsShapeRun.html
@@ -28,7 +28,7 @@ options for fills, lines, effects and text layout, and can be any of the preset
diff --git a/api/classes/index.XmlAttributeComponent.html b/api/classes/index.XmlAttributeComponent.html
index 1b972788a1..293074b47d 100644
--- a/api/classes/index.XmlAttributeComponent.html
+++ b/api/classes/index.XmlAttributeComponent.html
@@ -27,7 +27,7 @@ can define an xmlKeys map to specify the transformation.
diff --git a/api/classes/index.XmlComponent.html b/api/classes/index.XmlComponent.html
index 74510f48dc..5deac84118 100644
--- a/api/classes/index.XmlComponent.html
+++ b/api/classes/index.XmlComponent.html
@@ -24,7 +24,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/math.MathBrackets.html b/api/classes/math.MathBrackets.html
index 376e515623..a72e802ab5 100644
--- a/api/classes/math.MathBrackets.html
+++ b/api/classes/math.MathBrackets.html
@@ -22,14 +22,14 @@ with what they hold.
diff --git a/api/classes/math.MathLargeOperator.html b/api/classes/math.MathLargeOperator.html
index c34efb26fe..62984ab1bd 100644
--- a/api/classes/math.MathLargeOperator.html
+++ b/api/classes/math.MathLargeOperator.html
@@ -21,14 +21,14 @@ it applies to. MathSum and MathIntegral are two of the
diff --git a/api/classes/math.MathMatrix.html b/api/classes/math.MathMatrix.html
index 942a551862..be2a1bf5e7 100644
--- a/api/classes/math.MathMatrix.html
+++ b/api/classes/math.MathMatrix.html
@@ -23,14 +23,14 @@ and Pages centre every column.
diff --git a/api/classes/math.MathPhantom.html b/api/classes/math.MathPhantom.html
index cc9fce2b2a..8d7676ad68 100644
--- a/api/classes/math.MathPhantom.html
+++ b/api/classes/math.MathPhantom.html
@@ -21,14 +21,14 @@ line things up with it. Or math that is seen but takes up no room, or less, as <
diff --git a/api/classes/shapes.ShapeCanvasRun.html b/api/classes/shapes.ShapeCanvasRun.html
index b15b21e37e..733f5f9b6b 100644
--- a/api/classes/shapes.ShapeCanvasRun.html
+++ b/api/classes/shapes.ShapeCanvasRun.html
@@ -28,14 +28,14 @@ written in mc:AlternateContent, with the group as its fallback, unl
diff --git a/api/classes/shapes.ShapeGroupRun.html b/api/classes/shapes.ShapeGroupRun.html
index dcda100178..1e7e0d2400 100644
--- a/api/classes/shapes.ShapeGroupRun.html
+++ b/api/classes/shapes.ShapeGroupRun.html
@@ -28,14 +28,14 @@ when shapes are moved on a Copy
diff --git a/api/classes/shapes.ShapeRun.html b/api/classes/shapes.ShapeRun.html
index 73a7b591ce..96b611b6ad 100644
--- a/api/classes/shapes.ShapeRun.html
+++ b/api/classes/shapes.ShapeRun.html
@@ -26,14 +26,14 @@ and arrowheads, and text inside it. It sits inline with text unless floati
diff --git a/api/classes/watermarks.ImageWatermark.html b/api/classes/watermarks.ImageWatermark.html
index c4529f12a6..a5b1a86211 100644
--- a/api/classes/watermarks.ImageWatermark.html
+++ b/api/classes/watermarks.ImageWatermark.html
@@ -39,14 +39,14 @@ way as an ImageRun.
diff --git a/api/classes/watermarks.TextWatermark.html b/api/classes/watermarks.TextWatermark.html
index f7a05f55e5..a450685892 100644
--- a/api/classes/watermarks.TextWatermark.html
+++ b/api/classes/watermarks.TextWatermark.html
@@ -37,14 +37,14 @@ recognizes it and can remove or replace it through that command.
\n option - causes the field result to be the paragraph number without trailing periods. No information about prior numbered levels is displayed unless it is included as part of the current level.
diff --git a/api/functions/index.convertToXmlComponent.html b/api/functions/index.convertToXmlComponent.html
index aa7ed3109f..7e19243832 100644
--- a/api/functions/index.convertToXmlComponent.html
+++ b/api/functions/index.convertToXmlComponent.html
@@ -36,7 +36,7 @@ of the original XML.
diff --git a/api/functions/index.createEmphasisMark.html b/api/functions/index.createEmphasisMark.html
index fc30f4b1da..401bf2dde2 100644
--- a/api/functions/index.createEmphasisMark.html
+++ b/api/functions/index.createEmphasisMark.html
@@ -37,7 +37,7 @@ text to emphasize it. This is commonly used in East Asian typography.
diff --git a/api/functions/index.createFrameProperties.html b/api/functions/index.createFrameProperties.html
index 4ba81a2265..aa4e115753 100644
--- a/api/functions/index.createFrameProperties.html
+++ b/api/functions/index.createFrameProperties.html
@@ -41,7 +41,7 @@ drop cap effects and various text wrapping options.
diff --git a/api/functions/index.createHorizontalPosition.html b/api/functions/index.createHorizontalPosition.html
index df589a0400..3746a63feb 100644
--- a/api/functions/index.createHorizontalPosition.html
+++ b/api/functions/index.createHorizontalPosition.html
@@ -40,7 +40,7 @@ object relative to a base element (page, margin, column, etc.).
diff --git a/api/functions/index.createMathAccentCharacter.html b/api/functions/index.createMathAccentCharacter.html
index b91333d817..c22523f84e 100644
--- a/api/functions/index.createMathAccentCharacter.html
+++ b/api/functions/index.createMathAccentCharacter.html
@@ -31,7 +31,7 @@ such as summation (∑), integral (∫), or product (∏) symbols.
diff --git a/api/functions/index.createMathNAryProperties.html b/api/functions/index.createMathNAryProperties.html
index f2710b6ebd..fb948d2b70 100644
--- a/api/functions/index.createMathNAryProperties.html
+++ b/api/functions/index.createMathNAryProperties.html
@@ -31,7 +31,7 @@ and integrals, including the operator character and limit positioning.
diff --git a/api/functions/index.createMathSubScriptElement.html b/api/functions/index.createMathSubScriptElement.html
index 98fc0678c4..14fd908881 100644
--- a/api/functions/index.createMathSubScriptElement.html
+++ b/api/functions/index.createMathSubScriptElement.html
@@ -31,7 +31,7 @@ script objects, and other structures that support subscripts.
diff --git a/api/functions/index.createMathSuperScriptElement.html b/api/functions/index.createMathSuperScriptElement.html
index 1c930e83c4..54d1a31dce 100644
--- a/api/functions/index.createMathSuperScriptElement.html
+++ b/api/functions/index.createMathSuperScriptElement.html
@@ -31,7 +31,7 @@ script objects, and other structures that support superscripts.
Creates page margins (pgMar) for a document section.
This element specifies the page margins for all pages in a section,
@@ -28,13 +28,13 @@ including top, bottom, left, right, header, footer, and gutter margins.
diff --git a/api/functions/index.createPageNumberType.html b/api/functions/index.createPageNumberType.html
index 754cb72081..cec9531297 100644
--- a/api/functions/index.createPageNumberType.html
+++ b/api/functions/index.createPageNumberType.html
@@ -37,7 +37,7 @@ for all pages in a section.
diff --git a/api/functions/index.createSectionType.html b/api/functions/index.createSectionType.html
index f3c50c63fb..3d6673bd0b 100644
--- a/api/functions/index.createSectionType.html
+++ b/api/functions/index.createSectionType.html
@@ -37,7 +37,7 @@ where the new section begins relative to the previous section.
diff --git a/api/functions/index.createTableFloatProperties.html b/api/functions/index.createTableFloatProperties.html
index 87b1b1ba35..20fbaab07e 100644
--- a/api/functions/index.createTableFloatProperties.html
+++ b/api/functions/index.createTableFloatProperties.html
@@ -38,7 +38,7 @@ The overlap option isn't part of it: the table properties write it as w:tblOverl
diff --git a/api/functions/index.createTableLook.html b/api/functions/index.createTableLook.html
index 399993cb5d..130ac61988 100644
--- a/api/functions/index.createTableLook.html
+++ b/api/functions/index.createTableLook.html
@@ -34,7 +34,7 @@ styles to apply special formatting to specific regions of the table.
diff --git a/api/functions/index.createWrapNone.html b/api/functions/index.createWrapNone.html
index d35d7fc6c5..8d95152d4e 100644
--- a/api/functions/index.createWrapNone.html
+++ b/api/functions/index.createWrapNone.html
@@ -23,7 +23,7 @@ without wrapping around it.
diff --git a/api/functions/index.createWrapSquare.html b/api/functions/index.createWrapSquare.html
index f436d65ac6..9125c48c10 100644
--- a/api/functions/index.createWrapSquare.html
+++ b/api/functions/index.createWrapSquare.html
@@ -32,7 +32,7 @@ of the drawing on the specified side(s).
diff --git a/api/functions/index.createWrapThrough.html b/api/functions/index.createWrapThrough.html
index f119b81ee5..5bae5ddaa2 100644
--- a/api/functions/index.createWrapThrough.html
+++ b/api/functions/index.createWrapThrough.html
@@ -36,7 +36,7 @@ fills any open space inside the drawing, such as the middle of a ring.
diff --git a/api/functions/index.createWrapTight.html b/api/functions/index.createWrapTight.html
index d643867fe9..e221101e9f 100644
--- a/api/functions/index.createWrapTight.html
+++ b/api/functions/index.createWrapTight.html
@@ -36,7 +36,7 @@ of the drawing rather than its rectangular bounding box.
diff --git a/api/functions/index.dateTimeValue.html b/api/functions/index.dateTimeValue.html
index f3e70002fc..453fc49319 100644
--- a/api/functions/index.dateTimeValue.html
+++ b/api/functions/index.dateTimeValue.html
@@ -36,7 +36,7 @@ This matches the xsd:dateTime format required by OOXML.
diff --git a/api/functions/index.patchDocument.html b/api/functions/index.patchDocument.html
index 209575a924..67f5d75e2d 100644
--- a/api/functions/index.patchDocument.html
+++ b/api/functions/index.patchDocument.html
@@ -42,7 +42,7 @@ the original document structure and optionally the original formatting.
diff --git a/api/functions/math.latexToMath.html b/api/functions/math.latexToMath.html
index 68f908c0ac..97a0f7ca41 100644
--- a/api/functions/math.latexToMath.html
+++ b/api/functions/math.latexToMath.html
@@ -44,7 +44,7 @@ cases and aligned equations, with \tag for their numbers. The math
diff --git a/api/interfaces/index.IXmlableObject.html b/api/interfaces/index.IXmlableObject.html
index feb87353b3..53b0a42db8 100644
--- a/api/interfaces/index.IXmlableObject.html
+++ b/api/interfaces/index.IXmlableObject.html
@@ -19,7 +19,7 @@ to generate the final XML output. Objects typically have a structure like:
-
+
Hierarchy
Record<string,unknown>
@@ -31,7 +31,7 @@ to generate the final XML output. Objects typically have a structure like:
diff --git a/api/types/charts.BarChartBaseOptions.html b/api/types/charts.BarChartBaseOptions.html
index afaa2be743..d4d4da1e6b 100644
--- a/api/types/charts.BarChartBaseOptions.html
+++ b/api/types/charts.BarChartBaseOptions.html
@@ -31,7 +31,7 @@ Default is Office's: -27 for column charts and 0 for bar charts. Stacked bars al
@@ -49,14 +49,14 @@ bar, line or area chart spaces them by date
Sales. 2025: Jan 10, Feb 20.", and none for a decorative chart. An empty description removes it
+
diff --git a/api/types/charts.CategoryChartOptions.html b/api/types/charts.CategoryChartOptions.html
index c26a3e23fc..a70cb8a407 100644
--- a/api/types/charts.CategoryChartOptions.html
+++ b/api/types/charts.CategoryChartOptions.html
@@ -59,7 +59,7 @@ in years, are labelled in rows, the groups below their categories
diff --git a/api/types/charts.ChartAxisCrossing.html b/api/types/charts.ChartAxisCrossing.html
index d78f377b20..c5fa73ae3c 100644
--- a/api/types/charts.ChartAxisCrossing.html
+++ b/api/types/charts.ChartAxisCrossing.html
@@ -20,7 +20,7 @@ the value is the category's number, from 1, or when the categories are dates, a
diff --git a/api/types/charts.ChartAxisGroup.html b/api/types/charts.ChartAxisGroup.html
index b0b7f9d3a2..081136928f 100644
--- a/api/types/charts.ChartAxisGroup.html
+++ b/api/types/charts.ChartAxisGroup.html
@@ -19,7 +19,7 @@ chart's are along the bottom and the top.
diff --git a/api/types/charts.ChartCategoryGroup.html b/api/types/charts.ChartCategoryGroup.html
index 67120d2e01..d9db949b70 100644
--- a/api/types/charts.ChartCategoryGroup.html
+++ b/api/types/charts.ChartCategoryGroup.html
@@ -20,7 +20,7 @@ categories, or groups of its own, such as the months of each quarter of each yea
@@ -67,21 +67,21 @@ a point, and where they fit best on a pie. A chart's position is for the series
another way keep Office's, unless their own labels give one
diff --git a/api/types/charts.ChartDataPatchOptions.html b/api/types/charts.ChartDataPatchOptions.html
index 17491c77bf..47502779bb 100644
--- a/api/types/charts.ChartDataPatchOptions.html
+++ b/api/types/charts.ChartDataPatchOptions.html
@@ -19,7 +19,7 @@ series' points, or for a stock chart its prices.
diff --git a/api/types/charts.ChartErrorBarsAmount.html b/api/types/charts.ChartErrorBarsAmount.html
index 9f2213056d..80e81ed5f3 100644
--- a/api/types/charts.ChartErrorBarsAmount.html
+++ b/api/types/charts.ChartErrorBarsAmount.html
@@ -64,7 +64,7 @@ deviations, or the standard error.
diff --git a/api/types/charts.ChartLineDash.html b/api/types/charts.ChartLineDash.html
index e2b720e427..88a535dfbe 100644
--- a/api/types/charts.ChartLineDash.html
+++ b/api/types/charts.ChartLineDash.html
@@ -19,7 +19,7 @@ and so on.
diff --git a/api/types/charts.ChartPointLabel.html b/api/types/charts.ChartPointLabel.html
index 45100fe36d..b6db29a5ed 100644
--- a/api/types/charts.ChartPointLabel.html
+++ b/api/types/charts.ChartPointLabel.html
@@ -19,7 +19,7 @@ format and its font. Anything left out is as the series' labels have it.
diff --git a/api/types/charts.ChartTrendline.html b/api/types/charts.ChartTrendline.html
index c28471cda4..1c87f30f49 100644
--- a/api/types/charts.ChartTrendline.html
+++ b/api/types/charts.ChartTrendline.html
@@ -20,7 +20,7 @@ forecast. It is drawn as a dotted line in the series' colour, and has an entry i
@@ -57,7 +57,7 @@ forecast. It is drawn as a dotted line in the series' colour, and has an entry i
along the x axis. Default is 0. Not for moving averages
@@ -73,35 +73,35 @@ the x axis. Default is 0. Not for moving averages
linear, exponential and polynomial trendlines, and above 0 for exponential ones
+
diff --git a/api/types/charts.ChartValueAxis.html b/api/types/charts.ChartValueAxis.html
index dc8a1fb7f6..a63d7dd66c 100644
--- a/api/types/charts.ChartValueAxis.html
+++ b/api/types/charts.ChartValueAxis.html
@@ -43,7 +43,7 @@ of 0 or less can't be shown. Default is a linear scale
diff --git a/api/types/charts.ComboChartSeriesType.html b/api/types/charts.ComboChartSeriesType.html
index 67e953f0a9..d83ce9a0f7 100644
--- a/api/types/charts.ComboChartSeriesType.html
+++ b/api/types/charts.ComboChartSeriesType.html
@@ -19,7 +19,7 @@ or an area. A chart with series of more than one type is Word's "Combo"
@@ -59,14 +59,14 @@ with undefined, takes the next of the theme's accent colours
one for each slice in the order of the categories, where undefined leaves a slice in. Default is 0
+
diff --git a/api/types/charts.SplitPieChartBaseOptions.html b/api/types/charts.SplitPieChartBaseOptions.html
index 4fd7c9a4a3..2cc9d719f9 100644
--- a/api/types/charts.SplitPieChartBaseOptions.html
+++ b/api/types/charts.SplitPieChartBaseOptions.html
@@ -42,7 +42,7 @@ second pie or a stacked bar, joined to the slice of the pie that stands for them
diff --git a/api/types/index.AttributePayload.html b/api/types/index.AttributePayload.html
index 68aa7d7830..8c456bbf88 100644
--- a/api/types/index.AttributePayload.html
+++ b/api/types/index.AttributePayload.html
@@ -21,7 +21,7 @@ control over attribute name mapping.
Specifies the additional length, in EMUs, which shall be added to the bottom edge of the DrawingML object to determine its actual bottom edge including effects.
Specifies the additional length, in EMUs, which shall be added to the left edge of the DrawingML object to determine its actual left edge including effects.
Specifies the additional length, in EMUs, which shall be added to the right edge of the DrawingML object to determine its actual right edge including effects.
Specifies the additional length, in EMUs, which shall be added to the top edge of the DrawingML object to determine its actual top edge including effects.
diff --git a/api/types/index.GraphicMediaData.html b/api/types/index.GraphicMediaData.html
index 9877b66bc1..5ad533854a 100644
--- a/api/types/index.GraphicMediaData.html
+++ b/api/types/index.GraphicMediaData.html
@@ -25,7 +25,7 @@ graphic it is. This is how docx/shapes writes its shapes.
diff --git a/api/types/index.IContext.html b/api/types/index.IContext.html
index e5e95cf786..d56bf4d546 100644
--- a/api/types/index.IContext.html
+++ b/api/types/index.IContext.html
@@ -18,7 +18,7 @@ during the conversion of components to XML.
diff --git a/api/types/index.ICropOptions.html b/api/types/index.ICropOptions.html
index 89f81dec00..b4aa68d79f 100644
--- a/api/types/index.ICropOptions.html
+++ b/api/types/index.ICropOptions.html
@@ -19,7 +19,7 @@ side of the image.
The grid can define a grid which snaps all East Asian characters to grid positions, but leaves Latin text with its default spacing; a grid which adds the specified character pitch to each character on each row; or a grid which affects only the line pitch for the current section.
Specifies that the paragraph (or at least part of it) should be rendered on the same page as the next paragraph when possible. If multiple paragraphs are to be kept together but they exceed a page, then the set of paragraphs begin on a new page and page breaks are used thereafter as needed.
diff --git a/api/types/index.IRunOptions.html b/api/types/index.IRunOptions.html
index 5a562e45de..7ff1bc688e 100644
--- a/api/types/index.IRunOptions.html
+++ b/api/types/index.IRunOptions.html
@@ -21,7 +21,7 @@ The children property can contain various inline content elements.
diff --git a/api/types/index.IRunStylePropertiesOptions.html b/api/types/index.IRunStylePropertiesOptions.html
index 5c632f29a1..c858108eb0 100644
--- a/api/types/index.IRunStylePropertiesOptions.html
+++ b/api/types/index.IRunStylePropertiesOptions.html
@@ -19,7 +19,7 @@ including font, size, bold, italic, underline, color, and other character format
@@ -140,117 +140,117 @@ including font, size, bold, italic, underline, color, and other character format
highlights all the run's text. docx used to write it as w:highlightCs, which is in no schema.
diff --git a/api/types/index.ITableCellBorders.html b/api/types/index.ITableCellBorders.html
index f5c314c9d2..073e1fd8f3 100644
--- a/api/types/index.ITableCellBorders.html
+++ b/api/types/index.ITableCellBorders.html
@@ -22,7 +22,7 @@ can be specified for top, bottom, left, right, start, and end edges.
@@ -46,7 +46,7 @@ If relativeHorizontalPosition is also specified, then the absoluteHorizontalPosi
If the attribute is omitted, the value is assumed to be zero.
@@ -57,7 +57,7 @@ If relativeVerticalPosition is also specified, then the absoluteVerticalPosition
If the attribute is omitted, the value is assumed to be zero.
@@ -65,7 +65,7 @@ If the attribute is omitted, the value is assumed to be zero.
below the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -85,7 +85,7 @@ If omitted, the value is assumed to be page.
to the left of the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -121,7 +121,7 @@ inline - the table should be vertically aligned in line with the surrounding tex
top - the table should be vertically aligned to the top edge of the anchor
+
@@ -129,7 +129,7 @@ top - the table should be vertically aligned to the top edge of the anchor
to the right of the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -137,7 +137,7 @@ to the right of the table. The value is in twentieths of a point. If omitted, th
above the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -88,7 +88,7 @@ When true, horizontal banding (alternating row colors) is disabled.
When false or undefined, horizontal banding is enabled if defined in the table style.
+
@@ -97,7 +97,7 @@ When true, vertical banding (alternating column colors) is disabled.
When false or undefined, vertical banding is enabled if defined in the table style.
+
diff --git a/api/types/index.ITableOfContentsOptions.html b/api/types/index.ITableOfContentsOptions.html
index 880aaf0050..bb31303bd5 100644
--- a/api/types/index.ITableOfContentsOptions.html
+++ b/api/types/index.ITableOfContentsOptions.html
@@ -23,7 +23,7 @@ Options correspond to field switches in the TOC field code.
@@ -59,7 +59,7 @@ The identifier designated by text in this switch's field-argument corresponds to
Use captionLabelIncludingNumbers (\c) to build a table of captions with labels and numbers.
@@ -85,7 +85,7 @@ the bookmark named by text in this switch's field-argument.
that separate an entry and its page number. The default is a tab with leader dots.
+
@@ -96,21 +96,21 @@ to the style with a style ID of HeadingX (e.g. 1 corresponds to Heading1).
If no heading range is specified, all heading levels used in the document are listed.
+
@@ -119,21 +119,21 @@ Page numbers are omitted from all levels unless a range of entry levels is speci
text in this switch's field-argument. A range is specified as for \l.
+
@@ -168,7 +168,7 @@ with each doublet being a comma-separated set of style name and table of content
text in this switch's field-argument (which is typically a letter).
+
@@ -178,14 +178,14 @@ where startLevel and endLevel are integers, and startLevel has a value equal-to
TC fields that assign entries to lower levels are skipped.
+
@@ -74,64 +74,64 @@ parent cell) when the document is packed, so the table renders the same in every
consumer. Supply explicit values to take full control of the grid.
diff --git a/api/types/index.IThemeColorsOptions.html b/api/types/index.IThemeColorsOptions.html
index 5e378d6a55..c58e70422f 100644
--- a/api/types/index.IThemeColorsOptions.html
+++ b/api/types/index.IThemeColorsOptions.html
@@ -21,7 +21,7 @@ when the theme's colors change. The colors not given are Office's.
diff --git a/api/types/index.IXmlAttribute.html b/api/types/index.IXmlAttribute.html
index e33b25042d..f0c6c128cd 100644
--- a/api/types/index.IXmlAttribute.html
+++ b/api/types/index.IXmlAttribute.html
@@ -17,7 +17,7 @@
numbers, or booleans, which will be converted to strings in the final XML.
diff --git a/api/types/index.MathRunStyle.html b/api/types/index.MathRunStyle.html
index 5013a88a8a..5a27d3883a 100644
--- a/api/types/index.MathRunStyle.html
+++ b/api/types/index.MathRunStyle.html
@@ -23,7 +23,7 @@
alphabet other than roman is plain unless given a style, as LaTeX draws its alphabets upright.
diff --git a/api/types/index.OutputByType.html b/api/types/index.OutputByType.html
index e91c4cba8e..0714c23aed 100644
--- a/api/types/index.OutputByType.html
+++ b/api/types/index.OutputByType.html
@@ -24,7 +24,7 @@ format determines the return type. Based on JSZip's output types.
diff --git a/api/types/index.ParagraphChild.html b/api/types/index.ParagraphChild.html
index 6f9fa2aae7..9eb12bb518 100644
--- a/api/types/index.ParagraphChild.html
+++ b/api/types/index.ParagraphChild.html
@@ -17,7 +17,7 @@ This union type represents all valid inline content elements that can appear
within a paragraph in WordprocessingML.
diff --git a/api/types/index.RelationshipType.html b/api/types/index.RelationshipType.html
index 388a4ee96d..f7685f2c6e 100644
--- a/api/types/index.RelationshipType.html
+++ b/api/types/index.RelationshipType.html
@@ -17,7 +17,7 @@
Each type corresponds to a specific kind of document component or resource.
Specifies the height of the containing block of the shape. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the left of the containing block of the shape relative to the element left of it in the flow of the page. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. This property shall not be used for shapes anchored inline.
Specifies the position of the bottom of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the left of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the right of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the top of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the type of positioning used to place an element. Default is static. When the element is contained inside a group, this property must be absolute.
Specifies relative horizontal position data for objects in WordprocessingML documents. This modifies the mso-position-horizontal property. Default is text.
Specifies relative vertical position data for objects in WordprocessingML documents. This modifies the mso-position-vertical property. Default is text.
Specifies the position of the top of the containing block of the shape relative to the element above it in the flow of the page. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. This property shall not be used for shapes anchored inline.
Specifies the width of the containing block of the shape. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the distance from the bottom of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies the distance from the left side of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies the distance from the right side of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies the distance from the top of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies whether the wrap coordinates were customized by the user. If the wrap coordinates are generated by an editor, this property is true; otherwise they were customized by a user. Default is false.
diff --git a/api/types/shapes.ConnectorEnd.html b/api/types/shapes.ConnectorEnd.html
index 8fc0ec1159..aa797588b7 100644
--- a/api/types/shapes.ConnectorEnd.html
+++ b/api/types/shapes.ConnectorEnd.html
@@ -38,7 +38,7 @@ bottom-left corner. On a shape without connection points, the connector ends at
diff --git a/api/types/shapes.CustomShapeGeometry.html b/api/types/shapes.CustomShapeGeometry.html
index fd330dfbbb..2af69540f7 100644
--- a/api/types/shapes.CustomShapeGeometry.html
+++ b/api/types/shapes.CustomShapeGeometry.html
@@ -50,7 +50,7 @@ fill the shape. Later paths are drawn over earlier ones
diff --git a/api/types/shapes.CustomShapePath.html b/api/types/shapes.CustomShapePath.html
index 026871fcf1..92e0bfddbf 100644
--- a/api/types/shapes.CustomShapePath.html
+++ b/api/types/shapes.CustomShapePath.html
@@ -20,7 +20,7 @@ own, so paths can overlap without cutting holes in each other.
diff --git a/api/types/shapes.CustomShapePathFill.html b/api/types/shapes.CustomShapePathFill.html
index 0cbeb10530..8ea0eb72c2 100644
--- a/api/types/shapes.CustomShapePathFill.html
+++ b/api/types/shapes.CustomShapePathFill.html
@@ -19,7 +19,7 @@ fill made lighter or darker, as Word's preset shapes shade the top of a cube or
diff --git a/api/types/shapes.IShapeCanvasOptions.html b/api/types/shapes.IShapeCanvasOptions.html
index 43cf35a634..09a8ca0e76 100644
--- a/api/types/shapes.IShapeCanvasOptions.html
+++ b/api/types/shapes.IShapeCanvasOptions.html
@@ -64,7 +64,7 @@ The shapes are not scaled.
diff --git a/api/types/shapes.IShapeConnectorOptions.html b/api/types/shapes.IShapeConnectorOptions.html
index b14672ffc5..296d2bcc30 100644
--- a/api/types/shapes.IShapeConnectorOptions.html
+++ b/api/types/shapes.IShapeConnectorOptions.html
@@ -23,7 +23,7 @@ or several connectors join the same two shapes, their ends are spread out along
@@ -64,21 +64,21 @@ or several connectors join the same two shapes, their ends are spread out along
shape, so Word doesn't move it when the connector moves
diff --git a/api/types/shapes.IShapeGroupChildOptions.html b/api/types/shapes.IShapeGroupChildOptions.html
index 114d398315..311ef9dfd8 100644
--- a/api/types/shapes.IShapeGroupChildOptions.html
+++ b/api/types/shapes.IShapeGroupChildOptions.html
@@ -20,7 +20,7 @@ in pixels, unless a layout places it, and id names it
diff --git a/api/types/shapes.IShapeGroupOptions.html b/api/types/shapes.IShapeGroupOptions.html
index 430f28b5ad..13c11ec02f 100644
--- a/api/types/shapes.IShapeGroupOptions.html
+++ b/api/types/shapes.IShapeGroupOptions.html
@@ -50,7 +50,7 @@ the box around the children. A different size scales every shape in the group.
diff --git a/api/types/shapes.IShapeNestedGroupOptions.html b/api/types/shapes.IShapeNestedGroupOptions.html
index 9a931aa778..bdcb166426 100644
--- a/api/types/shapes.IShapeNestedGroupOptions.html
+++ b/api/types/shapes.IShapeNestedGroupOptions.html
@@ -47,7 +47,7 @@ box around the children, and a different size scales every child
diff --git a/api/types/shapes.IShapeOptions.html b/api/types/shapes.IShapeOptions.html
index e8b550d2d0..ac573f901e 100644
--- a/api/types/shapes.IShapeOptions.html
+++ b/api/types/shapes.IShapeOptions.html
@@ -23,7 +23,7 @@ or startAngle and endAngle for a "pie"
diff --git a/api/types/shapes.PresetShapeAdjustments.html b/api/types/shapes.PresetShapeAdjustments.html
index 46008d66c1..1d58b22001 100644
--- a/api/types/shapes.PresetShapeAdjustments.html
+++ b/api/types/shapes.PresetShapeAdjustments.html
@@ -21,7 +21,7 @@ allows, so a value that is too large acts like the largest allowed value.
diff --git a/api/types/shapes.ShapeAdjustments.html b/api/types/shapes.ShapeAdjustments.html
index f1d0dc1035..4902ed5b22 100644
--- a/api/types/shapes.ShapeAdjustments.html
+++ b/api/types/shapes.ShapeAdjustments.html
@@ -23,7 +23,7 @@ It is never for shapes without handles, which take no adjustments.<
diff --git a/api/types/shapes.ShapeFlowLayout.html b/api/types/shapes.ShapeFlowLayout.html
index df6788a5a0..264d076225 100644
--- a/api/types/shapes.ShapeFlowLayout.html
+++ b/api/types/shapes.ShapeFlowLayout.html
@@ -20,7 +20,7 @@ that connect to it, and the shapes on each level are ordered so connectors cross
@@ -52,26 +52,26 @@ with a lane goes in the band of that name, and shapes without one g
across the direction the flow runs in, each with a header at the start of the flow
diff --git a/api/types/shapes.ShapeHorizontalPosition.html b/api/types/shapes.ShapeHorizontalPosition.html
index 4d6ede0679..c5a6f24d66 100644
--- a/api/types/shapes.ShapeHorizontalPosition.html
+++ b/api/types/shapes.ShapeHorizontalPosition.html
@@ -26,7 +26,7 @@ a base of the page, the space between its margins, or one of its margins
diff --git a/api/types/shapes.ShapeLayout.html b/api/types/shapes.ShapeLayout.html
index 497b1b9206..d5eddec3d4 100644
--- a/api/types/shapes.ShapeLayout.html
+++ b/api/types/shapes.ShapeLayout.html
@@ -20,7 +20,7 @@ layout, which is placed around them. Connectors are routed after the shapes are
diff --git a/api/types/shapes.ShapeSize.html b/api/types/shapes.ShapeSize.html
index 5f1f1b74ed..7211fe4404 100644
--- a/api/types/shapes.ShapeSize.html
+++ b/api/types/shapes.ShapeSize.html
@@ -19,7 +19,7 @@ percentage of the space between the page's margins, or of what floating.si
diff --git a/api/types/shapes.ShapeTextWarp.html b/api/types/shapes.ShapeTextWarp.html
index 6009896b8e..8a31345ed1 100644
--- a/api/types/shapes.ShapeTextWarp.html
+++ b/api/types/shapes.ShapeTextWarp.html
@@ -19,7 +19,7 @@ The ...Filled arches, circle and button spread the text over the wh
diff --git a/api/types/shapes.ShapeThemeColor.html b/api/types/shapes.ShapeThemeColor.html
index 4993f599bd..9ae32e3c30 100644
--- a/api/types/shapes.ShapeThemeColor.html
+++ b/api/types/shapes.ShapeThemeColor.html
@@ -20,7 +20,7 @@ same as docx's ThemeColor, which text, borders and sha
diff --git a/api/types/shapes.ShapeTransformation.html b/api/types/shapes.ShapeTransformation.html
index 8bb9ace86f..efa04d7a14 100644
--- a/api/types/shapes.ShapeTransformation.html
+++ b/api/types/shapes.ShapeTransformation.html
@@ -30,7 +30,7 @@ between the margins for a floating shape, such as "100%"<
diff --git a/api/types/shapes.ShapeTreeLayout.html b/api/types/shapes.ShapeTreeLayout.html
index 3d38c56004..e3590befa9 100644
--- a/api/types/shapes.ShapeTreeLayout.html
+++ b/api/types/shapes.ShapeTreeLayout.html
@@ -20,7 +20,7 @@ children are placed side by side below their parent, which is centred over them.
diff --git a/api/types/shapes.ShapeVerticalPosition.html b/api/types/shapes.ShapeVerticalPosition.html
index d48f555d92..9560053c9c 100644
--- a/api/types/shapes.ShapeVerticalPosition.html
+++ b/api/types/shapes.ShapeVerticalPosition.html
@@ -26,7 +26,7 @@ a base of the page, the space between its margins, or one of its margins
diff --git a/api/variables/index.CharacterSet.html b/api/variables/index.CharacterSet.html
index 99fd8c7f07..661fb30dc6 100644
--- a/api/variables/index.CharacterSet.html
+++ b/api/variables/index.CharacterSet.html
@@ -60,7 +60,7 @@ Maps character set names to their hexadecimal identifiers.
diff --git a/api/variables/index.DocumentAttributeNamespaces.html b/api/variables/index.DocumentAttributeNamespaces.html
index e3e8e85247..9593c11898 100644
--- a/api/variables/index.DocumentAttributeNamespaces.html
+++ b/api/variables/index.DocumentAttributeNamespaces.html
@@ -94,7 +94,7 @@ in a document, including WordprocessingML, DrawingML, VML, and others.
When this value is set, the input specified via the user interface may be restricted to the number of lines per page and characters per line, with the consumer or producer translating this information based on the current font data to get the resulting line and character pitch values
diff --git a/api/variables/index.DropCapType.html b/api/variables/index.DropCapType.html
index 66ab6baf63..f5b9b14145 100644
--- a/api/variables/index.DropCapType.html
+++ b/api/variables/index.DropCapType.html
@@ -32,7 +32,7 @@ beginning of a paragraph. This enum defines how the drop cap should be positione
diff --git a/api/variables/index.EMPTY_OBJECT.html b/api/variables/index.EMPTY_OBJECT.html
index dc686a58d6..573c64e3b2 100644
--- a/api/variables/index.EMPTY_OBJECT.html
+++ b/api/variables/index.EMPTY_OBJECT.html
@@ -20,7 +20,7 @@ has no children or attributes.
diff --git a/api/variables/index.EmphasisMarkType.html b/api/variables/index.EmphasisMarkType.html
index 6d435a644a..03d4b7568a 100644
--- a/api/variables/index.EmphasisMarkType.html
+++ b/api/variables/index.EmphasisMarkType.html
@@ -31,7 +31,7 @@ Emphasis marks are commonly used in East Asian typography.
Specifies that this header or footer shall appear on the first page in this section. The appearance of this header or footer is contingent on the setting of the titlePg element (§2.10.6).
diff --git a/api/variables/index.LevelFormat.html b/api/variables/index.LevelFormat.html
index 310dd72855..017ad7f49d 100644
--- a/api/variables/index.LevelFormat.html
+++ b/api/variables/index.LevelFormat.html
@@ -281,7 +281,7 @@ decimal, roman numerals, letters, and various international formats.
diff --git a/api/variables/index.PageTextDirectionType.html b/api/variables/index.PageTextDirectionType.html
index b9e19187b5..39fff9d10f 100644
--- a/api/variables/index.PageTextDirectionType.html
+++ b/api/variables/index.PageTextDirectionType.html
@@ -28,7 +28,7 @@ vertically (top-to-bottom), commonly used for East Asian languages.
Top-to-bottom, right-to-left (vertical East Asian text flow)
diff --git a/api/variables/index.PatchType.html b/api/variables/index.PatchType.html
index c5db5615cf..7cb2c54de7 100644
--- a/api/variables/index.PatchType.html
+++ b/api/variables/index.PatchType.html
@@ -35,7 +35,7 @@ in Word. See
diff --git a/api/variables/index.ShadingType.html b/api/variables/index.ShadingType.html
index 6213dba419..fbf3101dc7 100644
--- a/api/variables/index.ShadingType.html
+++ b/api/variables/index.ShadingType.html
@@ -103,7 +103,7 @@ color and the pattern color.
diff --git a/api/variables/index.TextEffect.html b/api/variables/index.TextEffect.html
index 295fbea66e..d78def6396 100644
--- a/api/variables/index.TextEffect.html
+++ b/api/variables/index.TextEffect.html
@@ -56,7 +56,7 @@ these effects are deprecated and may not be supported by all applications.
diff --git a/api/variables/index.VerticalAlign.html b/api/variables/index.VerticalAlign.html
index 6a013a6447..1b210677bb 100644
--- a/api/variables/index.VerticalAlign.html
+++ b/api/variables/index.VerticalAlign.html
@@ -32,7 +32,7 @@ backward-compatibility and will be removed in the next major release.
diff --git a/api/variables/index.VerticalAlignTable.html b/api/variables/index.VerticalAlignTable.html
index c0615ad90d..f218d929d0 100644
--- a/api/variables/index.VerticalAlignTable.html
+++ b/api/variables/index.VerticalAlignTable.html
@@ -28,7 +28,7 @@ are valid according to ECMA-376 (§17.18.87 ST_VerticalJc within <w:tcP
diff --git a/api/variables/index.VerticalMergeType.html b/api/variables/index.VerticalMergeType.html
index 34fcdb638f..feba4770a3 100644
--- a/api/variables/index.VerticalMergeType.html
+++ b/api/variables/index.VerticalMergeType.html
@@ -29,7 +29,7 @@ This cell continues a vertical merge started by a cell above it.
This cell begins a new vertical merge region.
diff --git a/api/variables/index.bookmarkUniqueNumericId.html b/api/variables/index.bookmarkUniqueNumericId.html
index 7f856a5bba..515f7d7a7e 100644
--- a/api/variables/index.bookmarkUniqueNumericId.html
+++ b/api/variables/index.bookmarkUniqueNumericId.html
@@ -27,7 +27,7 @@ than a generator per instance.
diff --git a/api/variables/index.docPropertiesUniqueNumericId.html b/api/variables/index.docPropertiesUniqueNumericId.html
index e9cc5aa1a9..d9654b1691 100644
--- a/api/variables/index.docPropertiesUniqueNumericId.html
+++ b/api/variables/index.docPropertiesUniqueNumericId.html
@@ -28,7 +28,7 @@ one counter rather than a generator per instance.
diff --git a/live-examples/lib/index.d.ts b/live-examples/lib/index.d.ts
index fb8fd65574..15aea668ae 100644
--- a/live-examples/lib/index.d.ts
+++ b/live-examples/lib/index.d.ts
@@ -386,6 +386,7 @@ declare class Body_2 extends XmlComponent {
* governs a given child of the body.
*/
private readonly sectionParagraphs;
+ private readonly headingBookmarkIds;
constructor();
/**
* Finds the section properties that govern a top-level child of the body.
@@ -418,7 +419,8 @@ declare class Body_2 extends XmlComponent {
* Prepares the body element for XML serialization.
*
* Ensures that the last section's properties are placed as a direct child of the body
- * element, as required by the OOXML specification.
+ * element, as required by the OOXML specification. Once the body is written, its tables
+ * of contents are filled in from its headings.
*
* @param context - The XML serialization context
* @returns The prepared XML object or undefined
@@ -12114,6 +12116,11 @@ export declare const TableLayoutType: {
* TableOfContents creates an auto-generated list of document headings
* with page numbers. It uses a TOC field code to generate entries.
*
+ * Unless it is given `cachedEntries` or `contentChildren`, it is written with an
+ * entry for each heading its options include, linked to a bookmark on the heading,
+ * so it isn't empty before Word updates it or in applications that don't update it.
+ * The page numbers are left for Word to fill in when it updates the field.
+ *
* Reference: http://officeopenxml.com/WPtableOfContents.php
*
* @publicApi
@@ -12138,6 +12145,8 @@ export declare const TableLayoutType: {
* ```
*/
export declare class TableOfContents extends FileChild {
+ /** What it is filled in with from the headings, when it isn't given its content */
+ private readonly fromHeadings?;
constructor(alias?: string, { contentChildren, cachedEntries, beginDirty, ...properties }?: ITableOfContentsOptions & {
readonly contentChildren?: readonly (XmlComponent | string)[];
/**
@@ -12148,6 +12157,13 @@ export declare class TableOfContents extends FileChild {
readonly cachedEntries?: readonly ToCEntry[];
readonly beginDirty?: boolean;
});
+ /**
+ * Written empty, and filled in from the headings once the body it is in is written, unless it was given its content.
+ * The page numbers are aligned to the right of the text in its section.
+ */
+ prepForXml(context: IContext): IXmlableObject | undefined;
+ /** The width of the text in the section it is in */
+ private textWidthIn;
private getTabStopsForLevel;
private buildCachedContentRun;
private buildCachedContentParagraphChild;
diff --git a/live-examples/lib/index.iife.js b/live-examples/lib/index.iife.js
index 91ec5e537c..cdbb1b33a8 100644
--- a/live-examples/lib/index.iife.js
+++ b/live-examples/lib/index.iife.js
@@ -20910,6 +20910,421 @@ MAX: 9026 };
}
};
//#endregion
+ //#region src/file/table-of-contents/field-instruction.ts
+ /**
+ * Field Instruction module for Table of Contents.
+ *
+ * This module handles the generation of TOC field instruction text
+ * that controls how the table of contents is built.
+ *
+ * Reference: http://officeopenxml.com/WPfieldInstructions.php
+ *
+ * @module
+ */
+ /**
+ * Represents a field instruction for a Table of Contents.
+ *
+ * The FieldInstruction class generates the TOC field code string that Word uses
+ * to determine how to build the table of contents, including which headings to include,
+ * formatting options, and other TOC-specific settings.
+ *
+ * Reference: http://officeopenxml.com/WPfieldInstructions.php
+ *
+ * ## XSD Schema
+ * ```xml
+ *
+ * ```
+ *
+ * @example
+ * ```typescript
+ * // Basic TOC field instruction
+ * new FieldInstruction({ headingStyleRange: "1-3" });
+ *
+ * // TOC with hyperlinks and custom styles
+ * new FieldInstruction({
+ * hyperlink: true,
+ * headingStyleRange: "1-3",
+ * stylesWithLevels: [new StyleLevel("CustomStyle", 2)],
+ * });
+ * ```
+ */
+ var FieldInstruction = class extends XmlComponent {
+ constructor(properties = {}) {
+ super("w:instrText");
+ _defineProperty(this, "properties", void 0);
+ this.properties = properties;
+ this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
+ let instruction = "TOC";
+ if (this.properties.captionLabel) instruction = `${instruction} \\a "${this.properties.captionLabel}"`;
+ if (this.properties.entriesFromBookmark) instruction = `${instruction} \\b "${this.properties.entriesFromBookmark}"`;
+ if (this.properties.captionLabelIncludingNumbers) instruction = `${instruction} \\c "${this.properties.captionLabelIncludingNumbers}"`;
+ if (this.properties.sequenceAndPageNumbersSeparator) instruction = `${instruction} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;
+ if (this.properties.tcFieldIdentifier) instruction = `${instruction} \\f "${this.properties.tcFieldIdentifier}"`;
+ if (this.properties.hyperlink) instruction = `${instruction} \\h`;
+ if (this.properties.tcFieldLevelRange) instruction = `${instruction} \\l "${this.properties.tcFieldLevelRange}"`;
+ if (this.properties.pageNumbersEntryLevelsRange) instruction = `${instruction} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;
+ if (this.properties.headingStyleRange) instruction = `${instruction} \\o "${this.properties.headingStyleRange}"`;
+ if (this.properties.entryAndPageNumberSeparator) instruction = `${instruction} \\p "${this.properties.entryAndPageNumberSeparator}"`;
+ if (this.properties.seqFieldIdentifierForPrefix) instruction = `${instruction} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;
+ if (this.properties.stylesWithLevels && this.properties.stylesWithLevels.length) {
+ const styles = this.properties.stylesWithLevels.map((sl) => `${sl.styleName},${sl.level}`).join(",");
+ instruction = `${instruction} \\t "${styles}"`;
+ }
+ if (this.properties.useAppliedParagraphOutlineLevel) instruction = `${instruction} \\u`;
+ if (this.properties.preserveTabInEntries) instruction = `${instruction} \\w`;
+ if (this.properties.preserveNewLineInEntries) instruction = `${instruction} \\x`;
+ if (this.properties.hideTabAndPageNumbersInWebView) instruction = `${instruction} \\z`;
+ this.root.push(instruction);
+ }
+ };
+ //#endregion
+ //#region src/file/table-of-contents/sdt-content.ts
+ /**
+ * Structured Document Tag Content module.
+ *
+ * This module represents the content container for structured document tags,
+ * including table of contents elements.
+ *
+ * Reference: http://officeopenxml.com/WPtableOfContents.php
+ *
+ * @module
+ */
+ /**
+ * Represents the content portion of a Structured Document Tag.
+ *
+ * The StructuredDocumentTagContent contains the actual content elements
+ * (paragraphs, tables, etc.) within a structured document tag, such as
+ * the paragraphs that make up a table of contents.
+ *
+ * Reference: http://officeopenxml.com/WPtableOfContents.php
+ *
+ * ## XSD Schema
+ * ```xml
+ *
+ *
+ *
+ * ```
+ *
+ * @example
+ * ```typescript
+ * const content = new StructuredDocumentTagContent();
+ * content.addChildElement(new Paragraph("Content"));
+ * ```
+ */
+ var StructuredDocumentTagContent = class extends XmlComponent {
+ constructor() {
+ super("w:sdtContent");
+ }
+ };
+ //#endregion
+ //#region src/file/table-of-contents/heading-entries.ts
+ /**
+ * Entries written into a table of contents from the headings of the document.
+ *
+ * A table of contents is a TOC field. Word fills in its entries when it updates the field. Until then, and in
+ * applications that don't update it, such as LibreOffice, it shows the entries it was last filled in with, and without
+ * any it is empty. So once the body is written, each table of contents that wasn't given `cachedEntries` or
+ * `contentChildren` is filled in from the headings its switches include, the way Word fills it in: each heading is
+ * bookmarked, and its entry links to the bookmark and gives its page with a PAGEREF field. The page numbers are left
+ * empty, because they depend on how the document is laid out. Word fills them in when it updates the field.
+ *
+ * @module
+ */
+ /** The formatted tables of contents, with what each is filled in with, or undefined when it was given its content */
+ var writtenTables = /* @__PURE__ */ new WeakMap();
+ /**
+ * Records a formatted table of contents, so the paragraphs in it aren't taken for headings, with what to fill it in
+ * with from the headings once the body it is in is written. That is undefined when it was given its content.
+ */
+ var recordTableOfContents = (table, fillWith) => {
+ writtenTables.set(table, fillWith);
+ };
+ /**
+ * The ids of the bookmarks on a body's headings: the first for its first bookmarked heading, and so on. Each is taken
+ * from the counter every bookmark shares, the first time it is needed, so a document packed again is written the same.
+ */
+ var HeadingBookmarkIds = class {
+ constructor() {
+ _defineProperty(this, "ids", []);
+ }
+ get(index) {
+ var _this$ids, _this$ids$index;
+ (_this$ids$index = (_this$ids = this.ids)[index]) !== null && _this$ids$index !== void 0 || (_this$ids[index] = bookmarkUniqueNumericId());
+ return this.ids[index];
+ }
+ };
+ /** The name of a formatted element, or `_attr` for its parent's attributes */
+ var nameOf$1 = (element) => typeof element === "object" && element !== null ? Object.keys(element)[0] : void 0;
+ /** The children of a formatted element. An element with only attributes has them as its one child */
+ var childrenOf = (element) => {
+ const name = nameOf$1(element);
+ const content = name === void 0 ? void 0 : element[name];
+ return Array.isArray(content) ? content : content === void 0 ? [] : [content];
+ };
+ var childOf = (element, name) => childrenOf(element).find((child) => nameOf$1(child) === name);
+ var attributeOf = (element, attribute) => {
+ var _childOf;
+ return (_childOf = childOf(element, "_attr")) === null || _childOf === void 0 || (_childOf = _childOf._attr) === null || _childOf === void 0 ? void 0 : _childOf[attribute];
+ };
+ /** An attribute such as `w:val="2"` as a number. Imported XML gives it as a string */
+ var numberAttributeOf = (element, attribute) => {
+ const value = attributeOf(element, attribute);
+ return value === void 0 ? void 0 : Number(value);
+ };
+ /** The block-level containers of paragraphs: tables, their rows and cells, and content controls */
+ var BLOCK_CONTAINERS = /* @__PURE__ */ new Set([
+ "w:tbl",
+ "w:tr",
+ "w:tc",
+ "w:sdt",
+ "w:sdtContent",
+ "w:customXml"
+ ]);
+ /**
+ * The paragraphs and the tables of contents, in the order they are in the body. A table of contents isn't looked into,
+ * so the paragraphs in it aren't taken for headings. Nor are paragraphs in text boxes, as in Word.
+ */
+ var blocksOf = (elements) => elements.flatMap((element) => {
+ const name = nameOf$1(element);
+ if (name === "w:p" || writtenTables.has(element)) return [element];
+ return name !== void 0 && BLOCK_CONTAINERS.has(name) ? blocksOf(childrenOf(element)) : [];
+ });
+ /** The elements in a paragraph that its text is in. Deleted text, field instructions and drawings aren't */
+ var TEXT_CONTAINERS = /* @__PURE__ */ new Set([
+ "w:r",
+ "w:hyperlink",
+ "w:ins",
+ "w:moveTo",
+ "w:smartTag",
+ "w:customXml",
+ "w:sdt",
+ "w:sdtContent",
+ "w:fldSimple",
+ "w:dir",
+ "w:bdo"
+ ]);
+ /** The text an element in a run stands for, such as `\t` for a tab. A page or column break isn't text */
+ var textOfRunContent = (element) => {
+ switch (nameOf$1(element)) {
+ case "w:t": return childrenOf(element).filter((child) => typeof child === "string").join("");
+ case "w:tab": return " ";
+ case "w:br": return [void 0, "textWrapping"].includes(attributeOf(element, "w:type")) ? "\n" : "";
+ case "w:cr": return "\n";
+ case "w:noBreakHyphen": return "-";
+ default: return "";
+ }
+ };
+ /** The text of a paragraph. Of a field, only its result is text, not its instruction */
+ var textOf = (paragraph) => {
+ const fields = [];
+ const read = (element) => {
+ const name = nameOf$1(element);
+ if (name !== void 0 && TEXT_CONTAINERS.has(name)) return childrenOf(element).map(read).join("");
+ if (name === "w:fldChar") {
+ const type = attributeOf(element, "w:fldCharType");
+ if (type === "begin") fields.push(false);
+ else if (type === "separate") fields[fields.length - 1] = true;
+ else fields.pop();
+ return "";
+ }
+ return fields.every(Boolean) ? textOfRunContent(element) : "";
+ };
+ return childrenOf(paragraph).map(read).join("");
+ };
+ /** The bookmarks started and ended in an element, in order */
+ var bookmarkMarksOf = (element) => {
+ const name = nameOf$1(element);
+ if (name === "w:bookmarkStart") return [{
+ start: true,
+ id: attributeOf(element, "w:id"),
+ name: attributeOf(element, "w:name")
+ }];
+ if (name === "w:bookmarkEnd") return [{
+ start: false,
+ id: attributeOf(element, "w:id")
+ }];
+ return name === void 0 || name === "_attr" ? [] : childrenOf(element).flatMap(bookmarkMarksOf);
+ };
+ /**
+ * The names of the bookmarks each paragraph is in, for the `\b` switch: those open where it starts, followed through the
+ * body, and those that start in it.
+ */
+ var bookmarksOf = (paragraphs) => {
+ const open = /* @__PURE__ */ new Map();
+ return paragraphs.map((paragraph) => {
+ const marks = bookmarkMarksOf(paragraph);
+ const names = /* @__PURE__ */ new Set([...open.values(), ...marks.flatMap((mark) => mark.start ? [mark.name] : [])]);
+ for (const mark of marks) if (mark.start) open.set(mark.id, mark.name);
+ else open.delete(mark.id);
+ return names;
+ });
+ };
+ /** The details of each paragraph that could be a heading. The bookmarks it is in are only followed when needed */
+ var paragraphDetailsOf = (paragraphs, followBookmarks) => {
+ const bookmarks = followBookmarks ? bookmarksOf(paragraphs) : [];
+ return paragraphs.map((element, index) => {
+ var _bookmarks$index;
+ const properties = childOf(element, "w:pPr");
+ return {
+ element,
+ styleId: attributeOf(childOf(properties, "w:pStyle"), "w:val"),
+ outlineLevel: numberAttributeOf(childOf(properties, "w:outlineLvl"), "w:val"),
+ text: textOf(element),
+ bookmarks: (_bookmarks$index = bookmarks[index]) !== null && _bookmarks$index !== void 0 ? _bookmarks$index : /* @__PURE__ */ new Set()
+ };
+ });
+ };
+ /** The document's paragraph styles, by id, read from the styles as they are written */
+ var stylesOf = (context) => {
+ var _context$file;
+ const styles = (_context$file = context.file) === null || _context$file === void 0 || (_context$file = _context$file.Styles) === null || _context$file === void 0 ? void 0 : _context$file.prepForXml(context);
+ return new Map(childrenOf(styles).filter((style) => nameOf$1(style) === "w:style" && ["paragraph", void 0].includes(attributeOf(style, "w:type"))).map((style) => [attributeOf(style, "w:styleId"), {
+ name: attributeOf(childOf(style, "w:name"), "w:val"),
+ basedOn: attributeOf(childOf(style, "w:basedOn"), "w:val"),
+ outlineLevel: numberAttributeOf(childOf(childOf(style, "w:pPr"), "w:outlineLvl"), "w:val")
+ }]));
+ };
+ /** A range such as `1-3` */
+ var parseRange = (range) => {
+ const match = /^\s*(\d+)\s*-\s*(\d+)\s*$/.exec(range);
+ return match ? [Number(match[1]), Number(match[2])] : void 0;
+ };
+ var isWithin = (level, [from, to]) => level >= from && level <= to;
+ /** The level of a built-in heading style, Heading 1 to Heading 9, by its name, or by its id when it has no name */
+ var headingLevelOf = (styleId, styles) => {
+ var _styles$get$name, _styles$get;
+ if (styleId === void 0) return;
+ const match = /^heading ?([1-9])$/i.exec((_styles$get$name = (_styles$get = styles.get(styleId)) === null || _styles$get === void 0 ? void 0 : _styles$get.name) !== null && _styles$get$name !== void 0 ? _styles$get$name : styleId);
+ return match ? Number(match[1]) : void 0;
+ };
+ /**
+ * A style's outline level, from 0: its own, or else the one of the style it is based on. A built-in heading style has
+ * its heading's. Following the styles it is based on stops after as many as there are, in case they loop.
+ */
+ var styleOutlineLevelOf = (styleId, styles, depth = 0) => {
+ var _style$outlineLevel;
+ if (styleId === void 0 || depth > styles.size) return;
+ const style = styles.get(styleId);
+ const heading = headingLevelOf(styleId, styles);
+ return (_style$outlineLevel = style === null || style === void 0 ? void 0 : style.outlineLevel) !== null && _style$outlineLevel !== void 0 ? _style$outlineLevel : heading === void 0 ? styleOutlineLevelOf(style === null || style === void 0 ? void 0 : style.basedOn, styles, depth + 1) : heading - 1;
+ };
+ /** A paragraph's outline level, from 0: its own, or else its style's */
+ var outlineLevelOf = (paragraph, styles) => {
+ var _paragraph$outlineLev;
+ return (_paragraph$outlineLev = paragraph.outlineLevel) !== null && _paragraph$outlineLev !== void 0 ? _paragraph$outlineLev : styleOutlineLevelOf(paragraph.styleId, styles);
+ };
+ /** The level a table of contents gives a paragraph, or undefined when it doesn't include it */
+ var levelIn = (properties, paragraph, styles) => {
+ var _styles$get2;
+ const { entriesFromBookmark, headingStyleRange, stylesWithLevels = [], useAppliedParagraphOutlineLevel } = properties;
+ if (paragraph.text.trim() === "" || entriesFromBookmark && !paragraph.bookmarks.has(entriesFromBookmark)) return;
+ const names = [paragraph.styleId, paragraph.styleId === void 0 ? void 0 : (_styles$get2 = styles.get(paragraph.styleId)) === null || _styles$get2 === void 0 ? void 0 : _styles$get2.name].filter((name) => name !== void 0).map((name) => name.toLowerCase());
+ const listed = stylesWithLevels.find((style) => names.includes(style.styleName.toLowerCase()));
+ if (listed) return listed.level;
+ const namesItsEntries = Boolean(headingStyleRange) || stylesWithLevels.length > 0 || Boolean(useAppliedParagraphOutlineLevel) || Boolean(properties.tcFieldIdentifier) || Boolean(properties.tcFieldLevelRange) || Boolean(properties.captionLabel) || Boolean(properties.captionLabelIncludingNumbers);
+ const headingRange = headingStyleRange ? parseRange(headingStyleRange) : namesItsEntries ? void 0 : [1, 9];
+ const heading = headingLevelOf(paragraph.styleId, styles);
+ if (headingRange && heading !== void 0 && isWithin(heading, headingRange)) return heading;
+ const outlineLevel = useAppliedParagraphOutlineLevel ? outlineLevelOf(paragraph, styles) : void 0;
+ return outlineLevel !== void 0 && isWithin(outlineLevel + 1, headingRange !== null && headingRange !== void 0 ? headingRange : [1, 9]) ? outlineLevel + 1 : void 0;
+ };
+ /** The runs of an entry's title. Tabs and line breaks are kept only when the table of contents keeps them (\w and \x) */
+ var titleRunsOf = (title, properties) => {
+ const text = properties.preserveTabInEntries ? title : title.replace(/\t/g, " ");
+ return (properties.preserveNewLineInEntries ? text.split("\n") : [text.replace(/\n/g, " ")]).map((line, index) => new TextRun({
+ break: index > 0 ? 1 : void 0,
+ children: line.split(" ").flatMap((part, partIndex) => [...partIndex > 0 ? [new Tab()] : [], ...part === "" ? [] : [part]])
+ }));
+ };
+ /**
+ * The paragraph style of the entries at a level: the built-in TOC style, found by its name, "toc 1" to "toc 9". When
+ * the document doesn't have it, the entries are indented as Word's are, 220 twips a level.
+ */
+ var entryStyleOf = (level, styles) => {
+ var _find;
+ const named = (_find = [...styles].find(([, style]) => {
+ var _style$name;
+ return ((_style$name = style.name) === null || _style$name === void 0 ? void 0 : _style$name.toLowerCase()) === `toc ${level}`;
+ })) === null || _find === void 0 ? void 0 : _find[0];
+ const id = named !== null && named !== void 0 ? named : `TOC${level}`;
+ return named !== void 0 || styles.has(id) || level === 1 ? { id } : {
+ id,
+ indent: (level - 1) * 220
+ };
+ };
+ /** The formatted content of a table of contents with its entries */
+ var contentOf = ({ properties, beginDirty, textWidth }, entries, styles, context) => {
+ var _parseRange;
+ const withoutPageNumbers = properties.pageNumbersEntryLevelsRange ? (_parseRange = parseRange(properties.pageNumbersEntryLevelsRange)) !== null && _parseRange !== void 0 ? _parseRange : [1, 9] : void 0;
+ const content = new StructuredDocumentTagContent();
+ entries.forEach((entry, index) => {
+ const hasPageNumber = withoutPageNumbers === void 0 || !isWithin(entry.level, withoutPageNumbers);
+ const children = [...titleRunsOf(entry.title, properties), ...hasPageNumber ? [new TextRun({ children: [properties.entryAndPageNumberSeparator || new Tab()] }), new PageReference(entry.bookmark, { hyperlink: properties.hyperlink })] : []];
+ const style = entryStyleOf(entry.level, styles);
+ content.addChildElement(new Paragraph({
+ style: style.id,
+ indent: style.indent === void 0 ? void 0 : { left: style.indent },
+ tabStops: [{
+ type: "right",
+ position: textWidth,
+ leader: "dot"
+ }],
+ children: [...index === 0 ? [new Run({ children: [
+ createBegin(beginDirty),
+ new FieldInstruction(properties),
+ createSeparate()
+ ] })] : [], ...properties.hyperlink ? [new InternalHyperlink({
+ anchor: entry.bookmark,
+ children
+ })] : children]
+ }));
+ });
+ content.addChildElement(new Paragraph({ children: [new Run({ children: [createEnd()] })] }));
+ return content.prepForXml(context);
+ };
+ /** Puts a bookmark around the content of a formatted paragraph */
+ var bookmark = (paragraph, name, id, context) => {
+ const children = childrenOf(paragraph);
+ const start = children.findIndex((child) => nameOf$1(child) === "w:pPr") + 1;
+ paragraph["w:p"] = [
+ ...children.slice(0, start),
+ new BookmarkStart(name, id).prepForXml(context),
+ ...children.slice(start),
+ new BookmarkEnd(id).prepForXml(context)
+ ];
+ };
+ /**
+ * Fills in the tables of contents in a formatted body from its headings, and bookmarks the headings they list. A
+ * table of contents that doesn't list any heading is left empty, for Word to fill in.
+ */
+ var fillTablesOfContents = (body, context, bookmarkIds) => {
+ const blocks = blocksOf(childrenOf(body));
+ const tables = blocks.flatMap((block) => {
+ const options = writtenTables.get(block);
+ return options ? [[block, options]] : [];
+ });
+ if (tables.length === 0) return;
+ const styles = stylesOf(context);
+ const followBookmarks = tables.some(([, { properties }]) => Boolean(properties.entriesFromBookmark));
+ const headings = paragraphDetailsOf(blocks.filter((block) => nameOf$1(block) === "w:p"), followBookmarks).map((paragraph) => ({
+ paragraph,
+ levels: tables.map(([, { properties }]) => levelIn(properties, paragraph, styles))
+ })).filter(({ levels }) => levels.some((level) => level !== void 0)).map((heading, index) => _objectSpread2(_objectSpread2({}, heading), {}, { id: bookmarkIds.get(index) }));
+ for (const { paragraph, id } of headings) bookmark(paragraph.element, `_Toc${id}`, id, context);
+ tables.forEach(([table, options], index) => {
+ const entries = headings.flatMap(({ paragraph, levels, id }) => {
+ const level = levels[index];
+ return level === void 0 ? [] : [{
+ title: paragraph.text,
+ level,
+ bookmark: `_Toc${id}`
+ }];
+ });
+ if (entries.length === 0) return;
+ table["w:sdt"] = childrenOf(table).map((child) => nameOf$1(child) === "w:sdtContent" ? contentOf(options, entries, styles, context) : child);
+ });
+ };
+ //#endregion
//#region src/file/vertical-align/vertical-align.ts
/**
* Vertical alignment module for WordprocessingML documents.
@@ -21994,6 +22409,7 @@ MAX: 9026 };
"sectionParagraphs",
/* @__PURE__ */ new Map()
);
+ _defineProperty(this, "headingBookmarkIds", new HeadingBookmarkIds());
}
/**
* Finds the section properties that govern a top-level child of the body.
@@ -22041,7 +22457,8 @@ MAX: 9026 };
* Prepares the body element for XML serialization.
*
* Ensures that the last section's properties are placed as a direct child of the body
- * element, as required by the OOXML specification.
+ * element, as required by the OOXML specification. Once the body is written, its tables
+ * of contents are filled in from its headings.
*
* @param context - The XML serialization context
* @returns The prepared XML object or undefined
@@ -22051,7 +22468,9 @@ MAX: 9026 };
this.root.splice(0, 1);
this.root.push(this.sections.pop());
}
- return super.prepForXml(context);
+ const xml = super.prepForXml(context);
+ fillTablesOfContents(xml, context, this.headingBookmarkIds);
+ return xml;
}
/**
* Adds a block-level component to the body.
@@ -29301,113 +29720,6 @@ MAX: 9026 };
}
};
//#endregion
- //#region src/file/table-of-contents/field-instruction.ts
- /**
- * Field Instruction module for Table of Contents.
- *
- * This module handles the generation of TOC field instruction text
- * that controls how the table of contents is built.
- *
- * Reference: http://officeopenxml.com/WPfieldInstructions.php
- *
- * @module
- */
- /**
- * Represents a field instruction for a Table of Contents.
- *
- * The FieldInstruction class generates the TOC field code string that Word uses
- * to determine how to build the table of contents, including which headings to include,
- * formatting options, and other TOC-specific settings.
- *
- * Reference: http://officeopenxml.com/WPfieldInstructions.php
- *
- * ## XSD Schema
- * ```xml
- *
- * ```
- *
- * @example
- * ```typescript
- * // Basic TOC field instruction
- * new FieldInstruction({ headingStyleRange: "1-3" });
- *
- * // TOC with hyperlinks and custom styles
- * new FieldInstruction({
- * hyperlink: true,
- * headingStyleRange: "1-3",
- * stylesWithLevels: [new StyleLevel("CustomStyle", 2)],
- * });
- * ```
- */
- var FieldInstruction = class extends XmlComponent {
- constructor(properties = {}) {
- super("w:instrText");
- _defineProperty(this, "properties", void 0);
- this.properties = properties;
- this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
- let instruction = "TOC";
- if (this.properties.captionLabel) instruction = `${instruction} \\a "${this.properties.captionLabel}"`;
- if (this.properties.entriesFromBookmark) instruction = `${instruction} \\b "${this.properties.entriesFromBookmark}"`;
- if (this.properties.captionLabelIncludingNumbers) instruction = `${instruction} \\c "${this.properties.captionLabelIncludingNumbers}"`;
- if (this.properties.sequenceAndPageNumbersSeparator) instruction = `${instruction} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;
- if (this.properties.tcFieldIdentifier) instruction = `${instruction} \\f "${this.properties.tcFieldIdentifier}"`;
- if (this.properties.hyperlink) instruction = `${instruction} \\h`;
- if (this.properties.tcFieldLevelRange) instruction = `${instruction} \\l "${this.properties.tcFieldLevelRange}"`;
- if (this.properties.pageNumbersEntryLevelsRange) instruction = `${instruction} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;
- if (this.properties.headingStyleRange) instruction = `${instruction} \\o "${this.properties.headingStyleRange}"`;
- if (this.properties.entryAndPageNumberSeparator) instruction = `${instruction} \\p "${this.properties.entryAndPageNumberSeparator}"`;
- if (this.properties.seqFieldIdentifierForPrefix) instruction = `${instruction} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;
- if (this.properties.stylesWithLevels && this.properties.stylesWithLevels.length) {
- const styles = this.properties.stylesWithLevels.map((sl) => `${sl.styleName},${sl.level}`).join(",");
- instruction = `${instruction} \\t "${styles}"`;
- }
- if (this.properties.useAppliedParagraphOutlineLevel) instruction = `${instruction} \\u`;
- if (this.properties.preserveTabInEntries) instruction = `${instruction} \\w`;
- if (this.properties.preserveNewLineInEntries) instruction = `${instruction} \\x`;
- if (this.properties.hideTabAndPageNumbersInWebView) instruction = `${instruction} \\z`;
- this.root.push(instruction);
- }
- };
- //#endregion
- //#region src/file/table-of-contents/sdt-content.ts
- /**
- * Structured Document Tag Content module.
- *
- * This module represents the content container for structured document tags,
- * including table of contents elements.
- *
- * Reference: http://officeopenxml.com/WPtableOfContents.php
- *
- * @module
- */
- /**
- * Represents the content portion of a Structured Document Tag.
- *
- * The StructuredDocumentTagContent contains the actual content elements
- * (paragraphs, tables, etc.) within a structured document tag, such as
- * the paragraphs that make up a table of contents.
- *
- * Reference: http://officeopenxml.com/WPtableOfContents.php
- *
- * ## XSD Schema
- * ```xml
- *
- *
- *
- * ```
- *
- * @example
- * ```typescript
- * const content = new StructuredDocumentTagContent();
- * content.addChildElement(new Paragraph("Content"));
- * ```
- */
- var StructuredDocumentTagContent = class extends XmlComponent {
- constructor() {
- super("w:sdtContent");
- }
- };
- //#endregion
//#region src/file/table-of-contents/sdt-properties.ts
/**
* Structured Document Tag Properties module.
@@ -29487,6 +29799,11 @@ MAX: 9026 };
* TableOfContents creates an auto-generated list of document headings
* with page numbers. It uses a TOC field code to generate entries.
*
+ * Unless it is given `cachedEntries` or `contentChildren`, it is written with an
+ * entry for each heading its options include, linked to a bookmark on the heading,
+ * so it isn't empty before Word updates it or in applications that don't update it.
+ * The page numbers are left for Word to fill in when it updates the field.
+ *
* Reference: http://officeopenxml.com/WPtableOfContents.php
*
* @publicApi
@@ -29514,6 +29831,12 @@ MAX: 9026 };
constructor(alias = "Table of Contents", _ref = {}) {
let { contentChildren = [], cachedEntries = [], beginDirty = true } = _ref, properties = _objectWithoutProperties(_ref, _excluded$2);
super("w:sdt");
+ _defineProperty(
+ this,
+ /** What it is filled in with from the headings, when it isn't given its content */
+ "fromHeadings",
+ void 0
+ );
this.root.push(new StructuredDocumentTagProperties(alias));
const content = new StructuredDocumentTagContent();
const beginParagraphMandatoryChildren = [new Run({ children: [
@@ -29544,9 +29867,27 @@ MAX: 9026 };
for (const child of contentChildren) content.addChildElement(child);
const endParagraph = new Paragraph({ children: endParagraphMandatoryChildren });
content.addChildElement(endParagraph);
+ if (contentChildren.length === 0) this.fromHeadings = {
+ properties,
+ beginDirty
+ };
}
this.root.push(content);
}
+ /**
+ * Written empty, and filled in from the headings once the body it is in is written, unless it was given its content.
+ * The page numbers are aligned to the right of the text in its section.
+ */
+ prepForXml(context) {
+ const xml = super.prepForXml(context);
+ recordTableOfContents(xml, this.fromHeadings && _objectSpread2(_objectSpread2({}, this.fromHeadings), {}, { textWidth: this.textWidthIn(context) }));
+ return xml;
+ }
+ /** The width of the text in the section it is in */
+ textWidthIn(context) {
+ var _context$file$Documen, _context$file;
+ return (_context$file$Documen = (_context$file = context.file) === null || _context$file === void 0 || (_context$file = _context$file.Document) === null || _context$file === void 0 || (_context$file = _context$file.View.Body.getSectionPropertiesFor(this)) === null || _context$file === void 0 ? void 0 : _context$file.AvailableTextWidth) !== null && _context$file$Documen !== void 0 ? _context$file$Documen : DEFAULT_AVAILABLE_WIDTH;
+ }
getTabStopsForLevel(level, pageWidth = 9025) {
return [{
type: "clear",
diff --git a/troubleshooting.md b/troubleshooting.md
index 1b1fe1505f..999eebc8be 100644
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -482,13 +482,13 @@ const doc = new Document({
## Table of Contents
-### TOC shows "Update this table"
+### TOC has no page numbers
-**Cause:** TOC fields need updating in Word.
+**Cause:** The page numbers depend on how the document is laid out, so `docx` writes the entries for the headings without them, and leaves them for Word to fill in when it updates the field.
**Solution:**
-1. Set `updateFields: true` in document features:
+1. Set `updateFields: true` in document features, so Word asks to update the fields when the document is opened:
```ts live
import { Document, HeadingLevel, Paragraph, TableOfContents } from "docx";
@@ -509,7 +509,7 @@ const doc = new Document({
});
```
-2. When opening in Word, right-click the TOC and select "Update Field"
+2. Or, in Word, right-click the TOC and select "Update Field". In LibreOffice, right-click it and select "Update Index"
## Memory Issues
diff --git a/usage/table-of-contents.md b/usage/table-of-contents.md
index 79df23b908..4ad3dddfaa 100644
--- a/usage/table-of-contents.md
+++ b/usage/table-of-contents.md
@@ -2,9 +2,9 @@
You can generate table of contents with `docx`. More information can be found [here](http://officeopenxml.com/WPtableOfContents.php).
-> Tables of Contents are fields and, by design, it's content is only generated or updated by Word. We can't do it programmatically.
-> This is why, when you open a the file, Word you will prompt the message "This document contains fields that may refer to other files. Do you want to update the fields in this document?".
-> You have say yes to Word generate the content of all table of contents.
+A Table of Contents is a field. `docx` writes it with an entry for each heading it includes, linked to the heading, so it isn't empty when the document is opened, whether or not the application updates fields.
+
+The page numbers depend on how the document is laid out on the page, which only the application that shows it knows, so `docx` leaves them for Word to fill in when it updates the field. With `updateFields` on, Word asks "This document contains fields that may refer to other files. Do you want to update the fields in this document?" when the document is opened. Say yes, and Word fills in the page numbers. Applications that don't update fields, such as LibreOffice, show the entries without page numbers until the table is updated there.
The complete documentation can be found [here](https://www.ecma-international.org/publications/standards/Ecma-376.htm) (at Part 1, Page 1251).
@@ -12,7 +12,7 @@ The complete documentation can be found [here](https://www.ecma-international.or
All you need to do is create a `TableOfContents` object and assign it to the document.
-**Note**: updateFields feature must be enabled for TableOfContents to update correctly.
+**Note**: turn on the `updateFields` feature, so Word fills in the page numbers when the document is opened.
```ts live
import { Document, HeadingLevel, Paragraph, TableOfContents } from "docx";
@@ -39,6 +39,17 @@ const doc = new Document({
});
```
+## Entries from the headings
+
+The entries are written for the paragraphs the options include, as Word includes them:
+
+- `headingStyleRange` (`\o`): paragraphs with the built-in heading styles in the range, such as `HeadingLevel.HEADING_1` to `HeadingLevel.HEADING_3` for `"1-3"`
+- `stylesWithLevels` (`\t`): paragraphs with the styles listed, by id or name, at their levels
+- `useAppliedParagraphOutlineLevel` (`\u`): paragraphs by their outline level, or their style's
+- `entriesFromBookmark` (`\b`): only the paragraphs in the bookmark
+
+With none of these, the headings Heading 1 to Heading 9 are included. Each entry uses the `TOC1` to `TOC9` paragraph style for its level. When the document doesn't define that style, the entry is indented as Word's is. A Table of Contents of captions or of TC fields (`captionLabel`, `captionLabelIncludingNumbers`, `tcFieldIdentifier` or `tcFieldLevelRange` alone) is left empty for Word to fill in.
+
## Table of Contents Options
Here is the list of all options that you can use to generate your tables of contents:
@@ -64,7 +75,7 @@ Here is the list of all options that you can use to generate your tables of cont
## Cached entries
-By default, a Table of Contents is empty until Word regenerates the field. If you want the TOC to display entries immediately when the document is opened, you can provide pre-populated entries via the `cachedEntries` option. Word will still prompt to update the field, but the cached content is visible before that happens.
+By default, the entries are written from the headings, without page numbers. If you want to write the entries yourself, such as with page numbers you know, you can provide them via the `cachedEntries` option instead. Word will still prompt to update the field, but the cached content is visible before that happens.
Each entry is a `ToCEntry` object with the following properties:
The unique identifier for this abstract numbering definition.