how to remove warnings in excel generated by POI ?

痞子三分冷 提交于 2019-12-10 16:07:03

问题


I am using Apache POI for writing content into excel sheet. after generating an excel in all the cells which ever cell has numbers, it contains one blue mark(each cells left top corner). its like a warning. how can i remove them while writing the content to excel? PFA screen shot.

Thanks!


回答1:


You can try to set the cell type:

HSSFCell cell = row1.createCell(i);
cell.setCellType(Cell.CELL_TYPE_STRING); // =0, or Cell.CELL_TYPE_NUMERIC = 1
cell.setCellValue(value);

See the API docs for more information.




回答2:


Below works for me.

**

HSSFCell cell = row1.createCell(i);
cell.setCellType(new Double(value));

**

Note: 'value' should be on numerals , it won't work on alphanumeric values. replace it wherever(cell values) it is required.



来源:https://stackoverflow.com/questions/9229644/how-to-remove-warnings-in-excel-generated-by-poi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!