往客户端导出excel表格

String s="<table><thead><tr><td>姓名</td><td>年龄</td></tr></thead><tbody><tr><td>cpt</td><td>23</td></tr><tr><td>huangbing</td><td>24</td></tr></tbody></table>";

   PrintWriter out= resp.getWriter();
   out.write(s);
   resp.setHeader("Content-disposition", "attachment;filename=test.xls");

resp.setContentType("application/vnd.ms-excel");

你可能感兴趣的:(Excel)