• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

PROJECT HELP USING SERVLETS

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 25830
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic