Multiple tab stops
This commit is contained in:
@ -11,17 +11,12 @@ import { KeepLines, KeepNext } from "./formatting/keep";
|
||||
import { PageBreak, PageBreakBefore } from "./formatting/page-break";
|
||||
import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spacing";
|
||||
import { HeadingLevel, Style } from "./formatting/style";
|
||||
import { CenterTabStop, LeaderType, LeftTabStop, RightTabStop, TabStopPosition } from "./formatting/tab-stop";
|
||||
import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop";
|
||||
import { NumberProperties } from "./formatting/unordered-list";
|
||||
import { Bookmark, Hyperlink, OutlineLevel } from "./links";
|
||||
import { ParagraphProperties } from "./properties";
|
||||
import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run";
|
||||
|
||||
interface ITabStopOptions {
|
||||
readonly position: number | TabStopPosition;
|
||||
readonly leader?: LeaderType;
|
||||
}
|
||||
|
||||
export interface IParagraphOptions {
|
||||
readonly text?: string;
|
||||
readonly border?: IBorderOptions;
|
||||
@ -36,11 +31,11 @@ export interface IParagraphOptions {
|
||||
readonly indent?: IIndentAttributesProperties;
|
||||
readonly keepLines?: boolean;
|
||||
readonly keepNext?: boolean;
|
||||
readonly tabStop?: {
|
||||
readonly left?: ITabStopOptions;
|
||||
readonly right?: ITabStopOptions;
|
||||
readonly center?: ITabStopOptions;
|
||||
};
|
||||
readonly tabStops?: Array<{
|
||||
readonly position: number | TabStopPosition;
|
||||
readonly type: TabStopType;
|
||||
readonly leader?: LeaderType;
|
||||
}>;
|
||||
readonly style?: string;
|
||||
readonly bullet?: {
|
||||
readonly level: number;
|
||||
@ -127,17 +122,9 @@ export class Paragraph extends XmlComponent {
|
||||
this.properties.push(new KeepNext());
|
||||
}
|
||||
|
||||
if (options.tabStop) {
|
||||
if (options.tabStop.left) {
|
||||
this.properties.push(new LeftTabStop(options.tabStop.left.position, options.tabStop.left.leader));
|
||||
}
|
||||
|
||||
if (options.tabStop.right) {
|
||||
this.properties.push(new RightTabStop(options.tabStop.right.position, options.tabStop.right.leader));
|
||||
}
|
||||
|
||||
if (options.tabStop.center) {
|
||||
this.properties.push(new CenterTabStop(options.tabStop.center.position, options.tabStop.center.leader));
|
||||
if (options.tabStops) {
|
||||
for (const tabStop of options.tabStops) {
|
||||
this.properties.push(new TabStop(tabStop.type, tabStop.position, tabStop.leader));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user