2018-03-28 14:54:07 +02:00
|
|
|
import { XmlComponent, BaseXmlComponent } from "file/xml-components";
|
2017-09-16 08:24:15 -06:00
|
|
|
import { DocumentDefaults } from "./defaults";
|
2017-09-17 00:01:09 +01:00
|
|
|
import { ParagraphStyle } from "./style";
|
2016-04-03 05:23:13 +01:00
|
|
|
|
2016-04-09 20:16:35 +01:00
|
|
|
export class Styles extends XmlComponent {
|
2018-03-28 14:54:07 +02:00
|
|
|
constructor(_initialStyles?: BaseXmlComponent) {
|
2016-04-09 20:16:35 +01:00
|
|
|
super("w:styles");
|
2018-03-28 14:54:07 +02:00
|
|
|
if (_initialStyles) {
|
|
|
|
this.root.push(_initialStyles);
|
|
|
|
}
|
2016-04-09 02:04:53 +01:00
|
|
|
}
|
|
|
|
|
2017-03-09 09:45:01 +01:00
|
|
|
public push(style: XmlComponent): Styles {
|
2016-04-09 20:16:35 +01:00
|
|
|
this.root.push(style);
|
2017-03-09 09:45:01 +01:00
|
|
|
return this;
|
2016-04-03 05:23:13 +01:00
|
|
|
}
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2017-09-16 08:24:15 -06:00
|
|
|
public createDocumentDefaults(): DocumentDefaults {
|
|
|
|
const defaults = new DocumentDefaults();
|
|
|
|
this.push(defaults);
|
|
|
|
return defaults;
|
|
|
|
}
|
|
|
|
|
2017-03-09 13:27:40 +01:00
|
|
|
public createParagraphStyle(styleId: string, name?: string): ParagraphStyle {
|
|
|
|
const para = new ParagraphStyle(styleId, name);
|
|
|
|
this.push(para);
|
|
|
|
return para;
|
|
|
|
}
|
2017-03-09 09:45:01 +01:00
|
|
|
}
|