List of usage examples for com.lowagie.text Cell addElement
public void addElement(Element element) throws BadElementException
Cell
. From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java
License:Open Source License
/** * Renders a Cell for//from ww w . j a v a 2 s . co m * * @param label * @param header * @param depth * @param leaf * @param horizantalAlignment * @return * @throws BadElementException */ public static Cell bodyCell(String label, boolean header, int depth, boolean leaf, int horizantalAlignment) throws BadElementException { Cell cell = new Cell(); cell.setHorizontalAlignment(horizantalAlignment); if (label != null) { Paragraph para = new Paragraph(label); Font font = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK); if (depth == 0 && !leaf) { font.setColor(Color.WHITE); } para.setFont(font); para.setIndentationLeft(5.4f + (header ? 12 * depth : 0)); cell.addElement(para); } cell.setBorderWidthLeft(0f); cell.setBorderWidthRight(0); cell.setBorderWidthTop(0); if (!leaf && depth == 0) { cell.setBackgroundColor(new Color(149, 179, 215)); // #95B3D7 cell.setBorderWidthBottom(0.5f); cell.setBorderColorBottom(new Color(219, 229, 241)); // #DBE5F1 } else if (!leaf && depth == 1) { cell.setBackgroundColor(new Color(219, 229, 241)); cell.setBorderWidthBottom(0.5f); cell.setBorderColorBottom(new Color(79, 129, 189)); } else { cell.setBorderWidthBottom(0.5f); cell.setBorderColorBottom(new Color(219, 229, 241)); cell.setBorderWidthTop(0.5f); cell.setBorderColorTop(new Color(219, 229, 241)); } return cell; }