Are you after the Cell's CellStyle's DataFormat? On Jun 26, 2017 4:34 PM, "Blake Watson" <blake.wat...@pnmac.com> wrote:
> > Hi, guys-- > > I'm struggling with figuring out how to determine what type a cell SHOULD > be. If I use CellType, what I get is the contents of the cell as they > currently are. For example, an empty cell which is formatted as "#,##0" > will have a type of "blank" but I'd like to be able to get that it's meant > to be a number. > > This came up because my users were creating Excel spreadsheets with a > 10-digit ID number like and defining it as "a number between 1000000000 and > 9999999999". The problem being this would end up as a double, and (at > export time) come out as something like "1.23456789E9". > > So I sez to 'em, I sez, "Hey, it's not a number, it's a numeral. Format it > as text in your Excel, and I'll know to treat it as a string." That seems > sensible to me: If it's a numeral, don't pretend it's a number. It's just a > string that happens to look like a number. > > But then I realized that blanks all come out as, well, blank (or > CellType/BLANK rather). Do I have to suss the type from the format manually > to get the type they mean? Is there any way for them to specify in Excel > that something is a particular type that POI can tell me what they mean? > -- > > *Blake Watson* > > *PNMAC* > Application Development Manager > 5898 Condor Drive > Moorpark, CA 93021 > (805) 330.4911 x7742 > blake.wat...@pnmac.com > www.PennyMacUSA.com <http://www.pennymacusa.com/> >