示例#1
0
 @Test
 public void testGetCollection() {
   ExcelUtil excelUtil = new ExcelUtil();
   try {
     excelUtil.openUploadExcel("collectionTemplate.xls", 0);
   } catch (BiffException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   System.out.println(excelUtil.getCollection());
   excelUtil.closeExcel();
 }
示例#2
0
 @Test
 public void testExportToCollection() throws BiffException, IOException {
   ExcelUtil excelUtil = new ExcelUtil();
   excelUtil.openUploadExcel("collectionTemplate.xls", 0);
   ModelCollection collection = excelUtil.getCollection();
   System.out.println(collection);
   excelUtil.closeExcel();
   excelUtil.openDownloadNewExcel("collectionTemplate.xls", 0);
   try {
     excelUtil.exoprtToExcel(collection);
   } catch (RowsExceededException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (WriteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }