summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-09-09 09:17:22 +0100
committerMichael Williamson <mike@zwobble.org>2025-09-09 09:17:22 +0100
commit5ec3c49c22c3448cd0583be74512129c221cd030 (patch)
tree5066884e2841458c63f8e811e96430db19d8a5ee /lib
parent033466fcb57ba2f4c0f876ed8dec705de5c68333 (diff)
Test reading of table rows when non-rows are present
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/body-reader.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 776cd5d..e6a70e2 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -521,6 +521,7 @@ function BodyReader(options) {
return row.type !== documents.types.tableRow;
});
if (unexpectedNonRows) {
+ removeVMergeProperties(rows);
return elementResultWithMessages(rows, [warning(
"unexpected non-row element in table, cell merging may be incorrect"
)]);
@@ -563,6 +564,14 @@ function BodyReader(options) {
return elementResult(rows);
}
+ function removeVMergeProperties(rows) {
+ rows.forEach(function(row) {
+ row.children.forEach(function(cell) {
+ delete cell._vMerge;
+ });
+ });
+ }
+
function readDrawingElement(element) {
var blips = element
.getElementsByTagName("a:graphic")