Files
docx-js/src/file/table/grid.ts
2018-01-23 01:33:12 +00:00

22 lines
594 B
TypeScript

import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
export class TableGrid extends XmlComponent {
constructor(cols: number[]) {
super("w:tblGrid");
cols.forEach((col) => this.root.push(new GridCol(col)));
}
}
class GridColAttributes extends XmlAttributeComponent<{ w: number }> {
protected xmlKeys = { w: "w:w" };
}
export class GridCol extends XmlComponent {
constructor(width?: number) {
super("w:gridCol");
if (width !== undefined) {
this.root.push(new GridColAttributes({ w: width }));
}
}
}