List of usage examples for com.itextpdf.text.pdf PdfPCell setRowspan
public void setRowspan(int rowspan)
From source file:com.netsteadfast.greenstep.bsc.command.PersonalReportPdfCommand.java
License:Apache License
private void createFoot(PdfPTable table, Context context) throws Exception { String bgColor = "#ffffff"; String fnColor = "#000000"; PdfPCell cell = new PdfPCell(); cell.addElement(new Phrase("assess:", this.getFont(fnColor, true))); cell.setColspan(1);/*w w w . java 2 s .c om*/ cell.setRowspan(2); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); this.setCellBackgroundColor(cell, bgColor); table.addCell(cell); cell = new PdfPCell(); cell.addElement( new Phrase(BscReportPropertyUtils.getPersonalReportClassLevel(), this.getFont(fnColor, true))); cell.setColspan(3); cell.setRowspan(2); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); this.setCellBackgroundColor(cell, bgColor); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Total", this.getFont(fnColor, true))); cell.setColspan(1); cell.setRowspan(1); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); this.setCellBackgroundColor(cell, bgColor); table.addCell(cell); float total = 0.0f; if (context.get("total") != null && context.get("total") instanceof Float) { total = (Float) context.get("total"); } cell = new PdfPCell(); cell.addElement(new Phrase(BscReportSupportUtils.parse2(total), this.getFont(fnColor, true))); cell.setColspan(1); cell.setRowspan(1); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); this.setCellBackgroundColor(cell, bgColor); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Class", this.getFont(fnColor, true))); cell.setColspan(1); cell.setRowspan(1); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); this.setCellBackgroundColor(cell, bgColor); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(" ", this.getFont(fnColor, true))); cell.setColspan(1); cell.setRowspan(1); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); this.setCellBackgroundColor(cell, bgColor); table.addCell(cell); }
From source file:com.norbsoft.pdfconverter.helpers.PDFHelper.java
License:Open Source License
private PdfPTable signTable(Form form, Image sgn, ArrayList<String> workers) { int cellPadding = 5; PdfPTable table = new PdfPTable(2); table.setSpacingBefore(15);/* ww w . j ava 2 s . c om*/ PdfPCell cell = new PdfPCell(new Paragraph("Data i podpis klienta: ", normal)); cell.setPadding(cellPadding); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Paragraph("Wykonali pracownicy: ", normal)); cell.setPadding(cellPadding); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(sgn); cell.setRowspan(workers.size()); cell.setPadding(cellPadding); cell.setBorder(0); table.addCell(cell); for (int i = 0; i < workers.size(); i++) { cell = new PdfPCell(new Paragraph(workers.get(i), normal)); cell.setPadding(cellPadding); cell.setBorder(0); table.addCell(cell); } table.setWidthPercentage(90); return table; }
From source file:com.pdfwriter.PrintInventoryReport.java
public void create(ObservableList list, String totalSales) { try {/*from w ww. j a v a2s . c o m*/ Document document = new Document(PageSize.LETTER); document.setMargins(1, 1, 1, 1); PdfWriter.getInstance(document, new FileOutputStream(filename)); document.open(); Font font2 = new Font(Font.FontFamily.UNDEFINED, 10, Font.BOLD); PdfPTable table = new PdfPTable(5); table.setWidthPercentage(95); table.setWidths(new int[] { 40, 40, 40, 40, 40 }); PdfPCell cell; cell = new PdfPCell(new Phrase("", font2)); cell.setBorder(0); cell.setColspan(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(0); cell.setBorderWidthBottom(0); table.addCell(cell); cell = new PdfPCell( new Phrase("KELNOVI SHOPPING BOTIQUE", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell( new Phrase("Pondol,Loon, Bohol", new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell( new Phrase("Phone/Fax#:000-000-000", new Font(Font.FontFamily.UNDEFINED, 9, Font.UNDERLINE))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("SALES REPORT", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("NO.")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("PRODUCT NAME")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("PRICE")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("QUANTITY")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("AMOUNT PAYABLE")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); for (int i = 0; i < list.size(); i++) { it = (ProductClass) list.get(i); cell = new PdfPCell(new Phrase("" + it.idProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); cell = new PdfPCell(new Phrase("" + it.productDescriptionProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); cell = new PdfPCell(new Phrase("" + it.productPriceProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); cell = new PdfPCell(new Phrase("" + it.productQtyProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); //totalSales.setText(String.format("%,.2f",globalSales)); cell = new PdfPCell(new Phrase( String.format("%,.2f", Double.parseDouble(it.productTotalSalesProperty().get())))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); } cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("TOTAL AMOUNT PAYABLE:")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell( new Phrase("Php " + totalSales, new Font(Font.FontFamily.UNDEFINED, 14, Font.UNDERLINE))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("Approved by:")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("MICHAEL NOVI MALUENDA II", new Font(Font.FontFamily.UNDEFINED, 14, Font.UNDERLINE))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("General Manager")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); document.add(table); document.close(); openFile(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.softwaremagico.tm.pdf.complete.CharacterSheet.java
License:Open Source License
private PdfPTable createRearTablePsiExtended() throws InvalidXmlElementException { PdfPTable mainTable = new PdfPTable(REAR_TABLE_WIDTHS); mainTable.getDefaultCell().setBorder(0); mainTable.setWidthPercentage(100);/*from ww w. j a v a 2 s . co m*/ mainTable.addCell(new DescriptionTable(characterPlayer)); PdfPCell cell = new PdfPCell(new AnnotationsTable()); cell.setBorderWidth(0); cell.setColspan(2); mainTable.addCell(cell); PdfPCell blackSeparator = BaseElement.createBigSeparator(90); mainTable.addCell(blackSeparator); PdfPCell separatorCell = new PdfPCell(BaseElement.createWhiteSeparator()); separatorCell.setColspan(2); mainTable.addCell(separatorCell); mainTable.addCell(new PropertiesTable(characterPlayer)); PdfPCell psiCell = new PdfPCell(new OccultismsPowerTable(characterPlayer, PSI_EXTENDED_ROWS)); psiCell.setColspan(2); psiCell.setRowspan(3); mainTable.addCell(psiCell); mainTable.addCell(BaseElement.createBigSeparator(90)); PdfPTable othersTable = new OthersTable(); mainTable.addCell(othersTable); return mainTable; }
From source file:com.softwaremagico.tm.pdf.complete.elements.CustomPdfTable.java
License:Open Source License
protected PdfPCell createTitle(String title, int fontSize) { PdfPCell titleCell = createCompactTitle(title, fontSize); titleCell.setRowspan(2); return titleCell; }
From source file:com.softwaremagico.tm.pdf.complete.elements.LateralHeaderPdfPTable.java
License:Open Source License
protected PdfPCell createLateralVerticalTitle(String title, int rowspan) { Font font = new Font(FadingSunsTheme.getTitleFont(), getTitleFontSize()); font.setColor(BaseColor.WHITE);/* ww w .j ava2 s .c o m*/ Phrase content = new Phrase(title, font); PdfPCell titleCell = new PdfPCell(content); titleCell.setPadding(0); titleCell.setRowspan(rowspan); titleCell.setRotation(90); titleCell.setHorizontalAlignment(Element.ALIGN_CENTER); // titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); titleCell.setBackgroundColor(BaseColor.BLACK); return titleCell; }
From source file:com.softwaremagico.tm.pdf.complete.fighting.WeaponsAndArmours.java
License:Open Source License
public static PdfPTable getWeaponsAndArmoursTable(CharacterPlayer characterPlayer) throws InvalidXmlElementException { float[] widths = { 4f, 1.1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/* w ww . j av a2 s . c om*/ table.getDefaultCell().setPadding(PADDING); table.getDefaultCell().setBorder(0); PdfPTable leftTable = new PdfPTable(new float[] { 1f }); setTablePropierties(leftTable); leftTable.getDefaultCell().setBorder(0); leftTable.getDefaultCell().setPadding(0); PdfPCell fireArmsCell = new PdfPCell(new WeaponsTable(characterPlayer)); leftTable.addCell(fireArmsCell); PdfPTable stancesXpTable = new PdfPTable(new float[] { 4f, 1f }); setTablePropierties(stancesXpTable); stancesXpTable.getDefaultCell().setBorder(0); stancesXpTable.getDefaultCell().setPadding(0); PdfPCell stancesCell = new PdfPCell(new StancesTable(characterPlayer)); stancesXpTable.addCell(stancesCell); PdfPCell experienceCell = new PdfPCell(new ExperienceTable(characterPlayer)); stancesXpTable.addCell(experienceCell); leftTable.addCell(stancesXpTable); PdfPCell leftCell = new PdfPCell(leftTable); leftCell.setRowspan(2); table.addCell(leftCell); PdfPCell armourCell = new PdfPCell(new ArmourTable(characterPlayer)); table.addCell(armourCell); PdfPCell shieldCell = new PdfPCell(new ShieldTable(characterPlayer)); table.addCell(shieldCell); return table; }
From source file:com.softwaremagico.tm.pdf.complete.skills.CompleteSkillsTable.java
License:Open Source License
private static PdfPCell getThirdColumnTable(CharacterPlayer characterPlayer, String language, Stack<PdfPCell> learnedSkillsRows) throws InvalidXmlElementException { float[] widths = { 4f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);//from www. j a v a 2 s . co m PdfPCell cell = new PdfPCell(); setCellProperties(cell); for (int i = 0; i < ROWS - OCCULTISM_ROWS; i++) { // Two columns: skill and value. table.addCell(learnedSkillsRows.pop()); table.addCell(learnedSkillsRows.pop()); } // Add Occultism table PdfPTable occultismTable = new OccultismTable(characterPlayer, language); PdfPCell occulstimCell = new PdfPCell(); // setCellProperties(occulstimCell); // occulstimCell.setRowspan(widths.length); occulstimCell.setRowspan(OCCULTISM_ROWS); occulstimCell.setColspan(2); occulstimCell.addElement(occultismTable); occulstimCell.setVerticalAlignment(Element.ALIGN_BOTTOM); occulstimCell.setPadding(0); table.addCell(occulstimCell); cell.addElement(table); cell.setVerticalAlignment(Element.ALIGN_TOP); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.skills.CounterTable.java
License:Open Source License
protected PdfPCell space(int rowspan) { PdfPCell emptyCell = new PdfPCell(); emptyCell.setRowspan(rowspan); emptyCell.setBorder(0);/*from ww w .j a va 2 s. c o m*/ return emptyCell; }
From source file:com.softwaremagico.tm.pdf.complete.traits.MainPerksTableFactory.java
License:Open Source License
public static PdfPTable getPerksTable(CharacterPlayer characterPlayer) { float[] widths = { 4f, 0.1f, 4f, 0.1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/* w w w . jav a 2s . co m*/ table.getDefaultCell().setPadding(PADDING); PdfPCell whiteSeparator = createWhiteSeparator(); whiteSeparator.setColspan(widths.length); table.addCell(whiteSeparator); PdfPCell blackSeparator = createBlackSeparator(); whiteSeparator.setColspan(1); table.addCell(blackSeparator); table.addCell(whiteSeparator); table.addCell(blackSeparator); table.addCell(whiteSeparator); PdfPCell victoryPointsCell = new PdfPCell(new VictoryPointsTable()); victoryPointsCell.setPadding(0); victoryPointsCell.setRowspan(2); table.addCell(victoryPointsCell); PdfPCell blessingCell = new PdfPCell(new BlessingTable(characterPlayer)); blessingCell.setPadding(0); blessingCell.setBorder(0); table.addCell(blessingCell); table.addCell(whiteSeparator); PdfPCell perksCell = new PdfPCell(new BeneficesTable(characterPlayer)); perksCell.setPadding(0); perksCell.setBorder(0); table.addCell(perksCell); table.addCell(whiteSeparator); return table; }