private PdfPCell buildPdfPCell(HeaderFooter phf,String text,int type){ PdfPCell cell=new PdfPCell(); cell.setPadding(0); cell.setBorder(Rectangle.NO_BORDER); Font font=FontBuilder.getFont(phf.getFontFamily(), phf.getFontSize(), phf.isBold(), phf.isItalic(),phf.isUnderline()); String fontColor=phf.getForecolor(); if(StringUtils.isNotEmpty(fontColor)){ String[] color=fontColor.split(","); font.setColor(Integer.valueOf(color[0]), Integer.valueOf(color[1]), Integer.valueOf(color[2])); } Paragraph graph=new Paragraph(text,font); cell.setPhrase(graph); switch(type){ case 1: cell.setHorizontalAlignment(Element.ALIGN_LEFT); break; case 2: cell.setHorizontalAlignment(Element.ALIGN_CENTER); break; case 3: cell.setHorizontalAlignment(Element.ALIGN_RIGHT); break; } cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell; } }
if(cellData instanceof Image){ Image img=(Image)cellData; cell=new PdfPCell(buildPdfImage(img.getBase64Data(), 0, 0)); }else if(cellData instanceof ChartData){ ChartData chartData=(ChartData)cellData; if(base64Data!=null){ Image img=new Image(base64Data,chartData.getWidth(),chartData.getHeight()); cell=new PdfPCell(buildPdfImage(img.getBase64Data(), 0, 0)); }else{ cell=new PdfPCell(); CellPhrase pargraph=new CellPhrase(cellInfo,""); cell.setPhrase(pargraph); cell=new PdfPCell(); CellPhrase pargraph=new CellPhrase(cellInfo,cellData); cell.setPhrase(pargraph);
for(int i=0;i<ps;i++){ if(i>0){ PdfPCell pdfMarginCell=new PdfPCell(); pdfMarginCell.setBorder(Rectangle.NO_BORDER); table.addCell(pdfMarginCell); if(tableHeight>childTableHeight){ for(int j=0;j<columns.size();j++){ PdfPCell lastCell=new PdfPCell(); lastCell.setBorder(Rectangle.NO_BORDER); childTable.addCell(lastCell); PdfPCell pdfContainerCell=new PdfPCell(childTable); pdfContainerCell.setBorder(Rectangle.NO_BORDER); table.addCell(pdfContainerCell); int left=columnCount-ps; for(int i=0;i<left;i++){ PdfPCell pdfMarginCell=new PdfPCell(); pdfMarginCell.setBorder(Rectangle.NO_BORDER); table.addCell(pdfMarginCell); pdfMarginCell=new PdfPCell(); pdfMarginCell.setBorder(Rectangle.NO_BORDER); table.addCell(pdfMarginCell);
private synchronized PdfPCell createPdfPCell() { if ( cell != null ) { return cell; } PdfPCell cell = new PdfPCell(); cell.setBorder( Rectangle.NO_BORDER ); cell.setPadding( 0 ); return cell; }
private synchronized PdfPCell createPdfPCell() { if ( cell != null ) { return cell; } PdfPCell cell = new PdfPCell(); cell.setBorder( Rectangle.NO_BORDER ); cell.setPadding( 0 ); return cell; }
private synchronized PdfPCell createPdfPCell() { if ( cell != null ) { return cell; } PdfPCell cell = new PdfPCell(); cell.setBorder( Rectangle.NO_BORDER ); cell.setPadding( 0 ); return cell; }
private PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorder( Rectangle.NO_BORDER ); cell.setPadding( 0.0f ); cell.setUseBorderPadding( true ); 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 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 PdfPCell stepCell(StepExec stepExec, Styles styles, ITextContext context) { Paragraph stepPhrase = StepsEmitter.formatStep(stepExec, true, styles, context); PdfPCell stepCell = new PdfPCell(stepPhrase); stepCell.setVerticalAlignment(Element.ALIGN_MIDDLE); stepCell.setHorizontalAlignment(Element.ALIGN_LEFT); stepCell = noBorder(stepCell); return stepCell; }
private PdfPCell phraseCell(StepExec step, Styles styles, ITextContext emitterContext) { Paragraph pPhrase = formatStep(step, false, styles, emitterContext); PdfPCell phraseCell = new PdfPCell(pPhrase); phraseCell.setVerticalAlignment(Element.ALIGN_TOP); phraseCell.setHorizontalAlignment(Element.ALIGN_LEFT); phraseCell = noBorder(phraseCell); return phraseCell; }
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 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 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; }
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 PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorder( Rectangle.NO_BORDER ); cell.setPadding( 0.0f ); cell.setUseBorderPadding( true ); cell.getColumn().setAdjustFirstLine( false ); 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; }
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; }