/** * Also creates cells if they don't exist */ private CellRange<HSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<HSSFCell> temp = new ArrayList<>(height * width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { HSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } HSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, HSSFCell.class); }
public static <B extends Cell> SSCellRange<B> create(int firstRow, int firstColumn, int height, int width, List<B> flattenedList, Class<B> cellClass) { int nItems = flattenedList.size(); if (height * width != nItems) { throw new IllegalArgumentException("Array size mismatch."); } @SuppressWarnings("unchecked") B[] flattenedArray = (B[]) Array.newInstance(cellClass, nItems); flattenedList.toArray(flattenedArray); return new SSCellRange<>(firstRow, firstColumn, height, width, flattenedArray); }
/** * Also creates cells if they don't exist */ private CellRange<XSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<XSSFCell> temp = new ArrayList<>(height * width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { XSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } XSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, XSSFCell.class); }
public static <B extends Cell> SSCellRange<B> create(int firstRow, int firstColumn, int height, int width, List<B> flattenedList, Class<B> cellClass) { int nItems = flattenedList.size(); if (height * width != nItems) { throw new IllegalArgumentException("Array size mismatch."); } @SuppressWarnings("unchecked") B[] flattenedArray = (B[]) Array.newInstance(cellClass, nItems); flattenedList.toArray(flattenedArray); return new SSCellRange<>(firstRow, firstColumn, height, width, flattenedArray); }
/** * Also creates cells if they don't exist */ private CellRange<HSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<HSSFCell> temp = new ArrayList<>(height * width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { HSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } HSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, HSSFCell.class); }
public static <B extends Cell> SSCellRange<B> create(int firstRow, int firstColumn, int height, int width, List<B> flattenedList, Class<B> cellClass) { int nItems = flattenedList.size(); if (height * width != nItems) { throw new IllegalArgumentException("Array size mismatch."); } @SuppressWarnings("unchecked") B[] flattenedArray = (B[]) Array.newInstance(cellClass, nItems); flattenedList.toArray(flattenedArray); return new SSCellRange<B>(firstRow, firstColumn, height, width, flattenedArray); }
/** * Also creates cells if they don't exist */ private CellRange<HSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<HSSFCell> temp = new ArrayList<HSSFCell>(height * width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { HSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } HSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, HSSFCell.class); }
public static <B extends Cell> SSCellRange<B> create(int firstRow, int firstColumn, int height, int width, List<B> flattenedList, Class<B> cellClass) { int nItems = flattenedList.size(); if (height * width != nItems) { throw new IllegalArgumentException("Array size mismatch."); } @SuppressWarnings("unchecked") B[] flattenedArray = (B[]) Array.newInstance(cellClass, nItems); flattenedList.toArray(flattenedArray); return new SSCellRange<B>(firstRow, firstColumn, height, width, flattenedArray); }
/** * Also creates cells if they don't exist */ private CellRange<XSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<XSSFCell> temp = new ArrayList<>(height * width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { XSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } XSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, XSSFCell.class); }
/** * Also creates cells if they don't exist */ private CellRange<XSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<XSSFCell> temp = new ArrayList<XSSFCell>(height*width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { XSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } XSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, XSSFCell.class); }
/** * Also creates cells if they don't exist */ private CellRange<HSSFCell> getCellRange(CellRangeAddress range) { int firstRow = range.getFirstRow(); int firstColumn = range.getFirstColumn(); int lastRow = range.getLastRow(); int lastColumn = range.getLastColumn(); int height = lastRow - firstRow + 1; int width = lastColumn - firstColumn + 1; List<HSSFCell> temp = new ArrayList<HSSFCell>(height*width); for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) { for (int colIn = firstColumn; colIn <= lastColumn; colIn++) { HSSFRow row = getRow(rowIn); if (row == null) { row = createRow(rowIn); } HSSFCell cell = row.getCell(colIn); if (cell == null) { cell = row.createCell(colIn); } temp.add(cell); } } return SSCellRange.create(firstRow, firstColumn, height, width, temp, HSSFCell.class); }