Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File Download problem with word/excel ?? only  RSS feed

yo nara
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have written the code , fairly as below for file download
String filename = "C:\\a.xls";
response.setHeader("Content-Disposition", "attachment;filename="+filename);
ServletOutputStream out1 = response.getOutputStream();
File fileToDownload = new File(filename);
FileInputStream fileInputStream = new FileInputStream(fileToDownload);
int i;
while ((!=-1)
}catch(Exception e) // file IO errors
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 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!