update table-row-properties, table-cell-properties, table-cell-borders to declarative style

This commit is contained in:
Tom Hunkapiller
2021-05-22 04:03:40 +03:00
parent acc23be297
commit 2611e0c74f
8 changed files with 259 additions and 328 deletions

View File

@ -3,27 +3,30 @@ import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent, XmlComponent } from "
import { HeightRule, TableRowHeight } from "./table-row-height";
export interface ITableRowPropertiesOptions {
readonly cantSplit?: boolean;
readonly tableHeader?: boolean;
readonly height?: {
readonly value: number;
readonly rule: HeightRule;
};
}
export class TableRowProperties extends IgnoreIfEmptyXmlComponent {
constructor() {
constructor(options: ITableRowPropertiesOptions) {
super("w:trPr");
}
public setCantSplit(): TableRowProperties {
this.root.push(new CantSplit());
if (options.cantSplit) {
this.root.push(new CantSplit());
}
return this;
}
if (options.tableHeader) {
this.root.push(new TableHeader());
}
public setTableHeader(): TableRowProperties {
this.root.push(new TableHeader());
return this;
}
public setHeight(value: number, rule: HeightRule): TableRowProperties {
this.root.push(new TableRowHeight(value, rule));
return this;
if (options.height) {
this.root.push(new TableRowHeight(options.height.value, options.height.rule));
}
}
}