From aaefb5344e5407d7d2bbd5eea663a644ad995eb6 Mon Sep 17 00:00:00 2001 From: ThomasChan Date: Wed, 25 Sep 2019 15:13:40 +0800 Subject: [PATCH] fix xlsx merge cells logic --- xlsx.flow.js | 7 ++++++- xlsx.js | 7 ++++++- xlsx.mini.flow.js | 7 ++++++- xlsx.mini.js | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/xlsx.flow.js b/xlsx.flow.js index 5dd0e1c..69bc77a 100644 --- a/xlsx.flow.js +++ b/xlsx.flow.js @@ -19184,7 +19184,12 @@ function parse_dom_table(table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ { } } if (cInRange.indexOf(C) !== -1) { - C = Math.max.apply(null, cInRange) + 1; + for (let i = 0; i < cInRange.length; i++) { + C += 1; + if (cInRange.indexOf(C) === -1) { + break; + } + } } /* TODO: figure out how to extract nonstandard mso- style */ CS = +elt.colSpan || 1; diff --git a/xlsx.js b/xlsx.js index 0344342..08f1345 100644 --- a/xlsx.js +++ b/xlsx.js @@ -19068,7 +19068,12 @@ function parse_dom_table(table, _opts) { } } if (cInRange.indexOf(C) !== -1) { - C = Math.max.apply(null, cInRange) + 1; + for (let i = 0; i < cInRange.length; i++) { + C += 1; + if (cInRange.indexOf(C) === -1) { + break; + } + } } /* TODO: figure out how to extract nonstandard mso- style */ CS = +elt.colSpan || 1; diff --git a/xlsx.mini.flow.js b/xlsx.mini.flow.js index b8f9bad..c836af7 100644 --- a/xlsx.mini.flow.js +++ b/xlsx.mini.flow.js @@ -7403,7 +7403,12 @@ function parse_dom_table(table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ { } } if (cInRange.indexOf(C) !== -1) { - C = Math.max.apply(null, cInRange) + 1; + for (let i = 0; i < cInRange.length; i++) { + C += 1; + if (cInRange.indexOf(C) === -1) { + break; + } + } } /* TODO: figure out how to extract nonstandard mso- style */ CS = +elt.colSpan || 1; diff --git a/xlsx.mini.js b/xlsx.mini.js index 5389244..c1f9342 100644 --- a/xlsx.mini.js +++ b/xlsx.mini.js @@ -7312,7 +7312,12 @@ function parse_dom_table(table, _opts) { } } if (cInRange.indexOf(C) !== -1) { - C = Math.max.apply(null, cInRange) + 1; + for (let i = 0; i < cInRange.length; i++) { + C += 1; + if (cInRange.indexOf(C) === -1) { + break; + } + } } /* TODO: figure out how to extract nonstandard mso- style */ CS = +elt.colSpan || 1;