Currently when creating a protected Sheet it's impossible to allow edits on ranges of cells.
(In reply to comment #0) > Currently when creating a protected Sheet it's impossible to allow edits on > ranges of cells. did you have solution for this problem? i have the same
Any chance you could produce three closely related files with excel? They'd be: * Two sheets, with a small number of rows+cells, both sheets un-protected * Then protect one of the sheets * Then allow editing of a couple of cells on the protected sheet Please upload these files to the bug. Then, please try to use BiffViewer (org.apache.poi.hssf.dev.BiffViewer) to spot what Excel did differently between the files. What records were added to allow edits to the range of cells? Was the protection done differently overall? (Until we know what the file format needs to look like to support this, the feature can't be added)
Created attachment 26985 [details] 2 Excel files + their Biffviewer dump 2 excel files identical except that one has a protected sheet including an unprotected range (on the other one everything is unprotected). The range is named "protectedrange" and exists within the two files. + The biffviewer dump (--out) of those two files. I hope I got what you were expecting to develop this feature. If not tell me. Steph
Is there any update on this subject? Is there any known workaround? We're trying to have a protected sheet (removing the possibility to remove columns/lines) but with the possibility to edit fields in a given range.
Found a workaround using CellStyles CellStyle cellStyle = wb.createCellStyle(); cellStyle.setLocked(false); Cell cell = sheet.createRow(0).createCell(0); cell.setCellValue("Value"); cell.setCellStyle(cellStyle); sheet.protectSheet("pass"); I Hope this helps someone else.
I think this example should be the accepted solution, and this issue could be closed as WONTFIX or perhaps INVALID or WORKSFORME. The resulting XSSF workbook at least is structured the way Excel does it, with the unlock overrides stored at the cell style level. This applies to row and column cell styles as well. This could be added as another example, perhaps, as it's not particularly intuitive.