I don't know how feasible my soultion may be for your problem, but this is what
you can try .
When creating the CSV file , replace all , "commas" with a ; "semicolon" , this
way when you open the csv
in excel it will show only 4 columns. But the first column will show smith;susan
. To overcome this problem ,
provide your client with an excel macro that will replace all semicolon in the
cells with a comma.
        May not be  a perfect solution , but may be a good workaround.

Santosh





hua ge <[EMAIL PROTECTED]> on 09/20/2000 10:52:03 PM

Please respond to A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Santosh Daryani/IT/Aon Consulting)

Subject:  how to write comma delimited string which already contains comma
      in some data?



Hi,
I have a jsp page which set proper header and write data out in comma
delimited format so the client can download it as a .csv file and open it in
Excel later .

the data columns are :
NAME SSN PHONE EMAIL
smith,susan 123-45-4567 123-456-7890 [EMAIL PROTECTED]

notice that the NAME column should contains lastname,firstname together with
comma separated.


my problem is since the NAME field already contains "," which is in this
format (LastName,FirstName). so if I treat NAME field as one whole field and
write out in comma delimited format, then later in the excel .csv file, the
name field actually will be displayed as two separate columns and expand the
whole line records as total 5 columns (actually should be 4 columns).

my client don't like to make the NAME column shown as
(fname lname) with no comma (if so, I will have no problem). they want the
(lname,fname) format for this column.

So I have to figure out how can I write the comma delimited string which
already contains comma in it???

I tried out.println(lname +"\"" + "," + "\"" + fname + "," +
                    SSN + "," +
                    PHONE + "," +
                    EMAIL );

it still break down NAME column as two columns with lname value as smith"
and fname value as "susan

can someone give me a hint? and help me out here??

Thanks in advance.

Helen Ge

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to