import java.io.FileInputStream;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
public class Excel {
public static void readExcel(String FileName){
try{
jxl.Workbook jxl = null;
InputStream in = new FileInputStream(FileName);
jxl = Workbook.getWorkbook(in);
Sheet book = jxl.getSheet(0);
int bookColumns = book.getColumns();
int bookRows = book.getRows();
String tempNumber = "";
String tempSeqId = "";
for(int i = 0; i< bookRows; i++){
for(int j=0; j<bookColumns; j++){
Cell cell = book.getCell(j,i);
tempSeqId = cell.getContents();
System.out.print(tempSeqId + " ");
}
System.out.println();
}
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) {
readExcel("D:\\Documents\\Desktop\\document\\全业务需求周报20120418.XLS");
}
}
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
public class Excel {
public static void readExcel(String FileName){
try{
jxl.Workbook jxl = null;
InputStream in = new FileInputStream(FileName);
jxl = Workbook.getWorkbook(in);
Sheet book = jxl.getSheet(0);
int bookColumns = book.getColumns();
int bookRows = book.getRows();
String tempNumber = "";
String tempSeqId = "";
for(int i = 0; i< bookRows; i++){
for(int j=0; j<bookColumns; j++){
Cell cell = book.getCell(j,i);
tempSeqId = cell.getContents();
System.out.print(tempSeqId + " ");
}
System.out.println();
}
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) {
readExcel("D:\\Documents\\Desktop\\document\\全业务需求周报20120418.XLS");
}
}