Files
docx-js/src/file/table/table-properties/table-width.ts

20 lines
555 B
TypeScript
Raw Normal View History

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