private void setFont(Tc tableCell, Map<String, Object> style, RPr runProperties) { if (style.containsKey(StyleFormatConstants.FONT_FAMILY_KEY)) { String val = (String) style.get(StyleFormatConstants.FONT_FAMILY_KEY); setFontFamily(runProperties, val); } if (style.containsKey(StyleFormatConstants.FONT_SIZE)) { Float val = (Float) style.get(StyleFormatConstants.FONT_SIZE); setFontSize(runProperties, String.valueOf((int) (2 * val))); } if (style.containsKey(StyleFormatConstants.FONT_COLOR)) { Color val = (Color) style.get(StyleFormatConstants.FONT_COLOR); setFontColor(runProperties, ColorUtil.getHexColor(val).substring(1)); } if (style.containsKey(StyleFormatConstants.FONT_STYLE_KEY)) { if (StyleFormatConstants.FONT_STYLE_BOLD.equals( style.get(StyleFormatConstants.FONT_STYLE_KEY))) { addBoldStyle(runProperties); } if (StyleFormatConstants.FONT_STYLE_ITALIC.equals( style.get(StyleFormatConstants.FONT_STYLE_KEY))) { addItalicStyle(runProperties); } if (StyleFormatConstants.FONT_STYLE_BOLDITALIC.equals( style.get(StyleFormatConstants.FONT_STYLE_KEY))) { addBoldStyle(runProperties); addItalicStyle(runProperties); } } }
private void setCellBorders(Tc tableCell, Map<String, Object> style) { TcPr tableCellProperties = tableCell.getTcPr(); if (tableCellProperties == null) { tableCellProperties = new TcPr(); tableCell.setTcPr(tableCellProperties); } CTBorder border = new CTBorder(); // border.setColor("auto"); border.setSpace(new BigInteger("0")); border.setVal(STBorder.SINGLE); TcBorders borders = new TcBorders(); if (style.containsKey(StyleFormatConstants.BORDER_LEFT)) { Float val = (Float) style.get(StyleFormatConstants.BORDER_LEFT); border.setSz(BigInteger.valueOf((long) (val / 2))); Color color = (Color) style.get(StyleFormatConstants.BORDER_LEFT_COLOR); border.setColor(ColorUtil.getHexColor(color).substring(1)); borders.setLeft(border); } if (style.containsKey(StyleFormatConstants.BORDER_RIGHT)) { Float val = (Float) style.get(StyleFormatConstants.BORDER_RIGHT); border.setSz(BigInteger.valueOf((long) (val / 2))); Color color = (Color) style.get(StyleFormatConstants.BORDER_RIGHT_COLOR); border.setColor(ColorUtil.getHexColor(color).substring(1)); borders.setRight(border); } if (style.containsKey(StyleFormatConstants.BORDER_TOP)) { Float val = (Float) style.get(StyleFormatConstants.BORDER_TOP); border.setSz(BigInteger.valueOf((long) (val / 2))); Color color = (Color) style.get(StyleFormatConstants.BORDER_TOP_COLOR); border.setColor(ColorUtil.getHexColor(color).substring(1)); borders.setTop(border); } if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM)) { Float val = (Float) style.get(StyleFormatConstants.BORDER_BOTTOM); border.setSz(BigInteger.valueOf((long) (val / 2))); Color color = (Color) style.get(StyleFormatConstants.BORDER_BOTTOM_COLOR); border.setColor(ColorUtil.getHexColor(color).substring(1)); borders.setBottom(border); } tableCellProperties.setTcBorders(borders); }
private void setBackground(Tc tableCell, Map<String, Object> style) { // to see a background image all cells must not have any background! if (bean.getReportLayout().getBackgroundImage() == null) { if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) { Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR); setCellColor(tableCell, ColorUtil.getHexColor(val).substring(1)); } } }