/** * 取得一列的cell * * @param rowNum 行号 * @return 一列的cell */ public Cell[] getColCells(int colNum) { if (readOnlyWBook == true) { return currentSheet.getColumn(colNum); } else { return wrCurrentSheet.getColumn(colNum); } }
public static int nextFreeColNumber(WritableSheet sheet) { if (sheet == null) return 0; int colCount = sheet.getColumns(); Cell[] cells; int i = 0; for (; i < colCount; i++) { cells = sheet.getColumn(i); for (Cell cell : cells) { if (cell.getContents() == null || cell.getContents().isEmpty()) return i; } } return i; }