2020-10-24 21:38:20 +01:00
|
|
|
// http://officeopenxml.com/WPtableRowProperties.php
|
2021-05-24 11:28:10 +03:00
|
|
|
|
|
|
|
// <xsd:complexType name="CT_TrPrBase">
|
|
|
|
// <xsd:choice maxOccurs="unbounded">
|
|
|
|
// <xsd:element name="cnfStyle" type="CT_Cnf" minOccurs="0" maxOccurs="1"/>
|
|
|
|
// <xsd:element name="divId" type="CT_DecimalNumber" minOccurs="0"/>
|
|
|
|
// <xsd:element name="gridBefore" type="CT_DecimalNumber" minOccurs="0"/>
|
|
|
|
// <xsd:element name="gridAfter" type="CT_DecimalNumber" minOccurs="0"/>
|
|
|
|
// <xsd:element name="wBefore" type="CT_TblWidth" minOccurs="0" maxOccurs="1"/>
|
|
|
|
// <xsd:element name="wAfter" type="CT_TblWidth" minOccurs="0" maxOccurs="1"/>
|
|
|
|
// <xsd:element name="cantSplit" type="CT_OnOff" minOccurs="0"/>
|
|
|
|
// <xsd:element name="trHeight" type="CT_Height" minOccurs="0"/>
|
|
|
|
// <xsd:element name="tblHeader" type="CT_OnOff" minOccurs="0"/>
|
|
|
|
// <xsd:element name="tblCellSpacing" type="CT_TblWidth" minOccurs="0" maxOccurs="1"/>
|
|
|
|
// <xsd:element name="jc" type="CT_JcTable" minOccurs="0" maxOccurs="1"/>
|
|
|
|
// <xsd:element name="hidden" type="CT_OnOff" minOccurs="0"/>
|
|
|
|
// </xsd:choice>
|
|
|
|
// </xsd:complexType>
|
|
|
|
// <xsd:complexType name="CT_TrPr">
|
|
|
|
// <xsd:complexContent>
|
|
|
|
// <xsd:extension base="CT_TrPrBase">
|
|
|
|
// <xsd:sequence>
|
|
|
|
// <xsd:element name="ins" type="CT_TrackChange" minOccurs="0"/>
|
|
|
|
// <xsd:element name="del" type="CT_TrackChange" minOccurs="0"/>
|
|
|
|
// <xsd:element name="trPrChange" type="CT_TrPrChange" minOccurs="0"/>
|
|
|
|
// </xsd:sequence>
|
|
|
|
// </xsd:extension>
|
|
|
|
// </xsd:complexContent>
|
|
|
|
// </xsd:complexType>
|
2022-06-26 23:26:42 +01:00
|
|
|
import { IgnoreIfEmptyXmlComponent, OnOffElement } from "@file/xml-components";
|
2018-10-23 23:44:50 +01:00
|
|
|
|
2020-10-24 21:38:20 +01:00
|
|
|
import { HeightRule, TableRowHeight } from "./table-row-height";
|
|
|
|
|
2021-05-22 04:03:40 +03:00
|
|
|
export interface ITableRowPropertiesOptions {
|
|
|
|
readonly cantSplit?: boolean;
|
|
|
|
readonly tableHeader?: boolean;
|
|
|
|
readonly height?: {
|
2021-05-24 11:28:10 +03:00
|
|
|
readonly value: number | string;
|
2021-05-22 04:03:40 +03:00
|
|
|
readonly rule: HeightRule;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-04-09 05:27:18 -04:00
|
|
|
export class TableRowProperties extends IgnoreIfEmptyXmlComponent {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor(options: ITableRowPropertiesOptions) {
|
2018-10-23 23:44:50 +01:00
|
|
|
super("w:trPr");
|
2019-02-05 15:47:09 +01:00
|
|
|
|
2021-05-24 11:28:10 +03:00
|
|
|
if (options.cantSplit !== undefined) {
|
|
|
|
this.root.push(new OnOffElement("w:cantSplit", options.cantSplit));
|
2021-05-22 04:03:40 +03:00
|
|
|
}
|
2019-06-25 12:02:53 +02:00
|
|
|
|
2021-05-24 11:28:10 +03:00
|
|
|
if (options.tableHeader !== undefined) {
|
|
|
|
this.root.push(new OnOffElement("w:tblHeader", options.tableHeader));
|
2021-05-22 04:03:40 +03:00
|
|
|
}
|
2019-06-25 12:02:53 +02:00
|
|
|
|
2021-05-22 04:03:40 +03:00
|
|
|
if (options.height) {
|
|
|
|
this.root.push(new TableRowHeight(options.height.value, options.height.rule));
|
|
|
|
}
|
2019-06-25 12:02:53 +02:00
|
|
|
}
|
2019-02-05 15:47:09 +01:00
|
|
|
}
|