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

File Download problem with word/excel ?? only

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i have written the code , fairly as below for file download
String filename = "C:\\a.xls";
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename="+filename);
ServletOutputStream out1 = response.getOutputStream();
File fileToDownload = new File(filename);
FileInputStream fileInputStream = new FileInputStream(fileToDownload);
int i;
while ((i=fileInputStream.read())!=-1)
{
out1.write(i);
}
fileInputStream.close();
out1.flush();
out1.close();
}catch(Exception e) // file IO errors
{
e.printStackTrace();
}
a.xls contains japanese characters .i am unable to see the contents of the file downloaded.all the characters get disrupted
can anyone suggest me the solution?
i have tried with different java.io classes also .
uptil now i am able to see the txt files and pdf files clearly but if i try to download word or excel files i am unable to see the contents.

thnx in advance
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic