added #leftTabStop and #maxRightTabStop methods to paragraph styles
This commit is contained in:
@ -161,6 +161,16 @@ export class ParagraphStyle extends Style {
|
||||
return this;
|
||||
}
|
||||
|
||||
public maxRightTabStop(): ParagraphStyle {
|
||||
this.addParagraphProperty(new paragraph.MaxRightTabStop());
|
||||
return this;
|
||||
}
|
||||
|
||||
public leftTabStop(position: number): ParagraphStyle {
|
||||
this.addParagraphProperty(new paragraph.LeftTabStop(position));
|
||||
return this;
|
||||
}
|
||||
|
||||
public indent(left: number, hanging?: number): ParagraphStyle {
|
||||
this.addParagraphProperty(new paragraph.Indent(left, hanging));
|
||||
return this;
|
||||
|
@ -292,6 +292,40 @@ describe("ParagraphStyle", () => {
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("#leftTabStop", () => {
|
||||
const style = new ParagraphStyle("myStyleId")
|
||||
.leftTabStop(1200);
|
||||
const tree = new Formatter().format(style);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:style": [
|
||||
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
|
||||
{"w:pPr": [
|
||||
{"w:tabs": [
|
||||
{"w:tab": [{_attr: {"w:val": "left", "w:pos": 1200}}]},
|
||||
]},
|
||||
]},
|
||||
{"w:rPr": []},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("#maxRightTabStop", () => {
|
||||
const style = new ParagraphStyle("myStyleId")
|
||||
.maxRightTabStop();
|
||||
const tree = new Formatter().format(style);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:style": [
|
||||
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
|
||||
{"w:pPr": [
|
||||
{"w:tabs": [
|
||||
{"w:tab": [{_attr: {"w:val": "right", "w:pos": 9026}}]},
|
||||
]},
|
||||
]},
|
||||
{"w:rPr": []},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatting methods: run properties", () => {
|
||||
|
Reference in New Issue
Block a user