From a716360faa485554c715599b4660c044a2a02844 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 6 May 2018 02:57:40 +0100 Subject: [PATCH] Restore numbering --- src/file/numbering/numbering.ts | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index 517766987a..0a886e5598 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -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 = []; - private concreteNumbering: Array = []; + 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(); } }