I have an excel file with table which cells are locked. I want to insert a new row between existing locked rows, but with editing abilities. Is it able in Apache POI?
I tried to use many different sheet protection options
Example of code:
var book = new SXSSFWorkbook();
var sheet = book.createSheet(SHEET_NAME);
sheet.protectSheet("password");
var unlockedStyle = book.createCellStyle();
unlockedStyle.setLocked(false);
var lockedStyle = book.createCellStyle();
lockedStyle.setLocked(true);
for (int rowNum = 0; rowNum < 20; rowNum++) {
var row = sheet.createRow(rowNum);
for (int colNum = 0; colNum < 10; colNum++) {
var cell = row.createCell(colNum);
cell.setCellStyle(lockedStyle);
}
}
for (int colNum = 0; colNum < 10; colNum++) {
sheet.setDefaultColumnStyle(colNum, unlockedStyle);
}