Files
docx-js/ts/numbering/num.ts

33 lines
789 B
TypeScript
Raw Normal View History

2017-03-08 17:16:51 +01:00
import { Attributes, XmlAttributeComponent, XmlComponent } from "../docx/xml-components";
2016-05-21 00:02:46 +01:00
class AbstractNumId extends XmlComponent {
2016-05-26 15:08:34 +01:00
2016-05-21 00:02:46 +01:00
constructor(value: number) {
super("w:abstractNumId");
this.root.push(new Attributes({
2017-03-08 17:16:51 +01:00
val: value,
2016-05-21 00:02:46 +01:00
}));
}
}
2017-03-08 17:16:51 +01:00
interface INumAttributesProperties {
2016-05-26 15:08:34 +01:00
numId: number;
2016-05-21 00:02:46 +01:00
}
class NumAttributes extends XmlAttributeComponent<INumAttributesProperties> {
protected xmlKeys = {numId: "w:numId"};
2016-05-21 00:02:46 +01:00
}
export class Num extends XmlComponent {
public id: number;
2016-05-26 15:08:34 +01:00
2016-05-21 00:02:46 +01:00
constructor(numId: number, abstractNumId: number) {
super("w:num");
this.root.push(new NumAttributes({
2017-03-08 17:16:51 +01:00
numId: numId,
2016-05-21 00:02:46 +01:00
}));
this.root.push(new AbstractNumId(abstractNumId));
this.id = numId;
}
2017-03-08 17:16:51 +01:00
}