Tidied up table components
This commit is contained in:
19
src/file/table/table-properties/table-width.ts
Normal file
19
src/file/table/table-properties/table-width.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
import { WidthType } from "../table-cell";
|
||||
|
||||
interface ITableWidth {
|
||||
type: WidthType;
|
||||
w: number | string;
|
||||
}
|
||||
|
||||
class TableWidthAttributes extends XmlAttributeComponent<ITableWidth> {
|
||||
protected xmlKeys = { type: "w:type", w: "w:w" };
|
||||
}
|
||||
|
||||
export class PreferredTableWidth extends XmlComponent {
|
||||
constructor(type: WidthType, w: number | string) {
|
||||
super("w:tblW");
|
||||
this.root.push(new TableWidthAttributes({ type, w }));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user