Files
docx-js/src/file/document/body/section-properties/properties/column.ts

25 lines
951 B
TypeScript
Raw Normal View History

import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
// <xsd:complexType name="CT_Column">
// <xsd:attribute name="w" type="s:ST_TwipsMeasure" use="optional" />
// <xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional" default="0" />
// </xsd:complexType>
type IColumnAttributes = {
readonly width: number | PositiveUniversalMeasure;
readonly space?: number | PositiveUniversalMeasure;
};
export class Column extends XmlComponent {
2022-08-31 07:52:27 +01:00
public constructor({ width, space }: IColumnAttributes) {
super("w:col");
this.root.push(
new NextAttributeComponent<IColumnAttributes>({
width: { key: "w:w", value: twipsMeasureValue(width) },
space: { key: "w:space", value: space === undefined ? undefined : twipsMeasureValue(space) },
2021-09-18 23:14:13 +10:00
}),
);
}
}