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.
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...
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
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?
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.
Furthermore it seems this is currently done "on purpose", see the comment in XSSFCell.getBaseCellType()