List of usage examples for com.lowagie.text.pdf PdfPCell setPhrase
public void setPhrase(Phrase phrase)
Phrase
for this cell. From source file:fr.univlorraine.mondossierweb.controllers.InscriptionController.java
License:Apache License
private PdfPCell makeCell(String str, Font font) { PdfPCell cell = new PdfPCell(); cell.setBorder(0);//from w ww . java 2 s.c om cell.setPhrase(new Phrase(str, font)); return cell; }
From source file:jdbreport.model.io.pdf.itext2.PdfWriter.java
License:Apache License
private PdfPCell writeCell(ReportModel model, jdbreport.model.Cell srcCell, int row, int col) throws BadElementException, IOException, SaveReportException { CellStyle style = model.getStyles(srcCell.getStyleId()); java.awt.Rectangle rect = model.getCellRect(row, col, true, true); float h = Math.round((float) Units.PT.setYPixels((int) rect.getHeight())); float w = Math.round((float) Units.PT.setXPixels((int) rect.getWidth())); PdfPCell pdfCell = null; if (srcCell.getPicture() != null) { java.awt.Image awtImage = srcCell.getPicture().getImage(); com.lowagie.text.Image image = awtImageToImage(awtImage, srcCell, w, h); pdfCell = new PdfPCell(image); } else {//from www .j av a 2 s. co m String text = null; if (srcCell.getValue() instanceof CellValue<?>) { StringWriter strWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(strWriter); if (!((CellValue<?>) srcCell.getValue()).write(printWriter, model, row, col, this, ReportBook.PDF)) { java.awt.Image awtImage = ((CellValue<?>) srcCell.getValue()).getAsImage(model, row, col); if (awtImage != null) { com.lowagie.text.Image image = awtImageToImage(awtImage, srcCell, w, h); pdfCell = new PdfPCell(image); } } else { text = strWriter.getBuffer().toString(); } } else { if (jdbreport.model.Cell.TEXT_HTML.equals(srcCell.getContentType())) { pdfCell = new PdfPCell(); writeHTMLText(model.getStyles(srcCell.getStyleId()), srcCell, pdfCell); } else { text = model.getCellText(srcCell); } } if (pdfCell == null) { pdfCell = new PdfPCell(); } if (text != null && text.length() > 0) { com.lowagie.text.Font font; if (fonts.containsKey(style.getId())) { font = fonts.get(style.getId()); } else { font = getFontMapper().styleToPdf(style); fonts.put(style.getId(), font); } Paragraph p; if (font != null) { p = new Paragraph(text, font); } else { p = new Paragraph(text); } pdfCell.setPhrase(p); pdfCell.setPadding(1); pdfCell.setLeading(0f, 1.1f); } else { pdfCell.setPadding(0); } } pdfCell.setFixedHeight(h); pdfCell.setBackgroundColor(style.getBackground()); pdfCell.setHorizontalAlignment(toPdfHAlignment(style.getHorizontalAlignment())); pdfCell.setVerticalAlignment(toPdfVAlignment(style.getVerticalAlignment())); if (style.getAngle() != 0) { pdfCell.setRotation(roundAngle(style.getAngle())); } assignBorders(style, pdfCell); pdfCell.setNoWrap(!style.isWrapLine()); if (srcCell.getColSpan() > 0) { pdfCell.setColspan(srcCell.getColSpan() + 1); } if (srcCell.getRowSpan() > 0) { pdfCell.setRowspan(srcCell.getRowSpan() + 1); } return pdfCell; }
From source file:jdbreport.model.io.pdf.itext2.PdfWriter.java
License:Apache License
protected void writeHTMLText(CellStyle parentStyle, jdbreport.model.Cell cell, PdfPCell pdfCell) { if (cell.isNull() || cell.isChild()) return;/* ww w . j a v a 2s .c o m*/ JTextComponent tc = getHTMLReportRenderer(); tc.setText(cell.getText()); List<Content> contentList = Content.getHTMLContentList((HTMLDocument) tc.getDocument()); if (contentList != null) { Phrase phrase = new Phrase(); for (Content content : contentList) { CellStyle newStyle = content.createTextStyle(parentStyle, parentStyle); if (newStyle == null) { newStyle = parentStyle; } if (newStyle != null) { if (newStyle.getTypeOffset() == CellStyle.SS_SUPER || newStyle.getTypeOffset() == CellStyle.SS_SUB) { newStyle = newStyle.deriveFont((float) newStyle.getSize() / 2); } int i = textStyles.indexOf(newStyle); if (i < 0) { textStyles.add(newStyle); i = textStyles.size() - 1; } Font font; String styleId = "T" + (i + 1); if (fonts.containsKey(styleId)) { font = fonts.get(styleId); } else { font = getFontMapper().styleToPdf(newStyle); fonts.put(styleId, font); } Chunk chunk = new Chunk(content.getText(), font); chunk.setBackground(newStyle.getBackground()); if (newStyle.getTypeOffset() == CellStyle.SS_SUPER) { chunk.setTextRise(newStyle.getSize() / 2); } else if (newStyle.getTypeOffset() == CellStyle.SS_SUB) { chunk.setTextRise(-newStyle.getSize() / 2); } phrase.add(chunk); } else { phrase.add(new Chunk(content.getText())); } } pdfCell.setPhrase(phrase); } }
From source file:mitm.common.pdf.MessagePDFBuilder.java
License:Open Source License
private void addBodyAndAttachments(PdfWriter pdfWriter, Document document, PdfPTable bodyTable, String body, Collection<Part> attachments) throws DocumentException, MessagingException, IOException { /*//from w ww . j av a 2s . c o m * Font for anchors (links) */ Font linkFont = createLinkFont(); FontSelector bodyFontSelector = createBodyFontSelector(); PdfPCell bodyCell = new PdfPCell(); /* * Body table will be white */ bodyCell.setGrayFill(1f); bodyCell.setPadding(10); Phrase bodyPhrase = new Phrase(); bodyCell.setPhrase(bodyPhrase); /* * Matcher we need to convert links to clickable links */ Matcher urlMatcher = urlPattern.matcher(body); String textPart; int currentIndex = 0; /* * Add body and links */ while (urlMatcher.find()) { textPart = body.substring(currentIndex, urlMatcher.start()); addTextPart(textPart, bodyPhrase, bodyFontSelector); String linkPart = urlMatcher.group(); if (linkPart != null) { addLinkPart(linkPart, bodyPhrase, linkFont); currentIndex = urlMatcher.start() + linkPart.length(); } } textPart = body.substring(currentIndex); addTextPart(textPart, bodyPhrase, bodyFontSelector); bodyTable.addCell(bodyCell); document.add(bodyTable); addAttachments(pdfWriter, attachments); }
From source file:org.cocktail.superplan.server.gestionimpression.TabularEdtReport.java
License:CeCILL license
public NSData genererPdf(NSArray creneaux, NSTimestamp debutSemaine, String semaine, String libelleFormation) throws DocumentException { ByteArrayOutputStream os = new ByteArrayOutputStream(); Document document = new Document(); PdfWriter.getInstance(document, os); document.open();/*from w w w . j a v a2s. com*/ document.setMargins(0, 0, 0, 0); Font font = new Font(Font.TIMES_ROMAN, 12, Font.BOLD, Color.DARK_GRAY); PdfPTable headerTable = new PdfPTable(1); PdfPCell cell = new PdfPCell(); Phrase ph = new Phrase(); ph.add(new Chunk(libelleFormation, font)); cell.setPhrase(ph); cell.setHorizontalAlignment(Element.ALIGN_CENTER); headerTable.addCell(cell); font = new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, Color.DARK_GRAY); cell = new PdfPCell(); ph = new Phrase(); ph.add(new Chunk(semaine, font)); cell.setPhrase(ph); cell.setHorizontalAlignment(Element.ALIGN_CENTER); headerTable.addCell(cell); headerTable.setWidthPercentage(100); headerTable.setSpacingAfter(5.0f); document.add(headerTable); PdfPTable pdfTable = creerCreneauxTable(creneaux, debutSemaine); pdfTable.setWidthPercentage(100); document.add(pdfTable); document.close(); return new NSData(os.toByteArray()); }
From source file:org.cocktail.superplan.server.gestionimpression.TabularEdtReport.java
License:CeCILL license
public void ecrireCreneauxJour(String nomJour, NSArray creneaux, NSTimestamp date, PdfPTable pdfTable) { PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(Color.YELLOW); Phrase ph = new Phrase(); ph.add(new Chunk(nomJour, BOLD_ITALIC)); cell.setPhrase(ph); pdfTable.addCell(cell);//from w w w .ja va 2 s .co m cell = new PdfPCell(); ph = new Phrase(); ph.add(new Chunk(FormatHandler.dateToStr(date, FORMAT_DATE), BOLD_ITALIC)); cell.setPhrase(ph); cell.setColspan(3); pdfTable.addCell(cell); Object obj; for (int i = 0; i < creneaux.count(); i++) { obj = creneaux.objectAtIndex(i); if (obj instanceof NSArray) { for (int j = 0; j < ((NSArray) obj).count(); j++) { ecrireCreneau((NSDictionary) ((NSArray) obj).objectAtIndex(j), pdfTable); } } else { ecrireCreneau((NSDictionary) obj, pdfTable); } } }
From source file:org.jsondoc.springmvc.pdf.PdfExportView.java
License:Open Source License
public File getPdfFile(String filename) { try {/*from w w w . ja va 2 s. co m*/ File file = new File(filename + "-v" + jsonDoc.getVersion() + FILE_EXTENSION); FileOutputStream fileout = new FileOutputStream(file); Document document = new Document(); PdfWriter.getInstance(document, fileout); // Header HeaderFooter header = new HeaderFooter(new Phrase("Copyright " + Calendar.getInstance().get(Calendar.YEAR) + " Paybay Networks - All rights reserved"), false); header.setBorder(Rectangle.NO_BORDER); header.setAlignment(Element.ALIGN_LEFT); document.setHeader(header); // Footer HeaderFooter footer = new HeaderFooter(new Phrase("Page "), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); document.setFooter(footer); document.open(); //init documentation apiDocs = buildApiDocList(); apiMethodDocs = buildApiMethodDocList(apiDocs); Phrase baseUrl = new Phrase("Base url: " + jsonDoc.getBasePath()); document.add(baseUrl); document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); int pos = 1; for (ApiMethodDoc apiMethodDoc : apiMethodDocs) { Phrase phrase = new Phrase(/*"Description: " + */apiMethodDoc.getDescription()); document.add(phrase); document.add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(2); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.setWidthPercentage(100); table.setWidths(new int[] { 50, 200 }); // HEADER CELL START TABLE table.addCell(ITextUtils.getHeaderCell("URL")); table.addCell(ITextUtils.getHeaderCell("<baseUrl> " + apiMethodDoc.getPath())); table.completeRow(); // FIRST CELL table.addCell(ITextUtils.getCell("Http Method", 0)); table.addCell(ITextUtils.getCell(apiMethodDoc.getVerb().name(), pos)); pos++; table.completeRow(); // PRODUCES if (!apiMethodDoc.getProduces().isEmpty()) { table.addCell(ITextUtils.getCell("Produces", 0)); table.addCell(ITextUtils.getCell(buildApiMethodProduces(apiMethodDoc), pos)); pos++; table.completeRow(); } // CONSUMES if (!apiMethodDoc.getConsumes().isEmpty()) { table.addCell(ITextUtils.getCell("Consumes", 0)); table.addCell(ITextUtils.getCell(buildApiMethodConsumes(apiMethodDoc), pos)); pos++; table.completeRow(); } // HEADERS if (!apiMethodDoc.getHeaders().isEmpty()) { table.addCell(ITextUtils.getCell("Request headers", 0)); PdfPTable pathParamsTable = new PdfPTable(3); pathParamsTable.setWidths(new int[] { 30, 20, 40 }); pathParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); pathParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiHeaderDoc apiHeaderDoc : apiMethodDoc.getHeaders()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiHeaderDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); StringBuilder builder = new StringBuilder(); for (String value : apiHeaderDoc.getAllowedvalues()) builder.append(value).append(", "); paramCell.setPhrase(new Phrase("Allowed values: " + builder.toString())); paramCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase(apiHeaderDoc.getDescription())); pathParamsTable.addCell(paramCell); pathParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(pathParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // PATH PARAMS if (!apiMethodDoc.getPathparameters().isEmpty()) { table.addCell(ITextUtils.getCell("Path params", 0)); PdfPTable pathParamsTable = new PdfPTable(3); pathParamsTable.setWidths(new int[] { 30, 15, 40 }); pathParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); pathParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiParamDoc apiParamDoc : apiMethodDoc.getPathparameters()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiParamDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); paramCell.setPhrase(new Phrase(apiParamDoc.getJsondocType().getOneLineText())); paramCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase(apiParamDoc.getDescription())); pathParamsTable.addCell(paramCell); pathParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(pathParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // QUERY PARAMS if (!apiMethodDoc.getQueryparameters().isEmpty()) { table.addCell(ITextUtils.getCell("Query params", 0)); PdfPTable queryParamsTable = new PdfPTable(3); queryParamsTable.setWidths(new int[] { 30, 15, 40 }); queryParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); queryParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiParamDoc apiParamDoc : apiMethodDoc.getQueryparameters()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiParamDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); queryParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); paramCell.setPhrase(new Phrase(apiParamDoc.getJsondocType().getOneLineText())); paramCell.setBorder(Rectangle.NO_BORDER); queryParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase( apiParamDoc.getDescription() + ", mandatory: " + apiParamDoc.getRequired())); queryParamsTable.addCell(paramCell); queryParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(queryParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // BODY OBJECT if (null != apiMethodDoc.getBodyobject()) { table.addCell(ITextUtils.getCell("Body object:", 0)); String jsonObject = buildJsonFromTemplate(apiMethodDoc.getBodyobject().getJsondocTemplate()); table.addCell(ITextUtils.getCell(jsonObject, pos)); pos++; table.completeRow(); } // RESPONSE OBJECT table.addCell(ITextUtils.getCell("Json response:", 0)); table.addCell( ITextUtils.getCell(apiMethodDoc.getResponse().getJsondocType().getOneLineText(), pos)); pos++; table.completeRow(); // RESPONSE STATUS CODE table.addCell(ITextUtils.getCell("Status code:", 0)); table.addCell(ITextUtils.getCell(apiMethodDoc.getResponsestatuscode(), pos)); pos++; table.completeRow(); table.setSpacingAfter(10f); table.setSpacingBefore(5f); document.add(table); } document.close(); return file; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return null; }
From source file:org.oscarehr.web.reports.ocan.IndividualNeedRatingOverTimeReportGenerator.java
License:Open Source License
private PdfPCell makeCell(Phrase phrase, int alignment) { PdfPCell c2 = new PdfPCell(); c2.setPhrase(phrase); c2.setHorizontalAlignment(alignment); c2.setBorder(0);// w w w.j a v a2 s .com return c2; }
From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java
License:Open Source License
private void addSummaryOfNeedsHeader(PdfPTable summaryOfNeedsTable, List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList, int loopNo) { PdfPCell headerCell = new PdfPCell(); headerCell.setPhrase(new Phrase("Summary of Needs" + (loopNo > 1 ? " (Contd.)" : ""), new Font(Font.HELVETICA, 20, Font.BOLD))); headerCell.setColspan(currentBeanList.size() * 3); headerCell.setVerticalAlignment(Element.ALIGN_TOP); headerCell.setBorder(0);/* ww w .j a va 2s . c o m*/ headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(headerCell); Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE); //row1 PdfPCell c2 = null; c2 = new PdfPCell(); c2.setBorder(0); summaryOfNeedsTable.addCell(c2); if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } //row2 c2 = new PdfPCell(); c2.setBorder(0); summaryOfNeedsTable.addCell(c2); if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } }
From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java
License:Open Source License
private void addSummaryOfNeedsDomainHeader(PdfPTable summaryOfNeedsTable, List<OcanNeedRatingOverTimeNeedBreakdownBean> currentBeanList, int loopNo) { Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE); //row1//from www .j a va 2 s .co m PdfPCell c2 = null; c2 = new PdfPCell(); c2.setBorder(0); summaryOfNeedsTable.addCell(c2); if (loopNo > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } //row2 c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Domains", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); if (loopNo > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } }