Jtable添加exel表格少了一列?
各位大虾帮忙看下吧,我在Jtable中显示一个excel的表格,结果少了一列,找了很久都没找到问题。
[code=Java][/code]
private void xls ( File file ) throws BiffException,
IOException {
Workbook wb = Workbook.getWorkbook(new FileInputStream (file));
Sheet sh = wb.getSheet(0);
int rows = sh.getRows();
for ( int j = 0; j < rows; j++ ) {
Cell [] oneRow = sh.getRow(j);
Vector one = new Vector ();//得到excel每一行内容
for ( int i = 0; i < oneRow.length; i++ ) {
one.add(oneRow[i].getContents());
}
System.out.println(one.toString());
dtm.addRow(one);
}
jTable.updateUI();
}
------解决方案--------------------
检查oneRow = sh.getRow(j);
是否得到的oneRow就少一行
------解决方案--------------------如楼上说的,是不是得到的行数少了,