【实例】使用Java导出Excel文件
官方Java开发工程师QQ群(27163376),验证请输入您的ID。资源包括使用的XLS文件与JAR包,还有JAVA的源码。源码内全面带有标注,确保您一看就懂。HkSfaStatBCbc=newHkSfaStatBCImpl();//后台实现类--成果计算HkSfaActivityBCabc=newHkSfaActivityBCImpl();//后台实现类--统计流动Stringactivitypk=request.getParameter(activitypk);//流动PKListchildGroups=abc.getChildgroup(activitypk);//得到此流动的一切小组double[][]data=bc.problemCollect(activitypk);//得到计算成果,一个二维数组org.apache.poi.hssf.usermodel.HSSFRowrow=sheet.createRow(11);//在第一个工作表中创建一行(第12行)for(intk=0;klt;childGroups.size();k++){ApSfaGroupactivityactivityGroup=(ApSfaGroupactivity)childGroups.get(k);//ApSfaGroupactivity为流动小组的Pojoorg.apache.poi.hssf.usermodel.HSSFCellcell=row.createCell((short)(k+1));//在row中创建单元格cell.setEncoding(HSSFCell.ENCODING_UTF_16);//设置编码cell.setCellValue(activityGroup.getName());//给单元格设置值.......导出Excel\需用到的xls文件\PicStat.xls
导出Excel\需用到的xls文件\statPic.xls
导出Excel\需求用到的Jar包\commons-io-1.1.jar
导出Excel\需求用到的Jar包\excelutils.jar
导出Excel\需求用到的Jar包\poi-3.0.1.jar
导出Excel\需求用到的Jar包\tm-extractors-0.4.jar
导出Excel\picExcel.java
(Official Java development engineer QQ group (27163376), please enter your ID for verification. Resources include used XLS files and JAR packages, as well as JAVA source code. The source code is fully marked to ensure that you can understand it at a glance. HkSfaStatBCbc=newHkSfaStatBCImpl();//Background implementation class--result calculation HkSfaActivityBCabc=newHkSfaActivityBCImpl();//Background implementation class--Statistical flow Stringactivitypk=request.getParameter(activitypk);//Flow PKListchildGroups=abc.getChildgroup(activitypk) ;//Get all groups of this flow double[][]data=bc.problemCollect(activitypk);//Get the result of calculation, a two-dimensional array org.apache.poi.hssf.usermodel.HSSFRowrow=sheet.createRow(11 );//Create a row in the first worksheet (line 12) for(intk=0;klt;childGroups.size();k){ApSfaGroupactivityactivityGroup=(ApSfaGroupactivity)childGroups.get(k);//ApSfaGroupactivity Pojoorg.apache.poi.hssf.usermodel.HSSFCellcell=row.createCell((short)(k 1));//Create a cell in row cell.setEncoding(HSSFCell.ENCODING_UTF_16);//Set Code cell.setCellValue(activityGroup.getName());//Set the value to the cell......
Export Excel\needed xls file\PicStat.xls
Export Excel\needed xls file\statPic.xls
Export Excel\Jar package used for requirements\commons-io-1.1.jar
Export Excel\Jar package for requirements\excelutils.jar
Export Excel\Jar package used for requirements\poi-3.0.1.jar
Export Excel\Jar package used for requirements\tm-extractors-0.4.jar
ExportExcel\picExcel.java)
页:
[1]