From a810faafad185598bb183b9214753785ecbf3ba1 Mon Sep 17 00:00:00 2001 From: KKK <42832987+fernfei@users.noreply.github.com> Date: Fri, 6 Oct 2023 18:57:21 +0800 Subject: [PATCH] [Feature]Recognize the percentage measure when pasting a table from an external word --- common/wordcopypaste.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/wordcopypaste.js b/common/wordcopypaste.js index 8ad6e756bc..270798318d 100644 --- a/common/wordcopypaste.js +++ b/common/wordcopypaste.js @@ -8465,6 +8465,8 @@ PasteProcessor.prototype = var oDocument = this.oDocument; var tableNode = node, newNode, headNode; var bPresentation = !PasteElementsId.g_bIsDocumentCopyPaste; + var bPercentWidth = node.style.width.indexOf('%') !== -1 || node.width.indexOf('%') !== -1; + var nPercentWidth = bPercentWidth ? parseInt(node.style.width || node.width) : 0; //Ищем если есть tbody var i, length, j, length2; @@ -8678,7 +8680,10 @@ PasteProcessor.prototype = //набиваем content this._ExecuteTable(tableNode, node, table, aSumGrid, nMaxColCount !== nMinColCount ? aColsCountByRow : null, pPr, bUseScaleKoef, dScaleKoef, arrShapes, arrImages, arrTables); table.MoveCursorToStartPos(); - + + if (bPercentWidth) { + table.SetTableProps({TableWidth:-nPercentWidth}); + } if (!bPresentation) { this.aContent.push(table); }