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; } }
cell.setHorizontalAlignment(Element.ALIGN_LEFT); }else if(align.equals(Alignment.center)){ cell.setHorizontalAlignment(Element.ALIGN_CENTER); }else if(align.equals(Alignment.right)){ cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
@Override public void setCellStyler(PdfPCell iCell, ExcelExportEntity entity, String text) { iCell.setHorizontalAlignment(Element.ALIGN_CENTER); iCell.setVerticalAlignment(Element.ALIGN_MIDDLE); }
@Override public void setCellStyler(PdfPCell iCell, ExcelExportEntity entity, String text) { iCell.setHorizontalAlignment(Element.ALIGN_CENTER); iCell.setVerticalAlignment(Element.ALIGN_MIDDLE); }
private PdfPCell topRight(PdfPCell pdfPCell) { pdfPCell.setVerticalAlignment(Element.ALIGN_TOP); pdfPCell.setHorizontalAlignment(Element.ALIGN_RIGHT); return pdfPCell; }
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 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 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 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 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 titleCell(ScenarioExec scenarioExec, Styles styles) { Font font = styles.defaultFont(); Paragraph p = new Paragraph(scenarioExec.name(), font); PdfPCell cell = new PdfPCell(p); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_LEFT); if (!debugTable) cell.setBorder(Rectangle.NO_BORDER); return cell; }
private PdfPCell keywordCell(StepExec step, Styles styles) { Font stepKeywordFont = styles.getFontOrDefault(STEP_KEYWORD_FONT); Paragraph pKeyword = new Paragraph(step.keyword(), stepKeywordFont); PdfPCell keywordCell = new PdfPCell(pKeyword); keywordCell.setVerticalAlignment(Element.ALIGN_TOP); keywordCell.setHorizontalAlignment(Element.ALIGN_RIGHT); keywordCell = noBorder(keywordCell); return keywordCell; }
public static void headerCellStyle(PdfPCell cell){ // alignment cell.setHorizontalAlignment(Element.ALIGN_CENTER); // padding cell.setPaddingTop(0f); cell.setPaddingBottom(7f); // background color cell.setBackgroundColor(new BaseColor(0,121,182)); // border cell.setBorder(0); cell.setBorderWidthBottom(2f); } public static void labelCellStyle(PdfPCell cell){
public static void valueCellStyle(PdfPCell cell){ // alignment cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // padding cell.setPaddingTop(0f); cell.setPaddingBottom(5f); // border cell.setBorder(0); cell.setBorderWidthBottom(0.5f); // height cell.setMinimumHeight(18f); } }
private PdfPCell statusCell(StepExec step) { ResultExec result = step.result(); Phrase statusSymbol; if (result == null) { // this happen when step comes from outline; no status is then attached statusSymbol = new Phrase(""); } else { statusSymbol = new Phrase(statusMarker.statusMarker(result.status())); } PdfPCell statusCell = new PdfPCell(statusSymbol); statusCell.setVerticalAlignment(Element.ALIGN_TOP); statusCell.setHorizontalAlignment(Element.ALIGN_RIGHT); statusCell = noBorder(statusCell); return statusCell; }
private static PdfPCell createCell(final Phrase text, final int index, final BaseColor bgColor) { final PdfPCell cell = new PdfPCell(text); cell.setHorizontalAlignment(index == 0 ? Element.ALIGN_LEFT : Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(bgColor); cell.setBorderWidth(0); cell.setPaddingBottom(PADDING_BOTTOM); cell.setPaddingTop(PADDING_TOP); cell.setPaddingLeft(PADDING_LEFT); cell.setPaddingRight(PADDING_RIGHT); return cell; }
public static void labelCellStyle(PdfPCell cell){ // alignment cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // padding cell.setPaddingLeft(3f); cell.setPaddingTop(0f); // background color cell.setBackgroundColor(BaseColor.LIGHT_GRAY); // border cell.setBorder(0); cell.setBorderWidthBottom(1); cell.setBorderColorBottom(BaseColor.GRAY); // height cell.setMinimumHeight(18f); }
/** * Obtain a header cell. * @param value Cell content. * @return A header cell with the given content. */ private PdfPCell getHeaderCell(String value) { Chunk cellContent = new Chunk(value, this.getHeaderFont()); setHeaderFontStyle(cellContent); PdfPCell cell = new PdfPCell(new Phrase(cellContent)); cell.setLeading(8, 0); cell.setHorizontalAlignment(this.getHeaderHorizontalAlignment()); cell.setBackgroundColor(this.getHeaderBackgroundColor()); return cell; }