// If a border style is set on a ReportBandElement we must apply it to all subreport cells private XSSFCellStyle updateSubreportBandElementStyle( XSSFCellStyle cellStyle, BandElement bandElement, Object value, int gridRow, int gridColumn, int colSpan) { if (subreportCellStyle == null) { return cellStyle; } if (gridColumn == 0) { cellStyle.setBorderLeft(subreportCellStyle.getBorderLeft()); cellStyle.setLeftBorderColor(subreportCellStyle.getLeftBorderColor()); } else if (gridColumn + colSpan - 1 == bean.getReportLayout().getColumnCount() - 1) { cellStyle.setBorderRight(subreportCellStyle.getBorderRight()); cellStyle.setRightBorderColor(subreportCellStyle.getRightBorderColor()); } if (pageRow == 0) { cellStyle.setBorderTop(subreportCellStyle.getBorderTop()); cellStyle.setTopBorderColor(subreportCellStyle.getTopBorderColor()); } else if ((pageRow + 1) == getRowsCount()) { cellStyle.setBorderBottom(subreportCellStyle.getBorderBottom()); cellStyle.setBottomBorderColor(subreportCellStyle.getBottomBorderColor()); } return cellStyle; }
/** * 上線は太線のセル行を探す * * @param nRow 行データ * @return 有効列数 */ public static int getRowForBold(XSSFSheet sheet, int nRow, int pageRowNum) { int nRowIndex = nRow; for (nRowIndex = nRow; nRowIndex > (nRow - pageRowNum); nRow--) { XSSFRow row = OoxmlUtil.getRowAnyway(sheet, nRow); if (row != null) { XSSFCell cell = row.getCell(0); XSSFCellStyle styletmp = cell.getCellStyle(); short borderTopnum = styletmp.getBorderTop(); short borderBold = XSSFCellStyle.BORDER_MEDIUM; if (styletmp.getBorderTop() == (XSSFCellStyle.BORDER_MEDIUM)) { break; } } } return nRowIndex; }