Pessoal,
Quando faço o download do arquivo .xlsx do excel, ou .docx ou pptx apararece a seguinte mensagem.
“O Excel encontrou conteúdo ilegível no arquivo ‘xxxx.xlsx’. Deseja recuperar o conteúdo?”
O que fazer para quando fazer o download do arquivo não abrir esta mensagem?
Estou fazendo assim para abrir.
String file = request.getParameter("f");
File f = new File(file);
String filename = f.getName();
response.setContentType("application/text");
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
String name = f.getName().substring(f.getName().lastIndexOf("/") + 1, f.getName().length());
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();
int bit = 256;
int i = 0;
try {
while ((bit) >= 0) {
bit = in.read();
outs.write(bit);
}
} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}
outs.flush();
outs.close();
in.close();
Desde já agradeço a ajuda
Marcos