protected CellValue getCellValueAt(int index) { if (index < 0 || index >= numOfCells) { throw new IndexOutOfBoundsException( "Index must be between 0 and " + (numOfCells - 1) + " (inclusive), given: " + index); } int firstRow = cellRangeAddress.getFirstRow(); int firstCol = cellRangeAddress.getFirstColumn(); int lastCol = cellRangeAddress.getLastColumn(); int width = lastCol - firstCol + 1; int rowIndex = firstRow + index / width; int cellIndex = firstCol + index % width; XSSFRow row = sheet.getRow(rowIndex); return (row == null) ? null : evaluator.evaluate(row.getCell(cellIndex)); } }
protected CellValue getCellValueAt(int index) { if (index < 0 || index >= numOfCells) { throw new IndexOutOfBoundsException( "Index must be between 0 and " + (numOfCells - 1) + " (inclusive), given: " + index); } int firstRow = cellRangeAddress.getFirstRow(); int firstCol = cellRangeAddress.getFirstColumn(); int lastCol = cellRangeAddress.getLastColumn(); int width = lastCol - firstCol + 1; int rowIndex = firstRow + index / width; int cellIndex = firstCol + index % width; XSSFRow row = sheet.getRow(rowIndex); return (row == null) ? null : evaluator.evaluate(row.getCell(cellIndex)); } }