/** * Draws a group of cell borders for a cell range. The borders are not * applied to the cells at this time, just the template is drawn. To apply * the drawn borders to a sheet, use {@link #applyBorders}. * * @param range * - {@link CellRangeAddress} range of cells on which borders are * drawn. * @param borderType * - Type of border to draw. {@link BorderStyle}. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. * @param extent * - {@link BorderExtent} of the borders to be * applied. */ public void drawBorders(CellRangeAddress range, BorderStyle borderType, short color, BorderExtent extent) { drawBorders(range, borderType, extent); if (borderType != BorderStyle.NONE) { drawBorderColors(range, color, extent); } }
/** * Draws a group of cell borders for a cell range. The borders are not * applied to the cells at this time, just the template is drawn. To apply * the drawn borders to a sheet, use {@link #applyBorders}. * * @param range * - {@link CellRangeAddress} range of cells on which borders are * drawn. * @param borderType * - Type of border to draw. {@link BorderStyle}. * @param color * - Color index from {@link IndexedColors} used to draw the * borders. * @param extent * - {@link BorderExtent} of the borders to be * applied. */ public void drawBorders(CellRangeAddress range, BorderStyle borderType, short color, BorderExtent extent) { drawBorders(range, borderType, extent); if (borderType != BorderStyle.NONE) { drawBorderColors(range, color, extent); } }
pt.drawBorders(new CellRangeAddress(1, 3, 1, 3), BorderStyle.MEDIUM, BorderExtent.ALL); pt.drawBorders(new CellRangeAddress(5, 7, 1, 3), BorderStyle.MEDIUM, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(5, 7, 1, 3), BorderStyle.THIN, BorderExtent.INSIDE); pt.drawBorders(new CellRangeAddress(9, 11, 1, 3), BorderStyle.MEDIUM, IndexedColors.RED.getIndex(), BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(9, 11, 1, 3), BorderStyle.MEDIUM, IndexedColors.BLUE.getIndex(), BorderExtent.INSIDE_VERTICAL); pt.drawBorders(new CellRangeAddress(9, 11, 1, 3), BorderStyle.MEDIUM, IndexedColors.GREEN.getIndex(), BorderExtent.INSIDE_HORIZONTAL); pt.drawBorders(new CellRangeAddress(10, 10, 2, 2), BorderStyle.NONE, BorderExtent.ALL);