Restore numbering

This commit is contained in:
Dolan Miu
2018-05-06 02:57:40 +01:00
parent af485c678d
commit a716360faa

View File

@ -1,4 +1,5 @@
import { XmlComponent, IXmlableObject } from "file/xml-components";
import { Indent } from "file/paragraph";
import { IXmlableObject, XmlComponent } from "file/xml-components";
import { DocumentAttributes } from "../document/document-attributes";
import { AbstractNumbering } from "./abstract-numbering";
import { Num } from "./num";
@ -6,8 +7,8 @@ import { Num } from "./num";
export class Numbering extends XmlComponent {
private nextId: number;
private abstractNumbering: Array<XmlComponent> = [];
private concreteNumbering: Array<XmlComponent> = [];
private abstractNumbering: XmlComponent[] = [];
private concreteNumbering: XmlComponent[] = [];
constructor() {
super("w:numbering");
@ -34,6 +35,28 @@ export class Numbering extends XmlComponent {
);
this.nextId = 0;
const abstractNumbering = this.createAbstractNumbering();
abstractNumbering.createLevel(0, "bullet", "\u25CF", "left").addParagraphProperty(new Indent({ left: 720, hanging: 360 }));
abstractNumbering.createLevel(1, "bullet", "\u25CB", "left").addParagraphProperty(new Indent({ left: 1440, hanging: 360 }));
abstractNumbering.createLevel(2, "bullet", "\u25A0", "left").addParagraphProperty(new Indent({ left: 2160, hanging: 360 }));
abstractNumbering.createLevel(3, "bullet", "\u25CF", "left").addParagraphProperty(new Indent({ left: 2880, hanging: 360 }));
abstractNumbering.createLevel(4, "bullet", "\u25CB", "left").addParagraphProperty(new Indent({ left: 3600, hanging: 360 }));
abstractNumbering.createLevel(5, "bullet", "\u25A0", "left").addParagraphProperty(new Indent({ left: 4320, hanging: 360 }));
abstractNumbering.createLevel(6, "bullet", "\u25CF", "left").addParagraphProperty(new Indent({ left: 5040, hanging: 360 }));
abstractNumbering.createLevel(7, "bullet", "\u25CB", "left").addParagraphProperty(new Indent({ left: 5760, hanging: 360 }));
abstractNumbering.createLevel(8, "bullet", "\u25A0", "left").addParagraphProperty(new Indent({ left: 6480, hanging: 360 }));
this.createConcreteNumbering(abstractNumbering);
}
public createAbstractNumbering(): AbstractNumbering {
@ -49,8 +72,8 @@ export class Numbering extends XmlComponent {
}
public prepForXml(): IXmlableObject {
this.abstractNumbering.forEach(x => this.root.push(x));
this.concreteNumbering.forEach(x => this.root.push(x));
this.abstractNumbering.forEach((x) => this.root.push(x));
this.concreteNumbering.forEach((x) => this.root.push(x));
return super.prepForXml();
}
}