2021-09-18 22:58:19 +10:00
|
|
|
import { twipsMeasureValue } from "file/values";
|
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
|
|
|
|
|
|
|
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",
|
|
|
|
};
|
2021-09-18 22:58:19 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Column extends XmlComponent {
|
2021-09-18 23:14:13 +10:00
|
|
|
constructor({ width, space }: IColumnAttributes) {
|
2021-09-18 22:58:19 +10:00
|
|
|
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
|
|
|
}),
|
|
|
|
);
|
2021-09-18 22:58:19 +10:00
|
|
|
}
|
|
|
|
}
|