This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer (Exam 1Z0-830) Java SE 17 Developer (Exam 1Z0-829) Programmer’s Guide and have Khalid Mughal and Vasily Strelnikov on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Export to excel using JSP

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am exporting data to excel using java. i am using the following code
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename=" + "SeachResult"+".xls");

The SearchResult.xls will contain name and email ids. The email ids are displayed in the excel sheet with the url(ie,if we click the email id, it will load the mail client). I want to diaplay the mail id as a simple text(with out link to the mail client). Please help me in this regards.
[ December 12, 2005: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a section in the JSP FAQ on displaying results in Excel.
In it, there is an example showing how to display simple CSV or HTML Tables.

If you want to do more than this, (like controlling the formatting) you will have to find a third party library that will allow you to work directly with Microsoft Office files via Java. There is a link to one of those libraries in the JSP FAQ.
 
Johnson Xavier
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben Souther,
Thank you very much for your reply.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the URL below:

How to view database data in XLS format using servlets
http://www.java-tips.org/content/view/849/40/
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's better to use jxl frame work when working with excel/ java as jxl has lots of features which can be explored.
http://jexcelapi.sourceforge.net/


WritableWorkbook samplebook = Workbook.createWorkbook(out);
WritableSheet sample = highTransBook.createSheet("Sample", 0);
sample.setPageSetup(PageOrientation.LANDSCAPE);
WritableFont times20font = new WritableFont(WritableFont.TIMES, 20, WritableFont.BOLD, true);
WritableCellFormat times20format = new WritableCellFormat(times20font);
Label label1 = new Label(0,0, "Sample Ref", times20format);
sample.addCell(label1);
reply
    Bookmark Topic Watch Topic
  • New Topic