When I am creating protected sheets using Apache POI, all cells are protected by default. I have to unlock each cell individually. Is it possible to protect a sheet will all cells unprotected by default (so that I protect only cells why I want).
/*for sheet protection*/
/*creating style to unlock cell */
CellStyle unlockedCellStyle = workbook.createCellStyle();
/*applying unlock style to cell */
It is not possible to have created cells default to unlocked; locked is the default. But you are on the right track by creating a
CellStyle with locked set to false. Make sure that you set locked to false on any and all of your new
CellStyle objects that you want to be unlocked. Additionally, Excel has a limit on the number of cell styles that can be created in a
Workbook, so re-use your
CellStyle object(s) with each
Cell you create.