/**
*处理excel数据的方法
*/
publicstaticHashtable>>readExcel(
StringfilePath)throwsException{
Hashtable>>datas=newHashtable>>();
InputStreamis=null;
try{
is=newFileInputStream(filePath);
WorkbookSettingswkbkSet=newWorkbookSettings();
wkbkSet.setSuppressWarnings(true);
Workbookrwb=Workbook.getWorkbook(is,wkbkSet);
Sheetst[]=rwb.getSheets();
for(inta=0;a
StringsheetName=st[a].getName().trim();
Vector>sheetDatas=newVector>();
for(inti=0;i
VectorrowDatas=newVector();
for(intj=0;j
Cellc=st[a].getCell(j,i);
Stringcontent=c.getContents().trim();
rowDatas.add(content);
}
sheetDatas.add(rowDatas);
}
datas.put(sheetName,sheetDatas);
}
rwb.close();
}catch(Exceptione){
throwe;
}finally{
try{
if(is!=null){
is.close();
}
}catch(Exceptione){
}
}
returndatas;
}
publicstaticvoidmain(String[]args)throwsException{
Hashtable>>datas=readExcel("E:\\123.xls");
System.out.println(datas.get("Sheet1"));
}