不可能在客户端导出
只能是在服务器端生成excel文件,然后给客户一个链接下载

解决方案 »

  1.   

    <%
    FileOutputStream fout = new FileOutputStream("./test.xls");
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet s = wb.createSheet();
    HSSFRow r = null;
    HSSFCell c = null;

    for(int i = 0;i < 10;i++)
    {
    r = s.createRow((short)i);
    for(int j = 0;j < 10;j++)
    {
    c = r.createCell((short)j);
    c.setCellValue(""+i+j);
    }
    }
    wb.write(fout);
    fout.close();         response.sendRedirect("./test.xls");
    %>