package webdemo;
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
/**
*
* @author hejin
*JXL读取解析Excel
*/
public class JxlReadExcel {
public static void main(String[] args) {
try {
//获取Workbook
Workbook workbook = Workbook.getWorkbook(new File("e:/jxl_test.xls"));
//获取sheet
Sheet sheet = workbook.getSheet(0);
//获取数据
for(int i=0;i<sheet.getRows();i++){//行数
for(int j=0;j<sheet.getColumns();j++){//列数
Cell cell = sheet.getCell(j, i);//根据列和行获取单元格
System.out.print(cell.getContents()+" ");
}
//换行
System.out.println();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}