The best expierence we made with tabs ("\t") as separator.
Further things to keep in mind:
- if your column contains tabs or linefeeds ("\n") doublequote
the value:
String mValue = "Hello\tworld";
out.print("\"" + mValue +"\"");
- if you doublequote the value and it contains double quotes
doublequote the double quote:
// dest value = I said "Hello"
// output value = "I said ""Hello"""
out.print("\"I said \"\"Hello\"\"\"");
> -----Urspr�ngliche Nachricht-----
> Von: Paul Kofon [mailto:[EMAIL PROTECTED]]
> Gesendet: Donnerstag, 19. Juli 2001 15:26
> An: [EMAIL PROTECTED]
> Betreff: RE: Generate Excel File
>
>
> Hi,
> I've never done what you'd like to do. But if I remember
> correctly, the CSV
> text below will display correctly in Excel:
>
> Item,Price
> Doll,30
> GameBoy,200
>
> You'd have two rows and two columns (with headers Item and
> Price) of data.
> If the CSV data you're feeding Excel is not formatted like this, then
> chances are that you'd get wrong results - that explains why
> your single row
> of data isn't showing up correctly.
>
> Regards,
>
> Paul
>
> >From: William Kaufman <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: "'[EMAIL PROTECTED]'"
> <[EMAIL PROTECTED]>
> >Subject: RE: Generate Excel File
> >Date: Wed, 18 Jul 2001 17:58:12 -0700
> >
> >We've got it working exactly as you say, but only if the
> data is delimited
> >with _tabs_, not _commas_.
> >
> > -- Bill K.
> >
> > > -----Original Message-----
> > > From: Erin Lester [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, July 18, 2001 2:21 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Generate Excel File
> > >
> > >
> > > Hi, I'm trying to generate an excel file as the response
> > > returned from a
> > > servlet. I have set the response's content type to
> > > "application/vnd.ms-excel" and this seems to cause excel
> to open. The
> > > data I return is comma separated values.
> > >
> > > Once upon a time I read on a newsgroup (don't think it was
> > > this one) that
> > > someone had done the same thing and excel interpreted the
> > > data as a csv
> > > file and it displayed nicely in excel. Unfortunately excel
> > > seems to think
> > > that the entire row of comma separated values that I'm
> > > sending it is one
> > > single cell (not a row of cells which are the values between
> > > the commas).
> > >
> > > Can anyone tell me where I'm going wrong or of another way to
> > > generate an
> > > excel spreadsheet using JSP?
> > >
> > > Thanks!
> > > Erin
> > >
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp