Hi Alex,
my problem then was a little bit different: I need to read digit and
solved it this way:
[..]
Double mydouble = null;
String myString = null;
try
{
final int cellType = cell.getCellType();
if (cellType == HSSFCell.CELL_TYPE_NUMERIC)
{
mydouble = new Double(cell.getNumericCellValue());
}
else if (cellType == HSSFCell.CELL_TYPE_STRING)
{
myString = cell.getStringCellValue();
mydouble = parseStringVal(myString);
}
}
catch (NumberFormatException nfe)
{
[..]
Starting with this it should be no problem to process the myDouble variable
with a
proper NumbberFormatter to archive the results need, or?
hth, greetings and with kindly regards,
Stefan
Stefan Marx
Marx Consulting (extern)
REWE GROUP
Geschäftsbereich Konzern-Systeme
Funktionsbereich Business-Systeme
REWE-Informations-Systeme GmbH
Humboldtstraße 140-144 - 51149 Köln
Telefon: +49 (0)221 149 - 5953
Telefax: +49 (0)221 149 - 97 5953
E-Mail: [EMAIL PROTECTED]
www.rewe-group.com
> -----Ursprüngliche Nachricht-----
> Von: Alex Mayorga Adame [SMTP:[EMAIL PROTECTED]
> Gesendet am: Donnerstag, 31. August 2006 17:48
> An: [email protected]
> Betreff: Re: AW: Reading numeric values as strings from a cell
>
>
> Hi Karl, Stefan and everyone,
>
> I'm new to the Jakarta POI API and facing this exact same problem and
> getting messed up dates as well. I don't have any saying to put the ' on
> the
> Excel files. Is there a way to achieve this programmatically.
>
> In short, there's a need to extract the contents of the cells as they show
> on the worksheet, extracted as a string no matter what the Cell number
> format is.
>
> Any help would be highly appreciated.
> Alex
>
>
> KHZ (SAW) wrote:
> >
> > Hi Stefan.
> >
> > Prefixing with ' we omitted such problems.
> >
> > Regards, Karl-Heinz.
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Marx, Stefan ext. MA Fa. Lynx
> > [mailto:[EMAIL PROTECTED]
> > Gesendet: Mittwoch, 15. Februar 2006 09:42
> > An: '[email protected]'
> > Betreff: Reading numeric values as strings from a cell
> >
> > Hi guys,
> >
> > a question concering numeric data format and access to it:
> > I read a excel 97 sheet and test if all the cells of inter-
> > est are datatype 49 to have alphanumeric access to the cell
> > content. I'll like to have the cell content as text in order
> > to process for example 13 digit long DB2 table attributes.
> >
> > But even if I try to read the Excel formatted field (all di-
> > gits and left vertical aligned) as text, I have to read them
> > as CELL_TYPNUMERIC. With this approach I lost the text infos
> > and must bother with Doubles, Integer Java types with is a
> > little overhead (even with toString()) for my aim.
> > Wen I enter numeric data in the text formatted cell things
> > turn better a I can process the content as ordenary strings.
> >
> > Any suggestions how to extract all numeric values a strings?
> >
> > Thanks a lot in advance for reading and much more for writting ;=).
> >
> > Greetings from Cologne, Germany,
> > Stefan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Reading-numeric-values-as-strings-from-a-cell-tf1126
> 130.html#a6082251
> Sent from the POI - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/