XSSFWorkbook xwb;
try {
xwb = new XSSFWorkbook(url); //利用poi读取excel文件流
XSSFSheet st = xwb.getSheetAt(0); //读取sheet的第一个工作表
int rows=st.getLastRowNum();//总行数
System.out.println(rows+"--");
int cols;//总列数
for(int i=0;i<rows;i++){
XSSFRow row=st.getRow(i);//读取某一行数据
if(row!=null){
//获取行中所有列数据
cols=row.getLastCellNum();
for(int j=0;j<cols;j++){
XSSFCell cell=row.getCell(j);
if(cell==null){
System.out.print(" ");
}
}
}
}
} catch (Exception e) {
}finally{
JOptionPane.showMessageDialog(null,"文件操作成功");
close_Click();//关闭窗体
}