欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

poi读excel(支持03 , 07),poiexcel,/** *基本的读取ex

来源: javaer 分享于  点击 30147 次 点评:263

poi读excel(支持03 , 07),poiexcel,/** *基本的读取ex


/** *基本的读取excel获取每行每列数据 * @throws InvalidFormatException  */public static void poiReadExcel(File file) throws IOException, InvalidFormatException{    //创建文件输入流对象    InputStream is = new FileInputStream(file);    //创建 POI文件系统对象    Workbook wb = WorkbookFactory.create(is);    //获取工作薄    Sheet sheet = wb.getSheetAt(0);    //声明行对象    Row row = null;    //通过循环获取每一行    for (int i = 0; sheet.getRow(i)!=null; i++) {        row = sheet.getRow(i);        //循环获取一行的中列        String str="";        for (int j = 0; row.getCell(j)!=null; j++) {            str+=row.getCell(j).toString()+",";        }        System.out.println(str);    }}依赖jar包:dom4j-1.6.1.jar poi-ooxml-3.8-20120326.jar poi-3.8-20120326.jar xbean.jar poi-ooxml-schemas-3.8-20120326.jar//该片段来自于http://byrx.net
相关栏目:

用户点评