Thanks for reply
DateUtil.isCellDateFormatted(cell)  method needs Cell instance as parameter,
how do I create Cell instance, as I am using low level XMLStreamReader's
event based api to parse sheet XML

I am using XMLStreamReader as I need to process very large Excel and I am
getting Out of memory errors with other APIs/approches

My example code snippet
 

......
      this.xmlReader.next();
      if (this.xmlReader.isStartElement())
      {
        if (this.xmlReader.getLocalName().equals("c"))
        {
          String cellID = this.xmlReader.getAttributeValue(null, "r");
          CellReference cellReference = new CellReference(cellID);
          String colName =
CellReference.convertNumToColString(cellReference.getCol());
          String cellType = this.xmlReader.getAttributeValue(null, "t");
           String cellValue = getCellValue(cellType);
           rowValues.add(cellValue);
          }
        }
      }
          
          
          
          
   private String getCellValue(String cellType) throws XMLStreamException
  {
    String value = EMPTY; // by default
    while (this.xmlReader.hasNext())
    {
      this.xmlReader.next();
      if (this.xmlReader.isStartElement())
      {
        if (this.xmlReader.getLocalName().equals("v"))
        {
          if ((cellType != null) && cellType.equals("s"))
          {
            int idx = Integer.parseInt(this.xmlReader.getElementText());
            return new
XSSFRichTextString(this.stringsTable.getEntryAt(idx)).toString();
          }
          else
          {
            return this.xmlReader.getElementText();
          }
        }
      }
      else if (this.xmlReader.isEndElement() &&
this.xmlReader.getLocalName().equals("c"))
      {
        break;
      }
    }
    return value;
  }



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/How-to-identify-date-cell-type-using-XMLStreamReader-poi-s-XSSFReader-api-tp5727025p5727027.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to