`
方块石
  • 浏览: 57446 次
  • 来自: ...
社区版块
存档分类
最新评论

zcv

阅读更多
public ActionForward importContract(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String forwardName = "imporExcel"; DataForm theForm = (DataForm)form; FormFile uploadFile = theForm.getImportFile(); String fileName = uploadFile.getFileName(); if (fileName.indexOf(".xls") == -1) { theForm.setMessageInfo("notExcel"); } else { String contractIds = this.readExcel(uploadFile); //设置返回的查询条件 theForm.getDataBO().setContractNumber(contractIds); //为多个合同查询 theForm.setQueryType("1002"); if ("".equals(contractIds)) { theForm.setMessageInfo("formatError"); } else if ("EXCEL_TOO_LARGE".equals(contractIds)) { theForm.setMessageInfo("tooLarge"); } else { theForm.setMessageInfo("success"); } } return mapping.findForward(forwardName); } public ActionForward exportContract(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DataForm dataForm = (DataForm)form; DataBO dataBO = dataForm.getDataBO(); // 设置每页的记录数字 // logbo.getPageData().setPageSize(EXPORT_NUM + 1); // 设置为第一页 // logbo.getPageData().setPageNum(1); List results = ds.queryData(dataBO); // 如果查询结果记录数量不空且在规定范围内做导出处理 if (results != null && results.size() < EXPORT_NUM && results.size() > 0) { this.createExcel(response, results,dataBO); } else if (results != null && results.size() > EXPORT_NUM) { // 提示导出记录超出限制 dataForm.setMessageInfo("exportTooLarge"); } else { // 提示不能导出空 dataForm.setMessageInfo("exportNull"); } return null; } import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.write.Label; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics