public String downXls()throws Exception{
List<TbCourseMng> all=coursedao.findCourseAll();
ServletActionContext.getResponse().setContentType("application/x-msdownload");
ServletActionContext.getResponse().setHeader("Content-disposition","attachment; "+
"filename="+new String("考试成绩模板.xls".getBytes("gb2312"),"iso8859-1"));
WritableWorkbook workbook =Workbook.createWorkbook(ServletActionContext.getResponse().getOutputStream());
WritableSheet sh=workbook.createSheet("课程表", 0);
//字符串
Label temp=new Label(0,0,"学生编号");
sh.addCell(temp);
temp=new Label(1,0,"学生姓名");
sh.addCell(temp);
int count=1;
for (TbCourseMng tbCourseMng : all) {
temp=new Label(++count,0,tbCourseMng.getCOURSE_NAME());
sh.addCell(temp);
}
workbook.write();
workbook.close();
return null;
}