poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <n...@torchbox.com>
Subject Re: XLSX2CSV example using XSSF Date Question
Date Tue, 19 May 2009 09:43:00 GMT
On Mon, 18 May 2009, Chris Lott wrote:
> My test spreadsheet has dates in cells marked up as style #2.  Dale 
> Monti's has dates marked up as style #1.

That looks correct from your emails, yes. The s= tells you the style id

> I bet that a decent XLSX2CSV program has to use the 
> XSSFReader#getStylesTable() method, and then call 
> StylesTable#getCellStyleXfAt() with the value of the cell's "s" 
> attribute. Here they were 1, 2, etc.


> Unfortunately the POI javadoc has only the signature for that method, no 
> explanation.  The return value is of type 
> org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf which I will 
> have to dig more to find.

That class is a xmlbeans compiled version of the underlying XSD from 
Microsoft/Ecma, which implements all the methods for that element. If you 
look in the spec at that element, then everything on it should be given by 
the class.

If you're going to be doing raw sax processing, then you're going to need 
to process styles.xml, and probably save details on the cellXfs, 
cellStyleXfs and cellStyles, iirc

> That takes a format index and a format string.  The doc doesn't indicate 
> whether it works as well on XSSF sheets.

DateUtil.isCellDateFormatted works for both xssf and hssf. I'd suggest you 
take a peek into that. Use that to trace back how to get both the index 
and the string from xssf, then do the same sort of thing for your sax 


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

View raw message