开发者

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

开发者 https://www.devze.com 2022-12-12 18:49 出处:网络
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 getRichStrin

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 getRichString开发者_运维技巧CellValue() method of HSSFCELL Object).


Try this:

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

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

精彩评论

暂无评论...
验证码 换一张
取 消