Moved addTableOfContents to File and creating a settings.xml and applying updateFields=true when there is a table of contents

This commit is contained in:
Sergio Mendonça
2018-09-10 10:01:26 -03:00
parent aedfca377f
commit 146d0ad9e5
13 changed files with 268 additions and 14 deletions

View File

@ -19,9 +19,9 @@ export class TableOfContentsInstructionProperties {
// \h option
public hiperlink: true;
// \n option
public entryLevelsRange = "1-6";
public entryLevelsRange: string;
// \o option
public headerRange: string;
public headerRange = "1-6";
// \t option
public styles: StyleLevel[];
// \z option

View File

@ -29,7 +29,7 @@ const DEFAULT_TOC = {
"xml:space": "preserve",
},
},
'TOC \\n "1-6"',
'TOC \\o "1-6"',
],
},
{

View File

@ -1,14 +1,18 @@
// import { TableOfContentsProperties } from "./properties";
import { Paragraph } from "file/paragraph";
import { ParagraphProperties } from "file/paragraph";
import { Run } from "file/paragraph/run";
import { Begin, End, Separate } from "file/paragraph/run/field";
import { XmlComponent } from "file/xml-components";
import { TableOfContentsInstruction } from "./instruction";
export class TableOfContents extends Paragraph {
export class TableOfContents extends XmlComponent {
// private readonly tocProperties: TableOfContentsProperties;
private readonly properties: ParagraphProperties;
constructor(/*tocProperties?: TableOfContentsProperties*/) {
super();
super("w:p");
this.properties = new ParagraphProperties();
this.root.push(this.properties);
// this.tocProperties = tocProperties || new TableOfContentsProperties();
const firstRun = new Run();
firstRun.addChildElement(new Begin());