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.setVerticalAlignment(Element.ALIGN_TOP); }else if(valign.equals(Alignment.middle)){ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); }else if(valign.equals(Alignment.bottom)){ cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
@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; }
/** * Initialize the main info holder table, like the appropriate number of columns. * @param model The table being represented as iText. * @see org.displaytag.render.TableWriterTemplate#writeTableOpener(org.displaytag.model.TableModel) */ @Override protected void writeTableOpener(TableModel model) { this.table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); this.table.setWidthPercentage(100); this.defaultFont = this.getTableFont(); }
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; }
/** * Returns a formatted cell for the given value. * * @param value cell value * @return Cell */ private PdfPCell getCell(Object value) { PdfPCell cell = new PdfPCell(new Phrase(new Chunk(StringUtils.trimToEmpty(value != null ? value.toString() : StringUtils.EMPTY), this.defaultFont))); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setLeading(8, 0); return cell; }
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; }
/** * Returns a formatted cell for the given value. * @param value cell value * @return Cell */ private PdfPCell getCell(String value) { PdfPCell cell = new PdfPCell(new Phrase(new Chunk(StringUtils.trimToEmpty(value), this.smallFont))); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setLeading(8, 0); cell.setPadding(2); return cell; }
/** * Initialize the main info holder table. */ protected void initTable() { this.tablePDF = new PdfPTable(this.model.getNumberOfColumns()); this.tablePDF.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); this.tablePDF.setWidthPercentage(100); this.smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.NORMAL, new BaseColor(0, 0, 0)); }
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 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 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; }
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; }
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); }
private void createHeaderRow(PdfExportParams entity, PdfPTable table, int feildLength) { PdfPCell iCell = new PdfPCell( new Phrase(entity.getTitle(), styler.getFont(null, entity.getTitle()))); iCell.setHorizontalAlignment(Element.ALIGN_CENTER); iCell.setVerticalAlignment(Element.ALIGN_CENTER); iCell.setFixedHeight(entity.getTitleHeight()); iCell.setColspan(feildLength + 1); table.addCell(iCell); if (entity.getSecondTitle() != null) { iCell = new PdfPCell( new Phrase(entity.getSecondTitle(), styler.getFont(null, entity.getSecondTitle()))); iCell.setHorizontalAlignment(Element.ALIGN_RIGHT); iCell.setVerticalAlignment(Element.ALIGN_CENTER); iCell.setFixedHeight(entity.getSecondTitleHeight()); iCell.setColspan(feildLength + 1); table.addCell(iCell); } }