I have searched the forums, but cannot find a solution, or a definitive, "you
cannot do that". 

I am processing Excel (xlsx) files that are being delivered from multiple
locations. My goal is to be able to read the Excel file into a
multi-dimensional String array and have each item contain an exact String
duplication of the cell values as seen when opened in Excel. This would
include cells that contain custom formats.

In my current example, I have a column of values that each contain exactly
11 digits. The cells in this column have a custom format applied to them of
"000-00000-000". In the .xlsx file I can see the numberFormat
"000\-00000\-000" with an id of 164 in the styles.xml file.

When I read the cell value using DataFormatter.formatCellValue(cell), I am
returned the numeric value, not the formatted value. In my example I am
getting "12312345123" and not "123-12345-123". 

I have no way of knowing what custom formats will be applied to a cell or
group of cells before hand, each one can be different.

Is it possible within the API to read this cell as "123-12345-123" or am I
going to have to parse the styles.xml file and add each custom format that I
find there? And if I do, would it even work (I am assuming that when I add
the form I would have to unescape characters).

Any help would be appreciated, even if it's "you can't do that".

Thanks.

--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Reading-cell-values-that-have-a-custom-format-tp5486315p5486315.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to