Como colocar um arquivo .xls para download

2 respostas
A

Boa tarde,
gostaria de saber como eu coloco um arquivo .xls para fazer download

Muito Obrigado.

2 Respostas

Polverini

colocar aonde, megaupload ? usando qual tecnologia ?

A

na verdade eu fiz assim:

#   public HashMap relExcel() {  
#   
#        String sql = req.getParameter("pSql");  
# try{  
#        DAOExcelSql dao = new DAOExcelSql();  
#   
#        List<String> NomeClunas = dao.consultaNmeColunas(sql);  
#        List<Object> DadosColunas = dao.consultaDadosColunas(sql);  
#        int count = 0;  
#   
#        StringBuilder sb = new StringBuilder();  
#   
#   
#   
#         for (Iterator<String> it = NomeClunas.iterator(); it.hasNext();) {  
#         sb.append(it.next()+"\t");  
#       }  
#        sb.append("\n");  
#        for (Iterator<Object> it = DadosColunas.iterator(); it.hasNext();) {  
#   
#            if(count < NomeClunas.size()){  
#            sb.append(it.next());  
#            sb.append("\t");  
#            count ++;  
#            }else if(count == NomeClunas.size()){  
#                sb.append("\t");  
#                sb.append("\n");  
#                count = 0;  
#            }  
#   
#        }  
#        File rel = new File("c:\\relTeste.xls");// aqui eu estou salvando o relatorio no C, mas eu nao queria salvar ele em lugar nenhum so abri-lo  
#        rel.createNewFile();  
#        FileWriter relExcel = new FileWriter(rel);  
#        relExcel.write(new String(sb));  
#   
#     String sOs = System.getProperty("os.name").toUpperCase();  
#     if(sOs.equals("WINDOWS NT") || sOs.equals("WINDOWS 2000") || sOs.equals("WINDOWS XP")){  
#          Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE " + rel.getAbsolutePath());  
#     } else{  
#     Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE " + rel.getAbsolutePath());  
#     }  
#   
#        relExcel.flush();  
#        relExcel.close();  
#   
#   
#         }catch (Exception ex){  
#             ex.printStackTrace();  
#         }  
#     return dados;  
# }

tem jeito de em vez de abrir em ecxel colocar esse File para download?
no caso eu criaria o file em uma pasta no servidor

Criado 2 de março de 2011
Ultima resposta 2 de mar. de 2011
Respostas 2
Participantes 2