Skip to content

Commit

Permalink
Ignore pasted data that overflows when allowInsertColumn or allowInse…
Browse files Browse the repository at this point in the history
…rtRow is false
  • Loading branch information
ChristopheB authored Jun 4, 2021
1 parent 53db1d9 commit 1ce5f48
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/js/jexcel.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6227,7 +6227,13 @@ var jexcel = (function(el, options) {
i++;
if (row[i] != null) {
if (colIndex >= obj.headers.length - 1) {
obj.insertColumn();
// If the pasted column is out of range, create it if possible
if (obj.options.allowInsertColumn == true) {
obj.insertColumn();
// Otherwise skip the pasted data that overflows
} else {
break;
}
}
colIndex = obj.right.get(colIndex, rowIndex);
}
Expand All @@ -6236,7 +6242,13 @@ var jexcel = (function(el, options) {
j++;
if (data[j]) {
if (rowIndex >= obj.rows.length-1) {
obj.insertRow();
// If the pasted row is out of range, create it if possible
if (obj.options.allowInsertRow == true) {
obj.insertRow();
// Otherwise skip the pasted data that overflows
} else {
break;
}
}
rowIndex = obj.down.get(x, rowIndex);
}
Expand Down

0 comments on commit 1ce5f48

Please sign in to comment.