日期:2014-05-17 浏览次数:20829 次
public ActionForward doExpJdstudent(Action action, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("success to upload action===================== "); ActionForward forward = null; try { String path = "I:/workspace/diwebdemo/web/report/student.xls"; //InputStream is = new BufferedInputStream(new FileInputStream(path)); InputStream is = new FileInputStream(new File("I:/workspace/diwebdemo/web/report/student.xls")); List<Jdstudent> jsList = new ArrayList<Jdstudent>(); JdstudentService jdstudentService = new JdstudentService(); jsList = jdstudentService.getAllJdstudentList(); Map beans = new HashMap(); beans.put("students", jsList); XLSTransformer transformer = new XLSTransformer(); Workbook wb = transformer.transformXLS( is, beans); //response.setCharacterEncoding("UTF-8"); response.setHeader("Content-disposition", "inline; filename=" + "学员.xls"); response.setContentType("application/vnd.ms-excel"); OutputStream os = response.getOutputStream(); wb.write(os); os.flush(); is.close(); forward = action.findForward(Viewconst.CONST_SUCCESS); } catch (Exception e) { e.printStackTrace(); System.out.println(e.getMessage()); log.error(e.getCause()); forward = action.findForward(Viewconst.CONST_FAILURE); } return forward; }
java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFSheet.removeRow(Lorg/apache/poi/hssf/usermodel/HSSFRow;)V at net.sf.jxls.util.TagBodyHelper.removeBorders(TagBodyHelper.java:139) at net.sf.jxls.controller.SheetTransformationControllerImpl.removeBorders(SheetTransformationControllerImpl.java:85) at net.sf.jxls.tag.ForEachTag.process(ForEachTag.java:157) at net.sf.jxls.transformer.TagRowTransformer.transform(TagRowTransformer.java:36) at net.sf.jxls.transformer.SheetTransformer.transformSheet(SheetTransformer.java:90) at net.sf.jxls.transformer.XLSTransformer.transformWorkbook(XLSTransformer.java:243) at net.sf.jxls.transformer.XLSTransformer.transformXLS(XLSTransformer.java:222) at view.xlsexport.JdStudentXls.doExpJdstudent(JdStudentXls.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585)