[Java]
Import java. io. FileInputStream;
Import java. io. IOException;
Import java. io. InputStream;
Import jxl. Cell;
Import jxl. Sheet;
Import jxl. Workbook;
Import jxl. read. biff. BiffException;
Public class AnalyticExcel2 {
Public static void main (String [] args) throws BiffException, IOException {
InputStream is = new FileInputStream ("D: \ Project6 \ A \ src \ Analytic \ doc \ C.xls ");
Try {
Workbook wb = Workbook. getWorkbook (is );
Int wbNum = wb. getNumberOfSheets ();
For (int I = 0; I <wbNum; I ++ ){
Sheet sheet = wb. getSheet (I );
String sheetName = sheet. getName ();
System. out. println ("sheetName =" + sheetName );
If (sheet! = Null ){
// Obtain the total number of columns in the table
Int rsColumns = sheet. getColumns ();
// Obtain the total number of table rows
Int rsRows = sheet. getRows ();
// The data in the loop File
For (int j = 0; j <rsRows; j ++ ){
Cell [] cells = sheet. getRow (j );
For (int k = 0; k <rsColumns; k ++ ){
System. out. print (cells [k]. getContents () + "----");
}
System. out. println ();
}
}
}
} Catch (Exception e ){
E. printStackTrace ();
}
}
}
Author: Heng_Ji