fix: table width in percentage should include '%'

This commit is contained in:
fmuscolino
2019-03-06 12:21:15 +01:00
parent b99d1fc129
commit 973177676e

View File

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