2018-09-12 21:01:52 +01:00
|
|
|
// http://officeopenxml.com/WPtableGrid.php
|
2017-12-30 20:25:16 +00:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
2017-03-07 19:22:10 +01:00
|
|
|
|
|
|
|
export class TableGrid extends XmlComponent {
|
2017-03-10 16:51:19 +01:00
|
|
|
constructor(cols: number[]) {
|
|
|
|
super("w:tblGrid");
|
|
|
|
cols.forEach((col) => this.root.push(new GridCol(col)));
|
2017-03-07 19:22:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-02 02:51:57 +00:00
|
|
|
class GridColAttributes extends XmlAttributeComponent<{ readonly w: number }> {
|
|
|
|
protected readonly xmlKeys = { w: "w:w" };
|
2017-03-10 16:51:19 +01:00
|
|
|
}
|
|
|
|
|
2017-03-07 19:22:10 +01:00
|
|
|
export class GridCol extends XmlComponent {
|
|
|
|
constructor(width?: number) {
|
2017-03-10 16:51:19 +01:00
|
|
|
super("w:gridCol");
|
2017-03-10 17:45:16 +01:00
|
|
|
if (width !== undefined) {
|
2018-01-23 01:33:12 +00:00
|
|
|
this.root.push(new GridColAttributes({ w: width }));
|
2017-03-10 17:45:16 +01:00
|
|
|
}
|
2017-03-07 19:22:10 +01:00
|
|
|
}
|
|
|
|
}
|