fix mergecell bug in table

This commit is contained in:
Aserus
2018-03-22 09:47:38 +03:00
committed by GitHub
parent 8ee71b8846
commit 3c3ef562fa
+18
View File
@@ -1004,6 +1004,8 @@ module.exports = (function() {
Workbook.prototype.pushDown = function(workbook, sheet, tables, currentRow, numRows) {
var self = this;
var mergeCells = sheet.find("mergeCells");
// Update merged cells below this row
sheet.findall("mergeCells/mergeCell").forEach(function(mergeCell) {
var mergeRange = self.splitRange(mergeCell.attrib.ref),
@@ -1020,6 +1022,22 @@ module.exports = (function() {
});
}
//add new merge cell
if (mergeStart.row == currentRow) {
for (var i = 1; i <= numRows; i++) {
var newMergeCell = self.cloneElement(mergeCell);
mergeStart.row += 1;
mergeEnd.row += 1;
newMergeCell.attrib.ref = self.joinRange({
start: self.joinRef(mergeStart),
end: self.joinRef(mergeEnd)
});
mergeCells.attrib.count += 1;
mergeCells._children.push(newMergeCell);
}
}
});
// Update named tables below this row