• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

using jsp to generate excel file

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:
 
Anthony Leroy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic