List<T>数据下载

public void excelDataCheck(HttpServletRequest request, HttpServletResponse response) throws Exception {
//System.out.println(“开始进行Excel下载”);
//Excel导出这些数据
try {
List cwlDatas = (List)request.getSession().getAttribute(“cwlDatas”);
final ExcelOperator excelTool = new ExcelOperator();
excelTool.exportExcel(request, response,
“课程清单”,
“课程清单”,
new String[]{“学年学期”,“课程号”,“课序号”,“课程名”,“上课教师”,“职称”,
“院系”,“课程属性”,“班级”,“上课人数”,“总学时”,“授课学时”,
“上机学时”,“实验学时”,“学分”,“课程类别”,“是否专业核心课”,“备注”,
“课程类型1”,“课程类型2”,“校验结果”},
new int[]{16,16,10,30,20,20,
30,30,50,10,10,10,
10,10,10,10,15,20,
20,20,50},
cwlDatas,
new IObjectMapper(){
@Override
public void toExcelRow(WritableSheet sheet,
IDataCellFormat dataFormat, int rowNum,
Curworkload cwl)
throws RowsExceededException, WriteException {
Term term = cwl.getTerm();
String xqstr = “–”;
if(term!=null) xqstr = term.getTermname();
College college = cwl.getCollege();
String xystr = “”;
if(college!=null) xystr = college.getName();
//“学年学期”,“课程号”,“课序号”,“课程名”,“上课教师”,“职称”
IDataCellFormat customdataFormat = excelTool.getDataFormat();
if(!"".equals(cwl.getErrmsg())){
customdataFormat = excelTool.getCustomDataFormat();
}
//System.out.println(customdataFormat);
//“学年学期”,“课程号”,“课序号”,“课程名”,“上课教师”,“职称”,
sheet.addCell(new Label(0, rowNum, xqstr+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(1, rowNum, cwl.getKch(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(2, rowNum, cwl.getKxh(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(3, rowNum, cwl.getKcm(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(4, rowNum, cwl.getSkls(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(5, rowNum, cwl.getLszc(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
//“院系”,“课程属性”,“班级”,“上课人数”,“总学时”,“授课学时”,
sheet.addCell(new Label(6, rowNum, xystr,customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(7, rowNum, cwl.getKcsx(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(8, rowNum, cwl.getBjmc(),customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(9, rowNum, cwl.getXkrs()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(10, rowNum, cwl.getZxs()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(11, rowNum, cwl.getSkxs()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
//“上机学时”,“实验学时”,“学分”,“课程类别”,“是否专业核心课”,“备注”,
sheet.addCell(new Label(12, rowNum, cwl.getSjxs()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(13, rowNum, cwl.getSyxs()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(14, rowNum, cwl.getXf()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(15, rowNum, cwl.getKclx()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(16, rowNum, cwl.getSfcxk()==0?"":“是”,customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(17, rowNum, cwl.getBz()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
//“课程类型1”,“课程类型2”,“校验结果”
sheet.addCell(new Label(18, rowNum, cwl.getKclx1()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(19, rowNum, cwl.getKclx2()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
sheet.addCell(new Label(20, rowNum, cwl.getErrmsg()+"",customdataFormat.getDataCellFormat(CellType.STRING_FORMULA)));
}
},
new MergeZone(0, 0, 20, 1));
} catch (Exception e) {
e.printStackTrace();
}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值