Karthik.m
Karthik.m

Reputation: 781

single cell read only in excel using java

How can I make read only cell in Excel using Java ?

Upvotes: 1

Views: 5072

Answers (3)

lweller
lweller

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

Yurish
Yurish

Reputation: 1309

Maybe you can try jExcel. It is quite simple and easy to use.

Upvotes: -1

Deepak Sarda
Deepak Sarda

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

Related Questions