1. private void parseExcel(){  
  2.         try {  
  3.             Workbook workbook = null;  
  4.             InputStream in = null;  
  5.             try {  
  6. //              in = this.getClassLoader().getResourceAsStream("CollMjr.xlsx");  
  7.                 in = this.getAssets().open("CollMjr_1.xls");  
  8.                 workbook = Workbook.getWorkbook(in); 
  9.                 workbook.getNumberOfSheets() 
  10.             } catch (Exception e) {  
  11.                 e.printStackTrace();  
  12.                 throw new Exception("file not found!");  
  13.             }  
  14.             Sheet sheet = workbook.getSheet(0);  
  15.             Cell cell = null;  
  16.             int columnCount = sheet.getColumns();  
  17.             int rowCount = sheet.getRows();  
  18.             System.out.println("当前工作表的名字:" + sheet.getName());    
  19.             System.out.println("总行数:" + rowCount);    
  20.             System.out.println("总列数:" + columnCount);   
  21.             list = new ArrayList();  
  22.             for (int i = 0; i < rowCount; i++) {  
  23.                 for (int j = 0; j < columnCount; j++) {  
  24.                     // 注意,这里的两个参数,第一个是表示列的,第二才表示行  
  25.                     cell = sheet.getCell(j, i);   
  26.                     String s = sheet.getCell(columnCount-1, i).getContents();   
  27.                 }  
  28.             }  
  29.             workbook.close();  
  30.         } catch (Exception e) {  
  31.             e.printStackTrace();  
  32.         }  
  33.     }  

更多相关文章

  1. Monkey
  2. 2011.07.18——— android AlphaBitmap
  3. 2011.07.18——— android AlphaBitmap
  4. android TextView 走马灯效果
  5. Android(安卓)中文 API (100) ―― ScrollView
  6. Android笔记--短信与拨号
  7. android 自定义组件圆形边框
  8. android中的震动
  9. android 设置textview 边框

随机推荐

  1. android用户界面-组件Widget-选项卡Tab
  2. app/android:showAsAction的区别
  3. RecyclerView加载不同view实现效果--IT蓝
  4. Android(安卓)activity 开启时数据保存和
  5. android emulator 模拟器
  6. Android(安卓)ViewPager初探:让页面滑动起
  7. Android原生下拉刷新SwipeRefreshLayout
  8. Unable to recreate missing debug keyst
  9. Android(安卓)ImageView的拖拽实现
  10. %s使用