|Summary:||cellType is not override by integer value zero.|
|Component:||XSSF||Assignee:||POI Developers List <dev>|
Description Bhargav 2013-11-19 11:36:07 UTC
The following code fails to set the cell type by integer value zero. Other types are properly set but zero number seems to have issues. The HSSF Implimentation does not have this issue. CODE ===== //column is a short type variable set with 0,1,2,3,... XSSFCell cell = row.createCell(column); cell.setCellType(0) system.out.println("cell type value : "+cell.getCellTyep); OUTPUT ====== cell type value 3. if we set cell type with integer value one.it will be override with one. CODE ===== XSSFCell cell = row.createCell(column); cell.setCellType(1) system.out.println("cell type value : "+cell.getCellTyep); OUTPUT ====== cell type value 1. please response me as soon as possible. Thank you.
Comment 1 Nick Burch 2013-11-19 12:18:05 UTC
What happens if as well as setting the cell to be of type numeric, you also set a numeric value with it? A cell type of 3 is blank, which is understandable for a cell without any value...
Comment 2 Bhargav 2013-11-20 11:47:36 UTC
I mean to say that cellTyep is not proper set with value zero. For example: ------------ //public static final int CELL_TYPE_NUMERIC = 0; XSSFCell cell = row.createCell(1); system.out.println("Before - " + getCellType();) cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC); system.out.println("After - " + getCellType();) OUTPUT of above program ------------------------ Before - 3 After - 3 I can't understand what this happened. I set cellType with CELL_TYPE_NUMERIC(means zero) and when i get cellType, it will return value 3. how could it is possible.This issued only happened after change the POI-HSSF TO POI-XSSF.The HSSF Implimentation does not have this issue. For more information read below link : --------------------------------------- http://apache-poi.1045710.n5.nabble.com/XSSF-cellType-setting-to-number-td5710637.html
Comment 3 Nick Burch 2013-11-20 11:50:55 UTC
Setting a cell type on an empty cell without a value doesn't mean much though. What happens if you set a cell type *and* a value?
Comment 4 Dominik Stadler 2015-09-13 18:41:37 UTC
No update for a long time, therefore closing this as INVALID. Please reopen this with some more information if this is still a problem with the latest version of POI.
Comment 5 Dominik Stadler 2015-09-13 18:43:08 UTC
Furthermore it seems this is currently done "on purpose", see the comment in XSSFCell.getBaseCellType()