List of usage examples for com.lowagie.text Cell setColspan
public void setColspan(int value)
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTableHeader(Table t, String text) throws BadElementException { Chunk chunk = new Chunk(text, new Font(Font.TIMES_ROMAN, 15, Font.BOLD)); Cell cell = new Cell(chunk); cell.setHorizontalAlignment(Cell.ALIGN_CENTER); cell.setHeader(true);//ww w.jav a2s . com cell.setColspan(2); t.addCell(cell); }
From source file:org.sigmah.server.report.renderer.itext.ItextPivotTableRenderer.java
License:Open Source License
public void render(DocWriter writer, Document document, PivotTableElement element) { try {/*from ww w . j a v a 2 s . c o m*/ document.add(ThemeHelper.elementTitle(element.getTitle())); ItextRendererHelper.addFilterDescription(document, element.getContent().getFilterDescriptions()); PivotTableData data = element.getContent().getData(); if (data.isEmpty()) { document.add(new Paragraph("Aucune Donnes")); // TODO: i18n } else { int colDepth = data.getRootColumn().getDepth(); List<PivotTableData.Axis> colLeaves = data.getRootColumn().getLeaves(); int colBreadth = colLeaves.size(); Table table = new Table(colBreadth + 1, 1); table.setUseVariableBorders(true); table.setWidth(100.0f); table.setWidths(calcColumnWidths(document, data, colLeaves)); table.setBorderWidth(0); // first write the column headers for (int depth = 1; depth <= colDepth; ++depth) { if (depth == 1) { Cell cell = ThemeHelper.cornerCell(); cell.setRowspan(colDepth); table.addCell(cell); } List<PivotTableData.Axis> columns = data.getRootColumn().getDescendantsAtDepth(depth); for (PivotTableData.Axis column : columns) { Cell cell = ThemeHelper.columnHeaderCell(column.getLabel(), column.isLeaf()); cell.setColspan(Math.max(1, column.getChildCount())); table.addCell(cell); } } table.endHeaders(); for (PivotTableData.Axis row : data.getRootRow().getChildren()) { writeRow(table, row, colLeaves, 0); } document.add(table); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.sigmah.server.report.renderer.itext.ItextTableRenderer.java
License:Open Source License
private void renderTable(Document document, TableData data) throws DocumentException { int colDepth = data.getRootColumn().getDepth(); List<TableColumn> colLeaves = data.getRootColumn().getLeaves(); int colBreadth = colLeaves.size(); Table table = new Table(colBreadth, 1); table.setUseVariableBorders(true);//from www .ja v a 2 s .c om table.setWidth(100.0f); table.setBorderWidth(0); // first write the column headers for (int depth = 1; depth <= colDepth; ++depth) { List<TableColumn> columns = data.getRootColumn().getDescendantsAtDepth(depth); for (TableColumn column : columns) { Cell cell = ThemeHelper.columnHeaderCell(column.getLabel(), column.isLeaf(), computeHAlign(column)); cell.setColspan(Math.max(1, column.getChildren().size())); cell.setRowspan(colDepth - depth - column.getDepth() + 1); table.addCell(cell); } } table.endHeaders(); DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); NumberFormat numberFormat = NumberFormat.getIntegerInstance(); numberFormat.setGroupingUsed(true); for (TableData.Row row : data.getRows()) { for (TableColumn column : colLeaves) { Object value = row.values[data.getColumnIndex(column)]; String label = ""; if (value instanceof Date) { label = dateFormat.format(value); } else if (value instanceof Number) { label = numberFormat.format(value); } else if (value != null) { label = value.toString(); } table.addCell(ThemeHelper.bodyCell(label, false, 0, true, computeHAlign(column))); } } document.add(table); }
From source file:pl.exsio.ca.app.report.terraincard.view.TerrainCardsView.java
License:Open Source License
private Cell getNotificationCell(String groupName, boolean odd, int colSpan) throws Exception { Paragraph p = new Paragraph(groupName, this.getFont()); if (groupName.equals(TerrainCardViewModel.EMPTY_CELL_VALUE)) { p.getFont().setColor(Color.WHITE); }// w ww.j a v a 2 s . co m p.getFont().setSize(7); Cell cell = new Cell(p); if (odd) { cell.setBackgroundColor(new Color(240, 240, 240)); } cell.setColspan(colSpan); return cell; }
From source file:pl.exsio.ca.app.report.terraincard.view.TerrainCardsView.java
License:Open Source License
private Cell getColumnTitleCell(String title) throws Exception { Paragraph p = new Paragraph(title, this.getFont()); p.getFont().setSize(10);//from ww w . j a v a2 s . co m p.getFont().setStyle(Font.BOLDITALIC); p.setSpacingAfter(2); p.setSpacingBefore(2); Cell cell = new Cell(p); cell.setColspan(2); cell.setBackgroundColor(new Color(230, 230, 230)); return cell; }
From source file:s2s.luna.reports.Report_DOC_VAL_RSO.java
License:GNU General Public License
public void writePair(CenterMiddleTable tbl, Pair pair, int iLevel) throws Exception { if (iLevel != 0) { if (iLevel > 1) { Cell cell = new Cell(); cell.setColspan(iLevel - 1); cell.setBorder(0);/* w ww .j a va 2 s . c o m*/ tbl.addCell(cell); } tbl.toLeft(); tbl.addCell(pair.strName, 14 - ((iLevel - 1) * 2), 4 - iLevel); tbl.toRight(); tbl.addCell((pair.iPage + iIndexPageCount) + "", 14 - ((iLevel - 1) * 2)); } Iterator it = pair.Children.iterator(); while (it.hasNext()) { Pair pp = (Pair) it.next(); writePair(tbl, pp, iLevel + 1); } }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCell(String strCaption, int iColspan) throws BadElementException { Cell cl = new Cell(new Phrase(strCaption == null ? "" : strCaption, REPORT_SETTINGS.ftTableHeader)); cl.setBackgroundColor(REPORT_SETTINGS.clTableHeader); cl.setColspan(iColspan); this.addCell(cl); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellMagenta(String strCaption, int iColspan) throws BadElementException { Cell cl = new Cell(new Phrase(strCaption == null ? "" : strCaption, REPORT_SETTINGS.ftTableHeader)); cl.setBackgroundColor(REPORT_SETTINGS.magenta); cl.setColspan(iColspan); this.addCell(cl); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellB(String strCaption, int iColspan, boolean bColor, int iSize) throws BadElementException { Cell cell = null; switch (iSize) { case 8:/*from w w w .j a va 2 s . co m*/ cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader8B)); break; case 9: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader9B)); break; case 10: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader10B)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader12B)); break; case 16: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader16B)); break; default: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeaderB)); break; } if (bColor) { cell.setBackgroundColor(REPORT_SETTINGS.clTableHeader); } cell.setColspan(iColspan); this.addCell(cell); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellB2(String strCaption, int iColspan, boolean bColor, int iSize) throws BadElementException { Cell cell = null; switch (iSize) { case 8:/*w w w .j a va 2 s . c o m*/ cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader8B)); break; case 9: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader9B)); break; case 10: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader10B)); break; case 11: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader11B)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader12B)); break; default: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeaderB)); break; } cell.setColspan(iColspan); this.addCell(cell); }