Hi,
        Please use this way
        response.setContentType("application/vnd.ms-excel");
        ( it is vnd & not cnd )

        \t is the column seperator while you export it to excel.
        \r\n is the row seperator  while you export it to excel.
        Please do not use any file name or html tags
        hope this suffices your need.


regrads
guru



--------------------------------------------------------
Gurumoorthy R.
Cisco Projects
Zensar Technologies
Hello Office : 91-020-6684001/2/3
Ext: 626/627/613
Mail : [EMAIL PROTECTED]
Mail : [EMAIL PROTECTED]
--------------------------------------------------------
When there is a will, there is a way
--------------------------------------------------------


-----Original Message-----
From: Tiana Zhang [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 25, 2000 7:42 PM
To: [EMAIL PROTECTED]
Subject: Urgent!! Export Servlet result to Excel in delimited format


Hi all,
Sorry I bring up this question again. I didn't find the exactly answer from
the
archive.

I have a servlet that retrieve result from the database. I want to export
the
result to Excel.
Here is my partial code:

response.setContentType("application/cnd.ms-excel");
pw.println("<PRE>");
response.setHeader( "Content-disposition", "attachment;filename=file.xls");
pw.println("</PRE>");

This code works fine in terms of launching the Excel sheet. But the problem
I
have is that
all the results appear in the first cell on each row, rather that one item
per
cell. I tried comma, tab to delimited each data but failed. Can any one
help?

Thanks a lot.
Tiana

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to