You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Finnerty, Mary Ann (GE Healthcare)" <ma...@ge.com> on 2006/08/23 18:10:43 UTC

Number Record

I am using POI to read xls files - no interest in writing them - BUT I
need to get Number fields as plain text -- exactly as they are input
into the spreadsheet.
The default behavior is to read them in and turn them into doubles, but
I can't do that.
 
Anyone know how I can get around this?
 
Thanks!
Maffy
 

Mary Ann "Maffy" Finnerty

GE Healthcare 

Integrated IT 

Enterprise Solutions

Sr. Software Engineer

 

T 206 607 5612

C 206 419 6784

E Maryann.Finnerty@ge.com

www.gehealthcare.com

 

925 Fourth Avenue, Suite 400

Seattle, WA 98104 USA

-----------
I would rather be exposed to the inconveniences attending too much
liberty than to those attending too small a degree of it.
  - Thomas Jefferson
<http://www.quotationspage.com/quotes/Thomas_Jefferson> 
 

RE: Number Record

Posted by "Finnerty, Mary Ann (GE Healthcare)" <ma...@ge.com>.
How do I get the stored cell formatting?
Maffy 

-----Original Message-----
From: Avik Sengupta [mailto:avik.sengupta@itellix.com] 
Sent: Wednesday, August 23, 2006 10:54 AM
To: poi-user@jakarta.apache.org
Subject: Re: Number Record

the 'default behaviour' is because Excel stores the data in that way..  
ie, numbers are stored as IEEE floats within the excel file.

On load, excel applies the stored cell formatting to the double before
displaying on screen. If that is your requirement, that is what you
should do.

Regards
-
Avik


Quoting "Finnerty, Mary Ann (GE Healthcare)" <ma...@ge.com>:

> I am using POI to read xls files - no interest in writing them - BUT I

> need to get Number fields as plain text -- exactly as they are input 
> into the spreadsheet.
> The default behavior is to read them in and turn them into doubles, 
> but I can't do that.
>
> Anyone know how I can get around this?
>
> Thanks!
> Maffy
>
>
> Mary Ann "Maffy" Finnerty
>
> GE Healthcare
>
> Integrated IT
>
> Enterprise Solutions
>
> Sr. Software Engineer
>
>
>
> T 206 607 5612
>
> C 206 419 6784
>
> E Maryann.Finnerty@ge.com
>
> www.gehealthcare.com
>
>
>
> 925 Fourth Avenue, Suite 400
>
> Seattle, WA 98104 USA
>
> -----------
> I would rather be exposed to the inconveniences attending too much 
> liberty than to those attending too small a degree of it.
>   - Thomas Jefferson
> <http://www.quotationspage.com/quotes/Thomas_Jefferson>
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Number Record

Posted by Avik Sengupta <av...@itellix.com>.
the 'default behaviour' is because Excel stores the data in that way..  
ie, numbers are stored as IEEE floats within the excel file.

On load, excel applies the stored cell formatting to the double before  
displaying on screen. If that is your requirement, that is what you  
should do.

Regards
-
Avik


Quoting "Finnerty, Mary Ann (GE Healthcare)" <ma...@ge.com>:

> I am using POI to read xls files - no interest in writing them - BUT I
> need to get Number fields as plain text -- exactly as they are input
> into the spreadsheet.
> The default behavior is to read them in and turn them into doubles, but
> I can't do that.
>
> Anyone know how I can get around this?
>
> Thanks!
> Maffy
>
>
> Mary Ann "Maffy" Finnerty
>
> GE Healthcare
>
> Integrated IT
>
> Enterprise Solutions
>
> Sr. Software Engineer
>
>
>
> T 206 607 5612
>
> C 206 419 6784
>
> E Maryann.Finnerty@ge.com
>
> www.gehealthcare.com
>
>
>
> 925 Fourth Avenue, Suite 400
>
> Seattle, WA 98104 USA
>
> -----------
> I would rather be exposed to the inconveniences attending too much
> liberty than to those attending too small a degree of it.
>   - Thomas Jefferson
> <http://www.quotationspage.com/quotes/Thomas_Jefferson>
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Number Record

Posted by de...@yahoo.com.
See if the following helps you:


HSSFCell cell = ......
HSSFCellStyle cellStyle = cell.getCellStyle();
int formatIndex = cellStyle.getDataFormat
String format = HSSFDataFormat.getFormat(formatIndex);

// Use the format String to format 
// ...the number value from the cell

String formattedValue = applyFormat(cell, format);

// You will need to write code for applyFormat()




Regards,
~ amol




--- "Finnerty, Mary Ann (GE Healthcare)"
<ma...@ge.com> wrote:

> I am using POI to read xls files - no interest in
> writing them - BUT I
> need to get Number fields as plain text -- exactly
> as they are input
> into the spreadsheet.
> The default behavior is to read them in and turn
> them into doubles, but
> I can't do that.
>  
> Anyone know how I can get around this?
>  
> Thanks!
> Maffy
>  
> 
> Mary Ann "Maffy" Finnerty
> 
> GE Healthcare 
> 
> Integrated IT 
> 
> Enterprise Solutions
> 
> Sr. Software Engineer
> 
>  
> 
> T 206 607 5612
> 
> C 206 419 6784
> 
> E Maryann.Finnerty@ge.com
> 
> www.gehealthcare.com
> 
>  
> 
> 925 Fourth Avenue, Suite 400
> 
> Seattle, WA 98104 USA
> 
> -----------
> I would rather be exposed to the inconveniences
> attending too much
> liberty than to those attending too small a degree
> of it.
>   - Thomas Jefferson
>
<http://www.quotationspage.com/quotes/Thomas_Jefferson>
> 
>  
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/