poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thangaraju Saravanan <sara...@ms.com>
Subject Re: Retrieving in the same excel format.
Date Thu, 10 Apr 2003 13:47:09 GMT
I do respect the philosophy, But this is an existing problem that could be provided as
atleast as an utility method , since the developers of the code know it very well.

Regards
Sara



Avik Sengupta wrote:

> > I do not want to know the format of the cell, but i want the value as shown in
> > the Excel sheet when you view it .
>
> The philosophy of POI as a _library_ that reads file formats is that it
> provides the format in all its glory to the client programmer. It tends
> to faithfully map the semantics of the file format, tho wrapping it in a
> simpler object oriented syntax. We do not want POI to add any extra
> semantics between the file format and the client programmer.
>
> In respect of your particular requirement, have you seen, for example,
> if the currency format is diplayed according to the OS locale. ie, if a
> spreadsheet is created in Excel in UK (ie, windows UK locale) and a cell
> formatted as a currency, what happens if that same spreadsheet is opened
> in an US locale machine?
>
> That will give you an idea if that information is stored in the file in
> the first place. If it is not, there is no way you can get at it, is
> there?
>
> On Thu, 2003-04-10 at 18:14, Thangaraju Saravanan wrote:
> > Hi,
> >
> >  The problem is :
> >
> >  In my excel sheet let us say i have column  with the value $5 ( The cell is of
> > type currency with $ as symbol)
> >
> > In POI if i read this it will give the cell type as Numeric and therefore i will
> > get 5 as a double. But I do not know whether it is a $5 or any other currency
> >
> > I do not want to know the format of the cell, but i want the value as shown in
> > the Excel sheet when you view it .
> >
> > Is there any API to get $5 as a String
> > (I do not want to deal with numeric and cell style and data format)
> >
> >
> > Regards
> > Sara
> >
> > "Ramirez, Oscar" wrote:
> >
> > > Sara,
> > >
> > > To clarify what you are looking for, you want to know if there is an API in
> > > POI to determine the format of a cell (the values that appear in the 'Format
> > > Cells' dialog box in Excel). You do not know the format of the cell
> > > beforehand.
> > >
> > > I would be very interested to know if you find a solution, for I am also
> > > processing spreadsheets that I do not know the exact content of beforehand.
> > >
> > > Thanks,
> > >
> > > Oscar A. Ramirez
> > > Goldman, Sachs & Co.
> > > Voice:  (212) 357-7402
> > > Email:  oscar.ramirez@gs.com
> > >
> > > -----Original Message-----
> > > From: Thangaraju Saravanan [mailto:saravan@ms.com]
> > > Sent: Thursday, April 10, 2003 8:31 AM
> > > To: POI Users List
> > > Subject: Re: Retrieving in the same excel format.
> > >
> > > Thomas,
> > >
> > >  Thanks. Even I went to the extent of  using SimpleDateFormat only. But
> > > consider my problem like this.
> > >
> > >  But I am losing the format which the users has used ?
> > >
> > >  A similar problem is sometimes US users will send with a dollar symbol and
> > > UK users will send with a
> > > pound symbol but since it is a currency i will get only number value. In
> > > this case i will not know exactly
> > > which currency they have used.
> > >
> > >  Now what might be the solution.
> > >
> > > Thanks in advance
> > > Sara
> > >
> > > Thomas LUYT wrote:
> > >
> > > > ----- Original Message -----
> > > > From: "Thangaraju Saravanan" <saravan@ms.com>
> > > > To: <poi-user@jakarta.apache.org>
> > > > Sent: Thursday, April 10, 2003 1:37 PM
> > > > Subject: Retrieving in the same excel format.
> > > >
> > > > > Hi ,
> > > >
> > > > hi
> > > >
> > > > >    I have a date value in the excel sheet. It is in some specified
> > > > > format.
> > > > >
> > > > >  When i retrieve it i can retrieve it maximum as  as a Java Date
only or
> > > > > double value.
> > > > >   But is there anyway to retrieve it as a String which is in the
same
> > > > > format how Excel was written.
> > > >
> > > > After you retrieve it as a Date object, you can use a SimpleDateFormat
> > > with the time pattern you want.
> > > >
> > > > for instance, if your Excel date is "May 15, 2003", you can define your
> > > SimpleDateFormat as :
> > > > SimpleDateFormat sdf = new SimpleDateFormat("MMMMM dd, yyyy")
> > > >
> > > > then format your Date object into a String :
> > > > String myDateString = sdf.format(myDateObject);
> > > >
> > > > Have a look at the API for java.text.SimpleDateFormat for more details
on
> > > pattern symbols.
> > > >
> > > > Thomas
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org


Mime
View raw message