• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating MSExcel Reports in java  RSS feed

 
R . Ravi Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

can some one help me in generating MSExcel report from java code.
as this is urgent requirement please respond immediatly

R ravi
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you just want simple tables to be run in Excel:
  • Set the content-type to "application/vnd.ms-excel".
  • Set your content-disposition to give the file a name and determine if it's to be shown inline or as an attachment.
  • Build your content as either a comma/eol delimited or HTML table.

  • If you need something more involved, look into:
    http://jakarta.apache.org/poi/
     
    Jeroen Wenting
    Ranch Hand
    Posts: 5093
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    From the forums: My Profile | Register | Search | FAQ | Forum Home
    Search would have given you the information you are looking for.
     
    Tim McGuire
    Ranch Hand
    Posts: 820
    IntelliJ IDE Tomcat Server VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If you want to avoid digging into POI since you are in a rush, you could do the following:

    To preserve some of the formatting in Excel, create an Excel sheet using Excel how you like it, colors, bold, lines, fonts, Section headings, and all

    and then save it as HTML. If you open the resulting .html file, you will see hundreds of lines of microsoft gibberish, intended to allow you to open that file again in Excel preserving the formatting.

    Put that file on the server as a .jsp , dig through the gibberish to find the spot in the html to insert result rows from your query and as Ben described above,set the ContentType and header:
     
    Jeroen Wenting
    Ranch Hand
    Posts: 5093
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    We're using SYLK ourselves which works well. More flexible than CSV and almost as easy to generate once you know what you're doing.




    That's all there is to it.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!