2019-03-04 22:50:04 +00:00
|
|
|
// http://officeopenxml.com/WPtableWidth.php
|
2018-10-23 23:44:50 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
|
|
|
|
|
|
|
import { WidthType } from "../table-cell";
|
|
|
|
|
|
|
|
interface ITableWidth {
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly type: WidthType;
|
|
|
|
readonly w: number | string;
|
2018-10-23 23:44:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class TableWidthAttributes extends XmlAttributeComponent<ITableWidth> {
|
2018-11-02 02:51:57 +00:00
|
|
|
protected readonly xmlKeys = { type: "w:type", w: "w:w" };
|
2018-10-23 23:44:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class PreferredTableWidth extends XmlComponent {
|
2019-03-04 22:50:04 +00:00
|
|
|
constructor(type: WidthType, w: number) {
|
2018-10-23 23:44:50 +01:00
|
|
|
super("w:tblW");
|
|
|
|
this.root.push(new TableWidthAttributes({ type, w }));
|
|
|
|
}
|
|
|
|
}
|