From 973177676edbb1996830d37dad59e75249d40414 Mon Sep 17 00:00:00 2001 From: fmuscolino Date: Wed, 6 Mar 2019 12:21:15 +0100 Subject: [PATCH] fix: table width in percentage should include '%' --- src/file/table/table-properties/table-width.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/file/table/table-properties/table-width.ts b/src/file/table/table-properties/table-width.ts index 957fe49094..a463e958df 100644 --- a/src/file/table/table-properties/table-width.ts +++ b/src/file/table/table-properties/table-width.ts @@ -15,6 +15,7 @@ class TableWidthAttributes extends XmlAttributeComponent { 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 })); } }