/** * Adds a <CODE>Chunk</CODE> to the current text array. Will not have any * effect if addElement() was called before. * * @param chunk the text */ public void addText(final Chunk chunk) { if (chunk == null || composite) { return; } addText(new Phrase(chunk)); }
/** * Adds a cell element. * * @param text the text for the cell */ public void addCell(final String text) { addCell(new Phrase(text)); }
/** * Adds a cell element. * * @param text the text for the cell */ public void addCell(final String text) { addCell(new Phrase(text)); }
/** * Adds a <CODE>Chunk</CODE> to the current text array. Will not have any * effect if addElement() was called before. * * @param chunk the text */ public void addText(final Chunk chunk) { if (chunk == null || composite) { return; } addText(new Phrase(chunk)); }
private static PdfPCell createValueCell(String text){ // font Font font = new Font(FontFamily.HELVETICA, 8, Font.NORMAL, BaseColor.BLACK); // create cell PdfPCell cell = new PdfPCell(new Phrase(text,font)); // set style Style.valueCellStyle(cell); return cell; } }
private static PdfPCell createLabelCell(String text){ // font Font font = new Font(FontFamily.HELVETICA, 8, Font.BOLD, BaseColor.DARK_GRAY); // create cell PdfPCell cell = new PdfPCell(new Phrase(text,font)); // set style Style.labelCellStyle(cell); return cell; }
private void emitHeader(PdfPTable table, ITextContext emitterContext) { Styles styles = emitterContext.styles(); CellStyler styler = headerCellStyler; if (styler == null) styler = new DefaultHeaderCellStyler(styles); table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Tag/Description", styler.cellFont())))); table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Passed", styler.cellFont())))); table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Failed", styler.cellFont())))); table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Other", styler.cellFont())))); }
private PdfPCell createStringCell(PdfPTable table, String text, ExcelExportEntity entity, int rowHeight) { PdfPCell iCell = new PdfPCell(new Phrase(text, styler.getFont(entity, text))); styler.setCellStyler(iCell, entity, text); iCell.setFixedHeight((int) (rowHeight * 2.5)); table.addCell(iCell); return iCell; }
@Override public void consume(Element element) { PdfPCell cell = new PdfPCell(); cell.addElement(element); steps.addCell(noBorder(colspan(2, new PdfPCell(new Phrase(""))))); steps.addCell(noBorder(cell)); } };
private PdfPCell createStringCell(PdfPTable table, String text, ExcelExportEntity entity, int rowHeight) { PdfPCell iCell = new PdfPCell(new Phrase(text, styler.getFont(entity, text))); styler.setCellStyler(iCell, entity, text); iCell.setFixedHeight((int) (rowHeight * 2.5)); table.addCell(iCell); return iCell; }
private void title(PdfPTable pdf) { PdfPCell cell = new PdfPCell(new Phrase(table.getTitle(), smallBold)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(table.getHeaders().size()); pdf.addCell(cell); }
private void header(PdfPTable pdf) { for (Header header : table.getHeaders()) { PdfPCell cell = new PdfPCell(new Phrase(header.getContent(), smallBold)); if ("center".equals(header.getAlign())) cell.setHorizontalAlignment(Element.ALIGN_CENTER); else if ("left".equals(header.getAlign())) cell.setHorizontalAlignment(Element.ALIGN_LEFT); else if ("right".equals(header.getAlign())) cell.setHorizontalAlignment(Element.ALIGN_RIGHT); pdf.addCell(cell); } }
private void body(PdfPTable pdf) { for (Row row : table.getRows()) { for (Column column : row.getColumns()) { PdfPCell cell = new PdfPCell(new Phrase(column.getContent(), smallBold)); if ("center".equals(column.getAlign())) cell.setHorizontalAlignment(Element.ALIGN_CENTER); else if ("left".equals(column.getAlign())) cell.setHorizontalAlignment(Element.ALIGN_LEFT); else if ("right".equals(column.getAlign())) cell.setHorizontalAlignment(Element.ALIGN_RIGHT); pdf.addCell(cell); } } }
private void emitHeaders(PdfPTable table, CellStyler styler) { Phrase tagHeader = new Phrase("Tag", styler.cellFont()); Phrase descHeader = new Phrase("Description", styler.cellFont()); table.addCell(styler.applyStyle(new PdfPCell(tagHeader))); table.addCell(styler.applyStyle(new PdfPCell(descHeader))); table.setHeaderRows(1); } }
private PdfPCell statusCell(Status status, Styles styles) { Phrase statusSymbol = new Phrase(statusMarker.statusMarker(status)); PdfPCell statusCell = new PdfPCell(statusSymbol); statusCell.setVerticalAlignment(Element.ALIGN_TOP); statusCell.setHorizontalAlignment(Element.ALIGN_RIGHT); if (!debugTable) statusCell.setBorder(Rectangle.NO_BORDER); return statusCell; } }
private PdfPCell statusCell(Status status) { Phrase statusSymbol = new Phrase(statusMarker.statusMarker(status)); PdfPCell statusCell = new PdfPCell(statusSymbol); statusCell.setVerticalAlignment(Element.ALIGN_TOP); statusCell.setHorizontalAlignment(Element.ALIGN_RIGHT); statusCell = noBorder(statusCell); return statusCell; }
private PdfPCell valuedCell(int value, int total, CellStyler styler, Function<Float, BaseColor> colorProviders) { Phrase phrase = new Phrase(value + "/" + total, styler.cellFont()); PdfPCell cell = styler.applyStyle(new PdfPCell(phrase)); cell.setCellEvent( new PercentBackgroundEvent( value, total, colorProviders)); return cell; }
@Override public void onEndPage(PdfWriter writer, Document document) { ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase( TagConstants.EMPTY_STRING, PdfView.this.smallFont), (document.left() + document.right()) / 2, document.bottom() - 18, 0); }
public void setWatermark(Watermark watermark) { this.mWatermark = watermark; this.mPhrase = new Phrase(mWatermark.getWatermarkText(), new Font(mWatermark.getFontFamily(), mWatermark.getTextSize(), mWatermark.getFontStyle(), mWatermark.getTextColor())); } }
private void emitStepInErrorLegend(ITextContext emitterContext) { Styles styles = emitterContext.styles(); PdfPTable table = new PdfPTable(new float[]{1f, 24f}); table.addCell(noBorder(topRight(new PdfPCell(stepInErrorMarker(styles))))); table.addCell(noBorder(new PdfPCell(new Phrase(": First step in error within the scenario", new FontCopier(styles.defaultFont()).italic().get())))); table.setSpacingBefore(10f); table.setSpacingAfter(10f); emitterContext.append(table); }