poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vijayakumar Gowdaman <vijayakumar.gowda...@db.com>
Subject identifying the date cell
Date Tue, 12 Jan 2010 09:45:40 GMT
I am using the POI version 3.5. I want to identify a Cell is a date 
formatted cell. I was looking at the interface 
which is not having a field to identify a date formatted cell. 

When I tried the below code 

CellReference cellReference = new CellReference("A5");
Row row = sheet.getRow(cellReference.getRow());
Cell cell = row.getCell(cellReference.getCol());
int cellFormat = cell.getCellType();

the value of the cellFormat is 0 for both numeric and date fields. 

But I can alternativley identify a date cell by using below code 

if(cellFormat == CELL.CELL_TYPE_NUMERIC) {
    if(DateUtil.isCellDateFormatted(cell)) {
        //Date cell 
    } else {
       //Numeric cell

but is there a way to check the date cell straight away with out calling 
the DateUtil class.


Vijayakumar Gowdaman


This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in
this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate
and regulatory disclosures.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message