2018-09-12 21:01:52 +01:00
|
|
|
// http://officeopenxml.com/WPtableGrid.php
|
2021-05-24 11:28:10 +03:00
|
|
|
|
|
|
|
// <xsd:complexType name="CT_TblGridCol">
|
|
|
|
// <xsd:attribute name="w" type="s:ST_TwipsMeasure"/>
|
|
|
|
// </xsd:complexType>
|
|
|
|
// <xsd:complexType name="CT_TblGridBase">
|
|
|
|
// <xsd:sequence>
|
|
|
|
// <xsd:element name="gridCol" type="CT_TblGridCol" minOccurs="0" maxOccurs="unbounded"/>
|
|
|
|
// </xsd:sequence>
|
|
|
|
// </xsd:complexType>
|
|
|
|
|
2022-12-29 09:57:15 +00:00
|
|
|
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
|
|
|
import { PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
|
2017-03-07 19:22:10 +01:00
|
|
|
|
|
|
|
export class TableGrid extends XmlComponent {
|
2022-12-29 09:57:15 +00:00
|
|
|
public constructor(widths: readonly number[] | readonly PositiveUniversalMeasure[]) {
|
2017-03-10 16:51:19 +01:00
|
|
|
super("w:tblGrid");
|
2019-09-13 00:51:20 +01:00
|
|
|
for (const width of widths) {
|
|
|
|
this.root.push(new GridCol(width));
|
|
|
|
}
|
2017-03-07 19:22:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GridCol extends XmlComponent {
|
2022-12-29 09:57:15 +00:00
|
|
|
public constructor(width?: number | PositiveUniversalMeasure) {
|
2017-03-10 16:51:19 +01:00
|
|
|
super("w:gridCol");
|
2017-03-10 17:45:16 +01:00
|
|
|
if (width !== undefined) {
|
2022-12-29 09:57:15 +00:00
|
|
|
this.root.push(
|
|
|
|
new NextAttributeComponent<{ readonly width: number | PositiveUniversalMeasure }>({
|
|
|
|
width: { key: "w:w", value: twipsMeasureValue(width) },
|
|
|
|
}),
|
|
|
|
);
|
2017-03-10 17:45:16 +01:00
|
|
|
}
|
2017-03-07 19:22:10 +01:00
|
|
|
}
|
|
|
|
}
|