aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-05-12 22:10:57 +0100
committerMichael Williamson <mike@zwobble.org>2016-05-12 22:10:57 +0100
commit2e4585098eb6e538f7eb3eec09aa7f0b3351f7ea (patch)
treed64b002e264370387bf46ed40ec8e8b47fdd8ea6 /lib
parent5b8c7012f7f13efc867b2dda7b49455fde62dbbc (diff)
Simplify vMerge logic
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/body-reader.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 5474dd5..4b37510 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -240,7 +240,7 @@ function BodyReader(options) {
var element = properties.first("w:vMerge");
if (element) {
var val = element.attributes["w:val"];
- return val ? val : "continue";
+ return val === "continue" || !val;
} else {
return null;
}
@@ -271,11 +271,11 @@ function BodyReader(options) {
rows.forEach(function(row) {
var cellIndex = 0;
row.children.forEach(function(cell) {
- if (cell._vMerge === "continue" && columns[cellIndex]) {
+ if (cell._vMerge && columns[cellIndex]) {
columns[cellIndex].rowSpan++;
- cell._delete = true;
} else {
columns[cellIndex] = cell;
+ cell._vMerge = false;
}
cellIndex += cell.colSpan;
});
@@ -283,7 +283,7 @@ function BodyReader(options) {
rows.forEach(function(row) {
row.children = row.children.filter(function(cell) {
- return !cell._delete;
+ return !cell._vMerge;
});
row.children.forEach(function(cell) {
delete cell._vMerge;