import { decimalNumber, twipsMeasureValue } from "file/values"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; // // // // // // // // // export interface IColumnsAttributes { readonly space?: number | string; readonly count?: number; readonly separate?: boolean; readonly equalWidth?: boolean; } export class ColumnsAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { space: "w:space", count: "w:num", separate: "w:sep", equalWidth: "w:equalWidth", }; } export class Columns extends XmlComponent { constructor({ space, count, separate, equalWidth }: IColumnsAttributes) { super("w:cols"); this.root.push( new ColumnsAttributes({ space: space === undefined ? undefined : twipsMeasureValue(space), count: count === undefined ? undefined : decimalNumber(count), separate, equalWidth, }), ); } }