// http://officeopenxml.com/WPtableRowProperties.php
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
import { IgnoreIfEmptyXmlComponent, OnOffElement } from "@file/xml-components";
import { PositiveUniversalMeasure } from "@util/values";
import { HeightRule, TableRowHeight } from "./table-row-height";
import { ITableCellSpacingProperties, TableCellSpacingElement } from "../table-cell-spacing";
export type ITableRowPropertiesOptions = {
readonly cantSplit?: boolean;
readonly tableHeader?: boolean;
readonly height?: {
readonly value: number | PositiveUniversalMeasure;
readonly rule: (typeof HeightRule)[keyof typeof HeightRule];
};
readonly cellSpacing?: ITableCellSpacingProperties;
};
export class TableRowProperties extends IgnoreIfEmptyXmlComponent {
public constructor(options: ITableRowPropertiesOptions) {
super("w:trPr");
if (options.cantSplit !== undefined) {
this.root.push(new OnOffElement("w:cantSplit", options.cantSplit));
}
if (options.tableHeader !== undefined) {
this.root.push(new OnOffElement("w:tblHeader", options.tableHeader));
}
if (options.height) {
this.root.push(new TableRowHeight(options.height.value, options.height.rule));
}
if (options.cellSpacing) {
this.root.push(new TableCellSpacingElement(options.cellSpacing));
}
}
}