This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!