-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
🐛 Bug Report
Data validations are not shifted when adding/deleting rows.
Lib version: 4.2.1
Steps To Reproduce
I got a cell on A1 with a data validation. When I use spliceRows() rows to insert a row above that cell, the validation is still on A1, but I expect it to be on A2. Similar to #737, but for validations.
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet("Sheet");
sheet.addRows([[1]]);
const cell = sheet.getCell('A1');
cell.dataValidation = {
type: "list",
allowBlank: true,
formulae: [`"1,2,3,4"`],
}
sheet.insertRow(1,'')
The expected behaviour:
expect sheet.getCell('A1').dataValidation
to be undefined, but it's not. And sheet.getCell('A2').dataValidation
to be present, but it's undefined.
Possible solution:
If dataValidations should have the same behavior as styles, the solution can be as simple as adding
rDst.getCell(colNumber).dataValidation = cell.dataValidation;
to the spliceRows() function (similar to PR 737).
Metadata
Metadata
Assignees
Labels
No labels