This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

using jsp to generate excel file  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'd like to use a jsp to generate an excel table from data in a database. Does anyone know how to do this?
Thanks,
Ryan
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
 
Anthony Leroy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian, can you please explain how to use this?
thanks,
Ant

Originally posted by Brian E:
[B]Try this:
[/B]


 
Brian E
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go ahead and create your database connection and the like as you would in a normal JSP. Make sure that it works and returns the HTML you want it to. Then just put that line of code in the page and it will launch excel and grab the values from the database. I used basically the same code in my database call for HTML and Excel. I used this code:

to sort out what format I wanted. Basically, if I appended the URL to read format=excel, it would execute the code. Otherwise, it would return it as HTML.
One thing you might want to be careful about is how the Excel Spreadsheet is formatted. The version my company uses (97) does not support CSS, so I had to use and tags and the like. Just play around with it until you've got the look you want.
Good luck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!