From 28233075bd693cfa2639b0f4b32bc1fa08856026 Mon Sep 17 00:00:00 2001 From: Andrey Savin Date: Tue, 28 Sep 2021 15:57:33 +0300 Subject: [PATCH] Append % if type is "pct" (WidthType.PERCENTAGE) --- src/file/table/table-width.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/file/table/table-width.ts b/src/file/table/table-width.ts index ff203506eb..554654a583 100644 --- a/src/file/table/table-width.ts +++ b/src/file/table/table-width.ts @@ -38,6 +38,10 @@ export class TableWidthElement extends XmlComponent { constructor(name: string, { type = WidthType.AUTO, size }: ITableWidthProperties) { super(name); // super("w:tblW"); - this.root.push(new TableWidthAttributes({ type: type, size: measurementOrPercentValue(size) })); + let tableWidthValue = size; + if (type === WidthType.PERCENTAGE && typeof size === "number") { + tableWidthValue = `${size}%`; + } + this.root.push(new TableWidthAttributes({ type: type, size: measurementOrPercentValue(tableWidthValue) })); } }