This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Servlets and the fly likes Problem in sending csv data to browser. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Problem in sending csv data to browser." Watch "Problem in sending csv data to browser." New topic
Author

Problem in sending csv data to browser.

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
When my servlet sends csv data to browser, IE opens the Excel and data is displayed in one cell. It does not recognize the comma ad the cell delimiter. The code is as follows:
res.setContentType("application/vnd.ms-excel");
out.println("11,22,33,44");
out.println("aa,bb,de,ee");
out.close();
The first row displays "11,22,33,44" in one cell. The second row displays "aa,bb,de,ee" in one cell.
What�s wrong?
Thanks.

BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
try
out.println("11\t22\t33\t44");
out.println("aa\tbb\tde\tee");

# Help an unprivileged kid.<br /> Whatever u do will make a difference...<br /> ...to a child's life & ur own #<br /><a href="http://www.cry.org/" target="_blank" rel="nofollow">www.cry.org/</a>
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
Thanks!
\t works!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in sending csv data to browser.
 
Similar Threads
is it possible to export info to exel
Saving data to Excel files
How to export Non-English Data from jsp file to excel file
PROJECT HELP USING SERVLETS
writing output to an excel spreadsheet