自动化__持续集成___java___excel__jxl读
Posted 18513757531
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动化__持续集成___java___excel__jxl读相关的知识,希望对你有一定的参考价值。
一、代码如下
package com.wujianbo.five; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.demo.Demo; import jxl.read.biff.BiffException; public class Demo05 { public static void main(String[] args) { // TODO Auto-generated method stub Demo05 demo05= new Demo05(); demo05.readExcelByJxl(); } public void readExcelByJxl() { String path= System.getProperty("user.dir"); path= path + "\\data\\Students.xls"; //System.out.println(path); try { File file= new File(path); FileInputStream fis= new FileInputStream(file); jxl.Workbook rwb= Workbook.getWorkbook(fis); Sheet[] sheet= rwb.getSheets(); for(int i=0; i<sheet.length; i++) { Sheet rs= rwb.getSheet(i); for(int j=0; j<rs.getRows(); j++) { Cell[] cells= rs.getRow(j); for(int k=0;k<cells.length; k++) { System.out.print(cells[k].getContents()); System.out.print("\t"); } System.out.println(); } } fis.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BiffException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IndexOutOfBoundsException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
以上是关于自动化__持续集成___java___excel__jxl读的主要内容,如果未能解决你的问题,请参考以下文章