- 2
- 0
- 约4.55千字
- 约 4页
- 2017-06-13 发布于北京
- 举报
form id=fileUpload action=importOCRExcelData.do enctype=multipart/form-data method=postinput id=excelFile name=excelFile type=file /a href=javascript:void(0); title=点击下载模板 onclick=downloadModalExcel();点击下载模板/ainput type=button value=提交 class=quickpro-button onclick=submitExcel();//form/***数据文件导入**@paramrequest*@paramresponse*@throwsIOException*@throwsFileNotFoundException*/@RequestMapping({ importOCRExcelData })publicvoid importOCRExcelData(HttpServletRequest request,HttpServletResponse response) throws FileNotFoundException, IOException { MultipartHttpServletRequest mulRequest = (MultipartHttpServletRequest) request; MultipartFile file = mulRequest.getFile(excelFile); String filename = file.getOriginalFilename(); if (filename == null || .equals(filename)) { } try { InputStream input = file.getInputStream(); XSSFWorkbook workBook = new XSSFWorkbook(input); ListString sfList = ExportHelper.exportListFromExcel(workBook, 0);for(int i=0 ; isfList.size();i++) {LOGGER.info(【+sfList.get(i).toString()+】 ); } } catch (Exception e) { LOGGER.error(e); } }/***由指定的Sheet导出至List**@paramworkbook*@paramsheetNum*@return*@throwsIOException*/publicstatic ListString exportListFromExcel(Workbook workbook,int sheetNum) { Sheet sheet = workbook.getSheetAt(sheetNum);// 解析公式结果 FormulaEvaluator evaluator = workbook.getCreationHelper() .createFormulaEvaluator(); ListString list = new ArrayListString();int minRowIx = sheet.getFirstRowNum();int maxRowIx = sheet.getLastRowNum();for (int rowIx = minRowIx; rowIx = maxRowIx; rowIx++) { Row row = sheet.getRow(rowIx); StringBuilder sb = new StringBuilder();short minColIx = row.getFirstCellNum();short maxColIx = row.getLastCellNum();for (short colIx = minColIx; colIx = maxColIx; colIx++) { Cell cell = row.getCell(new Int
您可能关注的文档
最近下载
- 传统基材润湿流平(氟碳硅烷嵌段).pdf VIP
- 南京财经大学2024-2025学年第1学期《高等数学(上)》期末考试试卷(B卷)附参考答案.pdf
- C4D课程考试试题及参考答案.doc VIP
- 2025年陕西公务员申论考试真题及答案B卷.docx VIP
- [渝粤教育] 西北工业大学 航天器控制原理 mooc 资料.docx VIP
- 航天器控制原理(西北工业大学)中国大学MOOC 慕课 章节测验 期末考试答案.pdf VIP
- 精品解析:2025年陕西省中考数学试题(原卷版).docx VIP
- 四维度主力跟踪.pdf
- 2022年陕西省中考数学真题(原卷版).docx VIP
- 大众网关控制器和bcm车身控制模块针脚定义非常有用.pdf VIP
原创力文档

文档评论(0)