Files
docx-js/src/file/paragraph/formatting/unordered-list.ts

32 lines
790 B
TypeScript
Raw Normal View History

import { Attributes, XmlComponent } from "file/xml-components";
2016-03-30 02:55:11 +01:00
2016-04-09 20:16:35 +01:00
export class NumberProperties extends XmlComponent {
2019-11-06 20:54:39 +00:00
constructor(numberId: number | string, indentLevel: number) {
2016-04-09 20:16:35 +01:00
super("w:numPr");
this.root.push(new IndentLevel(indentLevel));
this.root.push(new NumberId(numberId));
2016-03-30 02:55:11 +01:00
}
}
2016-07-17 16:28:54 +01:00
class IndentLevel extends XmlComponent {
2016-03-30 02:55:11 +01:00
constructor(level: number) {
2016-04-09 20:16:35 +01:00
super("w:ilvl");
2018-01-23 01:33:12 +00:00
this.root.push(
new Attributes({
val: level,
}),
);
2016-03-30 02:55:11 +01:00
}
}
2016-07-17 16:28:54 +01:00
class NumberId extends XmlComponent {
2019-11-06 20:54:39 +00:00
constructor(id: number | string) {
2016-04-09 20:16:35 +01:00
super("w:numId");
2018-01-23 01:33:12 +00:00
this.root.push(
new Attributes({
2019-11-08 03:11:19 +00:00
val: typeof id === "string" ? `{${id}}` : id,
2018-01-23 01:33:12 +00:00
}),
);
2016-03-30 02:55:11 +01:00
}
2017-03-08 21:36:09 +00:00
}