From e0e4e135459ea3ec954c02cf1d48e27d6d02ba7c Mon Sep 17 00:00:00 2001 From: Libor M Date: Thu, 1 Jun 2017 18:26:19 +0200 Subject: [PATCH] fix colSpan preparing --- src/docMeasure.js | 8 ++++++++ src/docPreprocessor.js | 14 ++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/docMeasure.js b/src/docMeasure.js index 3d0156dfe..af3f478cb 100644 --- a/src/docMeasure.js +++ b/src/docMeasure.js @@ -518,6 +518,14 @@ DocMeasure.prototype.measureTable = function (node) { for (row = 0, rows = node.table.body.length; row < rows; row++) { var rowData = node.table.body[row]; var data = rowData[col]; + if (data === undefined) { + console.error('Malformed table row ', rowData, 'in node ', node); + throw 'Malformed table row, a cell is undefined.'; + } + if (data === null) { // transform to object + data = ''; + } + if (!data._span) { data = rowData[col] = this.styleStack.auto(data, measureCb(this, data)); diff --git a/src/docPreprocessor.js b/src/docPreprocessor.js index f7abbf55a..2432c5e46 100644 --- a/src/docPreprocessor.js +++ b/src/docPreprocessor.js @@ -88,15 +88,13 @@ DocPreprocessor.prototype.preprocessTable = function (node) { for (row = 0, rows = node.table.body.length; row < rows; row++) { var rowData = node.table.body[row]; var data = rowData[col]; - if (data === undefined) { - console.error('Malformed table row ', rowData, 'in node ', node); - throw 'Malformed table row, a cell is undefined.'; - } - if (data === null) { // transform to object - data = ''; - } + if (data !== undefined) { + if (data === null) { // transform to object + data = ''; + } - rowData[col] = this.preprocessNode(data); + rowData[col] = this.preprocessNode(data); + } } }