added paragraph formatting methods to numbering Level

This commit is contained in:
felipe
2017-03-13 12:23:18 +01:00
parent ba80440faf
commit 457d074a59
2 changed files with 165 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import * as paragraph from "../docx/paragraph/formatting";
import { ParagraphProperties } from "../docx/paragraph/properties";
import { RunProperties } from "../docx/run/properties";
import { Attributes, XmlAttributeComponent, XmlComponent } from "../docx/xml-components";
@ -86,4 +87,51 @@ export class Level extends XmlComponent {
this.runProperties.push(property);
return this;
}
// --------------------- Paragraph formatting ------------------------ //
public center(): Level {
this.addParagraphProperty(new paragraph.Alignment("center"));
return this;
}
public left(): Level {
this.addParagraphProperty(new paragraph.Alignment("left"));
return this;
}
public right(): Level {
this.addParagraphProperty(new paragraph.Alignment("right"));
return this;
}
public justified(): Level {
this.addParagraphProperty(new paragraph.Alignment("both"));
return this;
}
public thematicBreak(): Level {
this.addParagraphProperty(new paragraph.ThematicBreak());
return this;
}
public maxRightTabStop(): Level {
this.addParagraphProperty(new paragraph.MaxRightTabStop());
return this;
}
public leftTabStop(position: number): Level {
this.addParagraphProperty(new paragraph.LeftTabStop(position));
return this;
}
public indent(left: number, hanging?: number): Level {
this.addParagraphProperty(new paragraph.Indent(left, hanging));
return this;
}
public spacing(params: paragraph.ISpacingProperties): Level {
this.addParagraphProperty(new paragraph.Spacing(params));
return this;
};
}