http://www.cnblogs.com/mingforyou/archive/2013/08/26/3282922.html
读Excel代码如下:
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class Excel {
public static void main(String[] args) {
// TODO Auto-generated method stub
Workbook bk=null;
try {
bk=Workbook.getWorkbook(new File("./WebContent/File/工作簿1.xls"));
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Sheet[] sheet=bk.getSheets();
int j=0;
for(int i=0;i<sheet.length;i++) {
for(int y=0;y<sheet[i].getRows();y++) {
for(int z=0;z<sheet[i].getColumns();z++){
Cell[] cells= new Cell[sheet[i].getColumns()*sheet[i].getRows()];
cells[j]=sheet[i].getCell(z,y);
System.out.println(cells[j].getContents());
}
}
}
}
}