• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PROJECT HELP USING SERVLETS

 
shabbir zakir
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!
HTML documents cannot be imported directly from the web into the spreadsheet program usually they must be downloaded as files and then imported.
Can we directly open html documents in a spreadsheet programme such as microsoftexcel.Can we use servlets in this.Can anyone explain me how should i proceed.
Thanks in advance.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on the version of MS-Office you're using, Excel can read html, though what it did with the results didn't exactly excite me.
A more useful approach often used is to have the servlet/jsp output a CSV file, which Excel will happily parse into a table.
A good example of this in action is available at http://quote.yahoo.com/q?s=msft&d=v1 - click on the "Download spreadsheet" link. A JSP that sets the appropriate MIME content type (application/x-msexcel is what I have listed -- or maybe application/vnd.ms-excel) can cause Excel to be brought up within Internet Explorer. Or, launched, if they're using Netscape.
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have gotten this task to work, in terms of having my servlet set the content type and write to an excel spreadsheet, unfortunately when Excel comes up, it doesn't seem to recognize that my output is in csv format, so it puts all of the data per row in the first cell, for example, a row such as
1,2,3
doesn't get broken up into 3 cells, it is all put in the first cell as one string.
Any tips on how to get Excel to recoginze the comma seperators?
I am setting my content type using:
setContentType("application/vnd.ms-excel");
Thanks!
Kim
 
Senthil B Kumar
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try using the following Content Type

text/comma-separated-values

or try setting the Header instead of Content Type

response.setHeader("Content-Type", "text/comma-separated-values");
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you may also have to map the URI for the generated text to end in .xls depending on your browser, OS and Excel version.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic