Sadesh Kumar N
Sadesh Kumar N

Reputation: 2052

converting a numeric cell type into a text cell type in ms excel document without changing contents of the cell using open office

How to convert a numeric cell type into a text cell type in ms excel document without changing contents of the cell using open office. This cell value is then accessed using java (POI JAR getRichStringCellValue() method of HSSFCELL Object).

Upvotes: 1

Views: 1677

Answers (1)

True Soft
True Soft

Reputation: 8786

Try this:

HSSFWorkbook wb = ...;
DataFormat format = wb.createDataFormat();

HSSFCellStyle cellStyle = wb.createCellStyle();
style.setDataFormat(format.getFormat("@")); // or "text"
cell.setCellStyle(cellStyle);

Upvotes: 1

Related Questions