Make table internals declarative

This commit is contained in:
Dolan Miu
2021-03-04 01:42:58 +00:00
parent 9327f2bfa1
commit a026e5bd1f
6 changed files with 195 additions and 125 deletions

View File

@ -13,7 +13,7 @@ class TableWidthAttributes extends XmlAttributeComponent<ITableWidth> {
}
export class PreferredTableWidth extends XmlComponent {
constructor(type: WidthType, w: number) {
constructor(type: WidthType = WidthType.AUTO, w: number) {
super("w:tblW");
const width: number | string = type === WidthType.PERCENTAGE ? `${w}%` : w;
this.root.push(new TableWidthAttributes({ type: type, w: width }));