clean up settings; BREAKING: TableOfContents requires Document features.updateFields = true setting

This commit is contained in:
Tom Hunkapiller
2021-05-26 08:36:05 +03:00
parent da61a30eb8
commit 60b7ce4785
20 changed files with 389 additions and 350 deletions

View File

@ -12,14 +12,29 @@ 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.
```ts
const toc = new TableOfContents("Summary", {
hyperlink: true,
headingStyleRange: "1-5",
stylesWithLevels: [new StyleLevel("MySpectacularStyle", 1)],
});
**Note**: updateFields feature must be enabled for TableOfContents to update correctly.
doc.addTableOfContents(toc);
```ts
const doc = new Document({
features: {
updateFields: true,
},
sections: [
{
children: [
new TableOfContents("Summary", {
hyperlink: true,
headingStyleRange: "1-5",
}),
new Paragraph({
text: "Header #1",
heading: HeadingLevel.HEADING_1,
pageBreakBefore: true,
}),
]
}
]
});
```
## Table of Contents Options