Reputation: 781
How can I make read only cell in Excel using Java ?
Upvotes: 1
Views: 5072
Reputation: 11317
You may use Apache POI library to achieve this. Here is a simple code sample:
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Test");
Row row = sheet.createRow(0);
CellStyle style = wb.createCellStyle();
style.setLocked(true);
cell = row.createCell(0);
cell.setCellStyle(style);
// this is important as locking is pnly activated if sheet is protected
sheet.protectSheet("");
Upvotes: 5
Reputation: 1068
Take a look at the Apache POI project, specifically the HSSF & XSSF subprojects, that provides a Java library to manipulate Excel documents.
Upvotes: -2