Is there a way to lock certain cells from being edited by the user? I have tried the following:
WritableCellFormat cf = new WritableCellFormat();
cf.setLocked(true);
sheet.addCell(new Number(col, row, value, cf));
However this doesn’t seem to have any effect on the resulting spreadsheet i.e. the cell contents can still be changed when the file is opened in Excel.
you have to “activate” protection for each sheet. I’m not shure how exactly this should be done. The method I found is
but obviously this method is no longer recommended. So You should probably try to find some newer one.
edit:
sorry, my mistake. This lock every cell in the sheet.
edit 2:
It works for me if you lock entiry sheet and then unlock editable cells.