added tab stops
This commit is contained in:
@ -3,7 +3,7 @@ import {ThematicBreak} from "./border";
|
||||
import {PageBreak} from "./page-break";
|
||||
import {TextRun} from "../run/text-run";
|
||||
import {ParagraphProperties} from "./properties";
|
||||
import {TabStop} from "../tab-stop";
|
||||
import {MaxRightTabStop, LeftTabStop} from "./tab-stop";
|
||||
import {Style} from "./style";
|
||||
import {NumberProperties} from "./unordered-list";
|
||||
|
||||
@ -94,8 +94,13 @@ export class Paragraph extends XmlComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
addTabStop(tabStop: TabStop): Paragraph {
|
||||
this.properties.push(tabStop);
|
||||
maxRightTabStop(): Paragraph {
|
||||
this.properties.push(new MaxRightTabStop());
|
||||
return this;
|
||||
}
|
||||
|
||||
leftTabStop(position: number): Paragraph {
|
||||
this.properties.push(new LeftTabStop(position))
|
||||
return this;
|
||||
}
|
||||
|
||||
|
32
ts/docx/paragraph/tab-stop.ts
Normal file
32
ts/docx/paragraph/tab-stop.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import {XmlComponent, Attributes} from "../xml-components";
|
||||
|
||||
class TabStop extends XmlComponent {
|
||||
|
||||
constructor(tab: Tab) {
|
||||
super("w:tabs");
|
||||
this.root.push(tab);
|
||||
}
|
||||
}
|
||||
|
||||
class Tab extends XmlComponent {
|
||||
|
||||
constructor(value: string, position: any) {
|
||||
super("w:tab");
|
||||
this.root.push(new Attributes({
|
||||
val: value,
|
||||
pos: position
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
export class MaxRightTabStop extends TabStop {
|
||||
constructor() {
|
||||
super(new Tab("right", "RIGHT_MARGIN"));
|
||||
}
|
||||
}
|
||||
|
||||
export class LeftTabStop extends TabStop {
|
||||
constructor(position: number) {
|
||||
super(new Tab("left", position));
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
import {XmlComponent, Attributes} from "./xml-components";
|
||||
|
||||
export class TabStop extends XmlComponent{
|
||||
xmlKeys = {}
|
||||
}
|
Reference in New Issue
Block a user