Add shading to paragraph

This commit is contained in:
Dolan
2020-10-28 01:05:31 +00:00
parent ed52ef358b
commit 60eb686d05
8 changed files with 124 additions and 22 deletions

View File

@ -1,5 +1,6 @@
// http://officeopenxml.com/WPparagraphProperties.php
import { IgnoreIfEmptyXmlComponent, XmlComponent } from "file/xml-components";
import { ShadingType } from "../table/shading";
import { Alignment, AlignmentType } from "./formatting/alignment";
import { Bidirectional } from "./formatting/bidirectional";
import { Border, IBorderOptions, ThematicBreak } from "./formatting/border";
@ -11,6 +12,7 @@ import { HeadingLevel, Style } from "./formatting/style";
import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop";
import { NumberProperties } from "./formatting/unordered-list";
import { OutlineLevel } from "./links";
import { Shading } from "./run/formatting";
export interface IParagraphStylePropertiesOptions {
readonly alignment?: AlignmentType;
@ -44,6 +46,11 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
readonly level: number;
readonly custom?: boolean;
};
readonly shading?: {
readonly type: ShadingType;
readonly fill: string;
readonly color: string;
};
}
export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
@ -131,6 +138,10 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
if (options.leftTabStop) {
this.push(new TabStop(TabStopType.LEFT, options.leftTabStop));
}
if (options.shading) {
this.push(new Shading(options.shading.type, options.shading.fill, options.shading.color));
}
}
public push(item: XmlComponent): void {