I want to lock an Excel cell (none-editable cell) using Apache POI
. I'm using HSSFWorkbook
and here what I've tried so far.
First I created a style.
Font mystyle = workbook.createFont();
headerFont.setFontHeightInPoints((short) 11);
style = workbook.createCellStyle();
style.setLocked(true);
Then I added it like below.
resultCell.setCellValue("mystyle");
resultCell.setCellStyle((CellStyle) formatter.styles.get("mystyle"));
But it doesn't lock the cell, still I can edit the cell. Is there any other way to achieve this ?