• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Opening CSV file in browser

 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to display a .csv file in the browser using microsoft excel.
What should be set for response.setContentType("??");
I tried using res.setContentType("application/vnd.ms-excel");
but the file was opened as type .xls i.e. it ignored the commas.
Thanks
Pradeep
[ August 20, 2002: Message edited by: Pradeep Bhat ]
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"text/comma-separated-values" as the MIME type. This should work also ensure the url that inks to this does NOT include the xls extention, if you provide any extention use csv.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have used it many times. Should work:
response.setContentType("text/csv");
response.setHeader("Content-Disposition","filename=\"" + filename + "\";");
out = response.getWriter();
//then just write to out.
 
reply
    Bookmark Topic Watch Topic
  • New Topic