private PdfPTable cuerpoSol(final List<VUSolicitud> listSol) throws DocumentException { final PdfPTable body = new PdfPTable(5); body.setWidthPercentage(95); final Map<String, Object> mapConfig = this.getMapSol(); // pinta los header de la tabla for (final String header : VUTramConstants.listHeRep) { body.addCell(this.constCelda(header, mapConfig)); } for (final VUSolicitud solicitud : listSol) { body.addCell(this.constCeldaR(solicitud.getFolio(), mapConfig)); body.addCell(this.constCeldaR(solicitud.getTramite().getDescDeptoTram(), mapConfig)); body.addCell(this.constCeldaR(solicitud.getTramite().getDescTram(), mapConfig)); body.addCell(this.constCeldaR(solicitud.getFecView(), mapConfig)); body.addCell(this.constCeldaR(solicitud.getEstSol().getDescEst(), mapConfig)); body.completeRow(); } PdfPCell celdaValor = new PdfPCell(new Phrase("")); celdaValor.setColspan(50); celdaValor.setBorder(0); body.addCell(celdaValor); return body; }
private void addSaleData(Document document, Examination examination) throws DocumentException { PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100); table.setSpacingBefore(10); table.setSpacingAfter(10); table.setWidths(new int[] {7, 5, 2, 2}); table.addCell(getCell("Csoport", Element.ALIGN_CENTER, boldtableHeaderFont)); table.addCell(getCell("Megjegyzés", Element.ALIGN_CENTER, boldtableHeaderFont)); table.addCell(getCell("Ár", Element.ALIGN_CENTER, boldtableHeaderFont)); table.addCell(getCell("Összesen", Element.ALIGN_CENTER, boldtableHeaderFont)); for (InvoiceGroups invoiceGroup : examination.getInvoice().getInvoiceGroup()) { PdfPCell invoiceGroupCell = getCell(invoiceGroup.getName(), Element.ALIGN_LEFT, boldDataFont); invoiceGroupCell.setColspan(3); table.addCell(invoiceGroupCell); table.addCell( getCell(invoiceGroup.getNetPrice().toString(), Element.ALIGN_LEFT, boldDataFont)); if (invoiceGroup.getItems() != null && invoiceGroup.getItems().size() != 0) { for (Item item : invoiceGroup.getItems()) { table.addCell(getCell("", Element.ALIGN_LEFT, dataFont)); table.addCell(getCell(item.getDescription(), Element.ALIGN_LEFT, dataFont)); table.addCell(getCell(item.getPrice().toString(), Element.ALIGN_LEFT, dataFont)); table.addCell(getCell("", Element.ALIGN_LEFT, dataFont)); } } } document.add(table); }
public static void main(String[] args) throws IOException, DocumentException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("results/simple_rowspan_colspan.pdf")); document.open(); PdfPTable table = new PdfPTable(5); table.setWidths(new int[] {1, 2, 2, 2, 1}); PdfPCell cell; cell = new PdfPCell(new Phrase("S/N")); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("Name")); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("Age")); cell.setRowspan(2); table.addCell(cell); table.addCell("SURNAME"); table.addCell("FIRST NAME"); table.addCell("MIDDLE NAME"); table.addCell("1"); table.addCell("James"); table.addCell("Fish"); table.addCell("Stone"); table.addCell("17"); document.add(table); document.close(); }
public void createTable(Section subCatPart) throws BadElementException { PdfPTable table = new PdfPTable(3); // t.setBorderColor(BaseColor.GRAY); // t.setPadding(4); // t.setSpacing(4); // t.setBorderWidth(1); PdfPCell c1 = new PdfPCell(new Phrase("Table Header 1")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Table Header 2")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Table Header 3")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); table.addCell("1.0"); table.addCell("1.1"); table.addCell("1.2"); table.addCell("2.1"); table.addCell("2.2"); table.addCell("2.3"); subCatPart.add(table); }
public PdfPCell getPdfPCellAligned(String chunk, int font, int val) { PdfPCell pdfPCell = new PdfPCell(new Phrase(chunk, FontFactory.getFont(FontFactory.TIMES_ROMAN, 16, font))); pdfPCell.setBorder(pdfPCell.NO_BORDER); pdfPCell.setPaddingLeft(val); return pdfPCell; }
private static PdfPCell emptyPdfPCell() { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Rectangle.ALIGN_MIDDLE); cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); cell.setFixedHeight(19f); // cell.setBorderWidth(1); return cell; }
private PdfPCell constCelda(final String valorCelda, final Map<String, Object> mapCarac) { final PdfPCell cellCuerpoHeader = new PdfPCell(new Paragraph(valorCelda, (Font) mapCarac.get(VUTramConstants.KEY_COLORF))); cellCuerpoHeader.setHorizontalAlignment(Element.ALIGN_CENTER); cellCuerpoHeader.setBackgroundColor((BaseColor) mapCarac.get(VUTramConstants.KEY_COLORH)); cellCuerpoHeader.setBorder(Rectangle.NO_BORDER); return cellCuerpoHeader; }
public static void clearTable(PdfPTable table, boolean resetFixedHeight) { for (PdfPCell cell : table.getRow(0).getCells()) { cell.setColumn(createColumnText()); if (resetFixedHeight) { cell.setFixedHeight(-1.0f); } } }
/** This is a convenience function to make it easy to fill up the remaining table cells. */ private void fillNullCells() { int itemsToAdd = 4 - (_itemsAdded % 4); while (itemsToAdd > 0) { PdfPCell c = new PdfPCell(); c.setBorder(0); _table.addCell(c); itemsToAdd--; } }
private PdfPCell getHeaderCell(String name) { PdfPCell cell = new PdfPCell( new Phrase(name, FontFactory.getFont(FontFactory.TIMES_BOLD, 10, BaseColor.BLACK))); cell.setBorderColor(BaseColor.GRAY); cell.setBorderWidth(1); cell.setPadding(5); return cell; }
private PdfPCell getPartyAddress(String who, String name, String city, String address) { PdfPCell cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.addElement(new Paragraph(who, boldDataFont)); cell.addElement(new Paragraph(name, dataFont)); cell.addElement(new Paragraph(city, dataFont)); cell.addElement(new Paragraph(address, dataFont)); return cell; }
private PdfPTable buildInfos(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(new float[] {1, 2}); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("NATURE DES FAITS: ", FONT_BOLD)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); if (fiche.getFaits() != null && !fiche.getFaits().isEmpty()) { String libelleFaits = ""; for (Fait fait : fiche.getFaits()) { libelleFaits += (("".equals(libelleFaits)) ? "" : ", ") + fait.getNombre() + " " + fait.getNature().getLibelleCourt(); } cell = new PdfPCell(new Phrase(libelleFaits, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } else { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } cell = new PdfPCell(new Phrase("Quartier: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColorBottom(BaseColor.WHITE); table.addCell(cell); cell = new PdfPCell(new Phrase(fiche.getAdresse().getQuartier().getLibelle(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Secteur: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColorTop(BaseColor.WHITE); table.addCell(cell); cell = new PdfPCell( new Phrase(fiche.getAdresse().getQuartier().getSecteur().getLibelle(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
/** * Creates a PdfPCell with the name of the month * * @param calendar a date * @param locale a locale * @return a PdfPCell with rowspan 7, containing the name of the month */ public PdfPCell getMonthCell(Calendar calendar, Locale locale) { PdfPCell cell = new PdfPCell(); cell.setColspan(7); cell.setBorder(PdfPCell.NO_BORDER); cell.setUseDescender(true); Paragraph p = new Paragraph(String.format(locale, "%1$tB %1$tY", calendar), bold); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); return cell; }
private PdfPCell getCell(String value, int alignment, Font font) { PdfPCell cell = new PdfPCell(); cell.setUseAscender(true); cell.setUseDescender(true); Paragraph p = new Paragraph(value, font); p.setAlignment(alignment); cell.addElement(p); return cell; }
private PdfPTable buildSearchParams(Map<String, String> searchParams) throws DocumentException { PdfPTable table = new PdfPTable(2); int[] widths = {18, 82}; table.setWidths(widths); table.setWidthPercentage(100); if (searchParams.keySet().isEmpty()) return table; PdfPCell cell = new PdfPCell(new Phrase("Filtres", FONT_PARAM_BOLD)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); for (String key : searchParams.keySet()) { cell = new PdfPCell(new Phrase(key, FONT_PARAM)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(searchParams.get(key), FONT_PARAM)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); } table.setSpacingAfter(10); return table; }
public PdfPCell getPdfPCellInJustified(String chunk) { PdfPCell pdfPCell = null; if (chunk != null) { pdfPCell = new PdfPCell(new Paragraph(new Chunk(chunk, getFont(chunk)))); } else { pdfPCell = new PdfPCell(new Paragraph()); } pdfPCell.setBorder(pdfPCell.NO_BORDER); pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED); return pdfPCell; }
void add(String name, PdfPTable table1, int n) { PdfPCell c5 = new PdfPCell(new Phrase(name, new Font(FontFamily.TIMES_ROMAN, 14, Font.BOLD))); c5.setHorizontalAlignment(n); c5.setPaddingTop(25); c5.setFixedHeight(60f); table1.addCell(c5); PdfPCell c6 = new PdfPCell(new Phrase(" ", new Font(FontFamily.TIMES_ROMAN, 14, Font.BOLD))); table1.addCell(c6); PdfPCell c7 = new PdfPCell(new Phrase(" ", new Font(FontFamily.TIMES_ROMAN, 14, Font.BOLD))); table1.addCell(c7); }
public void createPdf(String dest) throws IOException, DocumentException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); PdfPTable table = new PdfPTable(8); PdfPCell cell = new PdfPCell(new Phrase("hi")); cell.setRowspan(2); table.addCell(cell); for (int aw = 0; aw < 14; aw++) { table.addCell("hi"); } document.add(table); document.close(); }
private PdfPTable getHeader() throws DocumentException, IOException { PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); Image image = Image.getInstance(getClass().getResource("/images/SLA_header.png")); image.scalePercent(42); PdfPCell cell = new PdfPCell(image); cell.setBorder(0); cell.setPadding(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); return table; }
private void addCellToTable(PdfPTable table, String content, BaseColor color, boolean header) { Phrase phrase = new Phrase(content); PdfPCell cell = new PdfPCell(phrase); cell.setBorderWidth(1.5F); cell.setBackgroundColor(color); if (header) { phrase.setFont(FontFactory.getFont(FontFactory.HELVETICA_BOLD, 7)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); } else { phrase.setFont(FontFactory.getFont(FontFactory.HELVETICA, 7)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); } table.addCell(cell); }
/** * metodo che stampa la classifica su pdf * * @param ranks lista di coppie (squadra, punteggio) * @param isConcluse flag vero se la classifica � definitiva * @param doc documento pdf su cui stampare * @throws DocumentException sollevata quando si verificano errori di stampa su pdf */ private void printRanking(List<Pair<TeamEntity, Integer>> ranks, Boolean isConcluse, Document doc) throws DocumentException { // tabella pdf, 3 colonne PdfPTable table = new PdfPTable(3); // cella PdfPCell cell; // aggiungi le celle di intestazione table.setHeaderRows(1); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100); table.setWidths(new float[] {0.2f, 1, 0.2f}); table.addCell("Posizione"); table.addCell("Squadra"); table.addCell("Punteggio"); Integer position = 0; Integer oldPoints = Integer.MAX_VALUE; Integer newPoints; for (Iterator<Pair<TeamEntity, Integer>> it = ranks.iterator(); it.hasNext(); ) { Pair<TeamEntity, Integer> coppia = it.next(); newPoints = coppia.getSecond(); // se non � un parimerito avanza di posizione if (newPoints < oldPoints) { oldPoints = newPoints; position++; } // stampa la posizione table.addCell(position.toString()); // stampa il nome della squadra cell = new PdfPCell(new Phrase(coppia.getFirst().getName())); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); // stampa il punteggio table.addCell(newPoints.toString()); } // aggiungi il titolo al pdf doc.add( new Phrase( new Chunk( "\nClassifica " + (isConcluse ? "definitiva" : "provvisoria"), FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD)))); // aggiungi la tabella al pdf doc.add(table); }
public static SectionPdfPTable createLayoutTable( float width, float height, List<StyleColumnProperties> columnPropertiesList) { // create one row table which will layout section text int colCount = columnPropertiesList.size(); int relativeWidths[] = new int[colCount]; SectionPdfPTable table = new SectionPdfPTable(colCount); // add cells for (int i = 0; i < colCount; i++) { PdfPCell cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setPadding(0.0f); cell.setColumn(createColumnText()); cell.setFixedHeight(height >= 0.0f ? height : -1.0f); // apply styles to cell StyleColumnProperties columnProperties = columnPropertiesList.get(i); relativeWidths[i] = columnProperties.getRelWidth(); cell.setPaddingLeft( columnProperties.getStartIndent() != null ? columnProperties.getStartIndent() : 0.0f); cell.setPaddingRight( columnProperties.getEndIndent() != null ? columnProperties.getEndIndent() : 0.0f); table.addCell(cell); } replaceTableCells(table); // set width try { table.setWidths(relativeWidths); } catch (DocumentException e) { throw new XWPFConverterException(e); } table.setTotalWidth(width); table.setLockedWidth(true); return table; }
private PdfPTable footer() { PdfPTable footer = new PdfPTable(1); footer.setTotalWidth(523); Font colorLetra = new Font(); colorLetra.setColor(new BaseColor(Color.white)); colorLetra.setSize(8); PdfPCell cell = new PdfPCell( new Paragraph( messageSource.getMessage("generaPdf.pdf.DireccionPart1", null, Locale.getDefault()), colorLetra)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(new BaseColor(0, 0, 0)); footer.addCell(cell); cell = new PdfPCell( new Paragraph( messageSource.getMessage("generaPdf.pdf.DireccionPart2", null, Locale.getDefault()), colorLetra)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(new BaseColor(0, 0, 0)); footer.addCell(cell); cell = new PdfPCell( new Paragraph( messageSource.getMessage("generaPdf.pdf.DireccionPart3", null, Locale.getDefault()), colorLetra)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(new BaseColor(0, 0, 0)); footer.addCell(cell); return footer; }
public void createPdf(String dest) throws IOException, DocumentException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); PdfPTable table = new PdfPTable(2); PdfPCell cell = new PdfPCell(); Image image = Image.getInstance(IMG1); cell.setCellEvent(new TiledImageBackground(image)); cell.setFixedHeight(770); table.addCell(cell); cell = new PdfPCell(); image = Image.getInstance(IMG2); cell.setCellEvent(new TiledImageBackground(image)); cell.setFixedHeight(770); table.addCell(cell); document.add(table); document.close(); }
private static void insertCell( PdfPTable table, String text, int align, int colspan, Font font, int border) { // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), font)); // set the cell alignment cell.setHorizontalAlignment(align); // set the cell column span in case you want to merge two or more cells cell.setColspan(colspan); cell.setBorder(border); // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } // add the call to the table table.addCell(cell); }
public static void main(String[] args) throws IOException, DocumentException { Document document = new Document(PageSize.A4, 0, 0, 0, 0); PdfWriter.getInstance(document, new FileOutputStream("results/full_page_table.pdf")); document.open(); PdfPTable table = new PdfPTable(10); table.setWidthPercentage(100); table.setSpacingBefore(0f); table.setSpacingAfter(0f); // first row PdfPCell cell = new PdfPCell(new Phrase("DateRange")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPadding(5.0f); cell.setBackgroundColor(new BaseColor(140, 221, 8)); table.addCell(cell); table.addCell("Calldate"); table.addCell("Calltime"); table.addCell("Source"); table.addCell("DialedNo"); table.addCell("Extension"); table.addCell("Trunk"); table.addCell("Duration"); table.addCell("Calltype"); table.addCell("Callcost"); table.addCell("Site"); for (int i = 0; i < 100; i++) { table.addCell("date" + i); table.addCell("time" + i); table.addCell("source" + i); table.addCell("destination" + i); table.addCell("extension" + i); table.addCell("trunk" + i); table.addCell("dur" + i); table.addCell("toc" + i); table.addCell("callcost" + i); table.addCell("Site" + i); } document.add(table); document.close(); }
@Override protected void buildPdfDocument( Map<String, Object> model, Document doc, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception { // get data model which is passed by the Spring container Test test = (Test) model.get("test"); doc.add(new Paragraph(test.getName())); doc.add(new Paragraph(test.getMaterial().getName())); Set<TestAttribute> sta = test.getTestAttributs(); if (sta.size() > 0) { PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100.0f); table.setWidths(new float[] {1.0f}); table.setSpacingBefore(10); // define font for table header row Font font = FontFactory.getFont(FontFactory.HELVETICA); font.setColor(BaseColor.WHITE); // define table header cell PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(BaseColor.BLUE); cell.setPadding(5); // write table header cell.setPhrase(new Phrase("Test attribute type", font)); table.addCell(cell); cell.setPhrase(new Phrase("Value", font)); table.addCell(cell); for (TestAttribute ta : sta) { table.addCell(ta.getTypeTestAttr().getName()); table.addCell(ta.getValue()); } doc.add(table); } }
public void createPdf(String dest) throws IOException, DocumentException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); PdfPTable table = new PdfPTable(2); PdfPCell cell; cell = new PdfPCell(new Phrase("Name:")); table.addCell(cell); cell = new PdfPCell(); cell.setCellEvent(new MyCellField("name")); table.addCell(cell); cell = new PdfPCell(new Phrase("Address")); table.addCell(cell); cell = new PdfPCell(); cell.setCellEvent(new MyCellField("address")); table.addCell(cell); document.add(table); document.close(); }
private void getTransactionHeader(ArrayList<String> docList) throws DocumentException, IOException { // Paragraph paragraph = new Paragraph(15, "", new Font(getcalibri(), // 11,Font.UNDERLINE)); // paragraph.setAlignment(Element.ALIGN_CENTER); // document.add(new Chunk(paragraph, BOLD_UNDERLINED)); // paragraph.setAlignment(Element.ALIGN_RIGHT); Chunk underline = new Chunk("Document List", new Font(getcalibri(), 11, Font.BOLD)); underline.setUnderline(0.4f, -2f); // 0.1 thick, -2 y-location Paragraph paragraph = new Paragraph(25, underline); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); document.add(Chunk.NEWLINE); PdfPTable table21 = new PdfPTable(1); // table1.setWidths(new int[]{24, 24, 2}); table21.setTotalWidth(507); table21.setLockedWidth(true); table21.getDefaultCell().setFixedHeight(20); table21.getDefaultCell().setBorder(Rectangle.BOTTOM); table21.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); Iterator<String> it = docList.iterator(); int i = 1; while (it.hasNext()) { PdfPCell secondCell = new PdfPCell( new Phrase(25, i + ". " + it.next(), new Font(getcalibri(), 11, Font.NORMAL))); secondCell.setVerticalAlignment(PdfPCell.ALIGN_TOP); secondCell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); secondCell.setBorder(Rectangle.NO_BORDER); secondCell.setPadding(15); table21.addCell(secondCell); i++; } table21.writeSelectedRows(0, -1, 34, 700, writer.getDirectContent()); }
private InputStream generatePdf(List<Map<String, Object>> detailList) throws IOException, DocumentException { ByteArrayOutputStream output = new ByteArrayOutputStream(); Rectangle rectPageSize = new Rectangle(PageSize.A4); Document document = new Document(rectPageSize, STR_20, STR_20, STR_20, STR_20); PdfWriter.getInstance(document, output); document.open(); BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // 设置中文字体 com.itextpdf.text.Font headFont = new com.itextpdf.text.Font(bfChinese, STR_10, com.itextpdf.text.Font.BOLD); com.itextpdf.text.Font commonFont = new com.itextpdf.text.Font(bfChinese, STR_10, com.itextpdf.text.Font.NORMAL); // 设置字体大小 com.itextpdf.text.Font amtFont = new com.itextpdf.text.Font(bfChinese, STR_10, com.itextpdf.text.Font.BOLD); // 设置字体大小 amtFont.setColor(STR_39, STR_157, STR_94); float[] widths = { STR_0_1F, STR_0_15F, STR_0_15F, STR_0_15F, STR_0_15F, STR_0_15F, STR_0_15F, STR_0_15F }; PdfPTable table = new PdfPTable(widths); table.getDefaultCell().setBorder(1); PdfPCell cell; headStyle(headFont, table); if (detailList.size() == 0) { cell = new PdfPCell(new Paragraph(NO_RECORD, commonFont)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setColspan(STR_9); table.addCell(cell); } else { fillData(detailList, commonFont, amtFont, table); } document.add(table); document.close(); InputStream inputStream = new ByteArrayInputStream(output.toByteArray()); output.close(); return inputStream; }