added optional name parameter to style constructor

This commit is contained in:
felipe
2017-03-09 11:09:08 +01:00
parent e6e0658812
commit b4dca79d72
2 changed files with 51 additions and 4 deletions

View File

@ -26,9 +26,12 @@ class StyleAttributes extends XmlAttributeComponent {
export class Style extends XmlComponent {
constructor(attributes: IStyleAttributes) {
constructor(attributes: IStyleAttributes, name?: string) {
super("w:style");
this.root.push(new StyleAttributes(attributes));
if (name) {
this.root.push(new Name(name));
}
}
public push(styleSegment: XmlComponent): void {
@ -41,8 +44,8 @@ export class ParagraphStyle extends Style {
private paragraphProperties: ParagraphProperties;
private runProperties: RunProperties;
constructor(styleId: string) {
super({type: "paragraph", styleId: styleId});
constructor(styleId: string, name?: string) {
super({type: "paragraph", styleId: styleId}, name);
this.paragraphProperties = new ParagraphProperties();
this.runProperties = new RunProperties();
this.root.push(this.paragraphProperties);