/** * Retrieves the border style for a given cell * * @param row * @param col * @param property */ public BorderStyle getBorderStyle(int row, int col, String property) { return getBorderStyle(new CellAddress(row, col), property); }
/** * <p> * Sets the color of the top border for a range of cells. * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawTopBorderColor(CellRangeAddress range, short color) { int row = range.getFirstRow(); int firstCol = range.getFirstColumn(); int lastCol = range.getLastColumn(); for (int i = firstCol; i <= lastCol; i++) { if (getBorderStyle(row, i, CellUtil.BORDER_TOP) == BorderStyle.NONE) { drawTopBorder(new CellRangeAddress(row, row, i, i), BorderStyle.THIN); } addProperty(row, i, CellUtil.TOP_BORDER_COLOR, color); } }
/** * <p> * Sets the color of the right border for a range of cells. If the border is * not drawn, it defaults to BORDER_THIN * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawRightBorderColor(CellRangeAddress range, short color) { int firstRow = range.getFirstRow(); int lastRow = range.getLastRow(); int col = range.getLastColumn(); for (int i = firstRow; i <= lastRow; i++) { if (getBorderStyle(i, col, CellUtil.BORDER_RIGHT) == BorderStyle.NONE) { drawRightBorder(new CellRangeAddress(i, i, col, col), BorderStyle.THIN); } addProperty(i, col, CellUtil.RIGHT_BORDER_COLOR, color); } }
/** * <p> * Sets the color of the bottom border for a range of cells. * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawBottomBorderColor(CellRangeAddress range, short color) { int row = range.getLastRow(); int firstCol = range.getFirstColumn(); int lastCol = range.getLastColumn(); for (int i = firstCol; i <= lastCol; i++) { if (getBorderStyle(row, i, CellUtil.BORDER_BOTTOM) == BorderStyle.NONE) { drawBottomBorder(new CellRangeAddress(row, row, i, i), BorderStyle.THIN); } addProperty(row, i, CellUtil.BOTTOM_BORDER_COLOR, color); } }
/** * <p> * Sets the color of the left border for a range of cells. * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawLeftBorderColor(CellRangeAddress range, short color) { int firstRow = range.getFirstRow(); int lastRow = range.getLastRow(); int col = range.getFirstColumn(); for (int i = firstRow; i <= lastRow; i++) { if (getBorderStyle(i, col, CellUtil.BORDER_LEFT) == BorderStyle.NONE) { drawLeftBorder(new CellRangeAddress(i, i, col, col), BorderStyle.THIN); } addProperty(i, col, CellUtil.LEFT_BORDER_COLOR, color); } }
/** * Retrieves the border style for a given cell * * @param row * @param col * @param property */ public BorderStyle getBorderStyle(int row, int col, String property) { return getBorderStyle(new CellAddress(row, col), property); }
/** * <p> * Sets the color of the top border for a range of cells. * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawTopBorderColor(CellRangeAddress range, short color) { int row = range.getFirstRow(); int firstCol = range.getFirstColumn(); int lastCol = range.getLastColumn(); for (int i = firstCol; i <= lastCol; i++) { if (getBorderStyle(row, i, CellUtil.BORDER_TOP) == BorderStyle.NONE) { drawTopBorder(new CellRangeAddress(row, row, i, i), BorderStyle.THIN); } addProperty(row, i, CellUtil.TOP_BORDER_COLOR, color); } }
/** * <p> * Sets the color of the right border for a range of cells. If the border is * not drawn, it defaults to BORDER_THIN * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawRightBorderColor(CellRangeAddress range, short color) { int firstRow = range.getFirstRow(); int lastRow = range.getLastRow(); int col = range.getLastColumn(); for (int i = firstRow; i <= lastRow; i++) { if (getBorderStyle(i, col, CellUtil.BORDER_RIGHT) == BorderStyle.NONE) { drawRightBorder(new CellRangeAddress(i, i, col, col), BorderStyle.THIN); } addProperty(i, col, CellUtil.RIGHT_BORDER_COLOR, color); } }
/** * <p> * Sets the color of the bottom border for a range of cells. * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawBottomBorderColor(CellRangeAddress range, short color) { int row = range.getLastRow(); int firstCol = range.getFirstColumn(); int lastCol = range.getLastColumn(); for (int i = firstCol; i <= lastCol; i++) { if (getBorderStyle(row, i, CellUtil.BORDER_BOTTOM) == BorderStyle.NONE) { drawBottomBorder(new CellRangeAddress(row, row, i, i), BorderStyle.THIN); } addProperty(row, i, CellUtil.BOTTOM_BORDER_COLOR, color); } }
/** * <p> * Sets the color of the left border for a range of cells. * </p> * * @param range * - {@link CellRangeAddress} range of cells on which colors are * set. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. */ private void drawLeftBorderColor(CellRangeAddress range, short color) { int firstRow = range.getFirstRow(); int lastRow = range.getLastRow(); int col = range.getFirstColumn(); for (int i = firstRow; i <= lastRow; i++) { if (getBorderStyle(i, col, CellUtil.BORDER_LEFT) == BorderStyle.NONE) { drawLeftBorder(new CellRangeAddress(i, i, col, col), BorderStyle.THIN); } addProperty(i, col, CellUtil.LEFT_BORDER_COLOR, color); } }