1. privatevoidparseExcel(){
  2. try{
  3. Workbookworkbook=null;
  4. InputStreamin=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(Exceptione){
  11. e.printStackTrace();
  12. thrownewException("filenotfound!");
  13. }
  14. Sheetsheet=workbook.getSheet(0);
  15. Cellcell=null;
  16. intcolumnCount=sheet.getColumns();
  17. introwCount=sheet.getRows();
  18. System.out.println("当前工作表的名字:"+sheet.getName());
  19. System.out.println("总行数:"+rowCount);
  20. System.out.println("总列数:"+columnCount);
  21. list=newArrayList<String>();
  22. for(inti=0;i<rowCount;i++){
  23. for(intj=0;j<columnCount;j++){
  24. //注意,这里的两个参数,第一个是表示列的,第二才表示行
  25. cell=sheet.getCell(j,i);
  26. Strings=sheet.getCell(columnCount-1,i).getContents();
  27. }
  28. }
  29. workbook.close();
  30. }catch(Exceptione){
  31. e.printStackTrace();
  32. }
  33. }

更多相关文章

  1. 在android里保存数据的三种形式(Saving Data)
  2. Android的AlertDialog的6种使用情景
  3. android 颜色(color)
  4. Android与(Servlet)服务器交互
  5. Android(安卓)实现一个http 带参数登录
  6. Android文件上传
  7. android之ArrayAdaper应用
  8. mybatisplus的坑 insert标签insert into select无参数问题的解决
  9. Python技巧匿名函数、回调函数和高阶函数

随机推荐

  1. 应用Style和Theme - Android官方文档中文
  2. 如何发布android应用程序
  3. 初学Android,图形图像之使用Path类
  4. android io写入读取 txt 数据 封装
  5. Android(安卓)开源项目及网址
  6. MediaBuffer使用要点
  7. Android(安卓)MVP 使用教程
  8. Android(安卓)studio使用问题收录
  9. Android类参考---SQLiteOpenHelper
  10. Android(安卓)LineaerLayout中layout_mar