1. 程式人生 > >Excel轉Html(十一)--POI處理Excel-獲取sheet總行數-總列數-行高-列高

Excel轉Html(十一)--POI處理Excel-獲取sheet總行數-總列數-行高-列高

獲取sheet行總數:sheet.getLastRowNum()
列總數:dataMap.get("maxColNum-" + form.getFormName() 獲取列最多的行,特別注意:sheet.getRow(0).getPhysicalNumberOfCells()不準確

行高:rowHeight = row.getHeight() / 15
列寬:
if (rowIndex == 0) {
colWidth = 2 * sheet.getColumnWidth(cellIndex) / 60;
if (colDefaultWidth != colWidth) {
colWidths.append(",").append(cellIndex).append("-").append(colWidth);
}
}