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

27 lines
764 B
TypeScript
Raw Normal View History

import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { twipsMeasureValue } from "@util/values";
export interface IColumnAttributes {
readonly width: number | string;
readonly space?: number | string;
}
export class ColumnAttributes extends XmlAttributeComponent<IColumnAttributes> {
protected readonly xmlKeys = {
2021-09-18 23:14:13 +10:00
width: "w:w",
space: "w:space",
};
}
export class Column extends XmlComponent {
2021-09-18 23:14:13 +10:00
constructor({ width, space }: IColumnAttributes) {
super("w:col");
this.root.push(
new ColumnAttributes({
width: twipsMeasureValue(width),
space: space === undefined ? undefined : twipsMeasureValue(space),
2021-09-18 23:14:13 +10:00
}),
);
}
}