List of usage examples for com.itextpdf.text.pdf PdfPTable getDefaultCell
public PdfPCell getDefaultCell()
PdfPCell
that will be used as reference for all the addCell
methods except addCell(PdfPCell)
. From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial6(List<TbMaterial> tbMaterials6, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*from ww w .j a v a 2s . co m*/ PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.6 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials6) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial7(List<TbMaterial> tbMaterials7, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*from www . j a va2 s .c om*/ PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.7 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials7) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial8(List<TbMaterial> tbMaterials8, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*from ww w . j a va2s. c o m*/ PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.8 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials8) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial9(List<TbMaterial> tbMaterials9, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);//from w ww . j ava 2s.c o m PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.9 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials9) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial10(List<TbMaterial> tbMaterials10, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);//from w w w. j av a2 s . co m PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.10 ???", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials10) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial11(List<TbMaterial> tbMaterials11, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*from w w w. j av a 2 s . c o m*/ PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.11 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials11) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtablePublicutility(List<TbPublicutility> tbPublicutilitys, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*from w w w . j a v a 2 s. c o m*/ PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("4.1 ?", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbPublicutility items : tbPublicutilitys) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getPubEle(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubWater(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubTel(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubEms(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubOther(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubSum(), font))); } return table; }
From source file:com.softwaremagico.tm.pdf.complete.characteristics.CharacteristicColumn.java
License:Open Source License
private PdfPCell createContent(CharacterPlayer characterPlayer, List<CharacteristicDefinition> content) { float[] widths = { 3f, 1f, 0.1f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); for (CharacteristicDefinition characteristic : content) { Paragraph paragraph = new Paragraph(); paragraph.add(new Paragraph(getTranslator().getTranslatedText(characteristic.getId()), new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))); paragraph.add(new Paragraph(" (", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))); if (characterPlayer == null) { paragraph.add(new Paragraph(GAP, new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))); } else {// w w w .java2 s . c om paragraph.add( new Paragraph(characterPlayer.getStartingValue(characteristic.getCharacteristicName()) + "", new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme .getHandWrittingFontSize(FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)))); } paragraph.add(new Paragraph(")", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))); PdfPCell characteristicTitle = new PdfPCell(paragraph); characteristicTitle.setBorder(0); characteristicTitle.setMinimumHeight(ROW_WIDTH / content.size()); table.addCell(characteristicTitle); // Rectangle if (characterPlayer == null) { table.addCell(createRectangle()); } else { table.addCell(createRectangle(characterPlayer.getValue(characteristic.getCharacteristicName()) + getCharacteristicSpecialRepresentation(characterPlayer, characteristic.getCharacteristicName()))); } // Margin PdfPCell margin = new PdfPCell(); margin.setBorder(0); table.addCell(margin); } PdfPCell cell = new PdfPCell(); cell.addElement(table); BaseElement.setCellProperties(cell); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.characteristics.CharacteristicsTableFactory.java
License:Open Source License
public static PdfPTable getCharacteristicsBasicsTable(CharacterPlayer characterPlayer) { float[] widths = { 1f, 1f, 1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/* ww w. j a va 2 s . c om*/ PdfPCell separator = createSeparator(); separator.setColspan(widths.length); table.addCell(separator); Phrase content = new Phrase(getTranslator().getTranslatedText("characteristics").toUpperCase(), new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.TITLE_FONT_SIZE)); PdfPCell titleCell = new PdfPCell(content); setCellProperties(titleCell); titleCell.setColspan(widths.length); titleCell.setHorizontalAlignment(Element.ALIGN_CENTER); titleCell.setFixedHeight(30); table.addCell(titleCell); table.getDefaultCell().setPadding(0); for (CharacteristicType type : CharacteristicType.values()) { try { table.addCell(new CharacteristicColumn(characterPlayer, type, CharacteristicsDefinitionFactory.getInstance().getAll(type, Translator.getLanguage()))); } catch (NullPointerException npe) { PdfExporterLog.errorMessage(CharacteristicsTableFactory.class.getName(), npe); } } return table; }
From source file:com.softwaremagico.tm.pdf.complete.CharacterSheet.java
License:Open Source License
private PdfPTable createRearTable() throws InvalidXmlElementException { PdfPTable mainTable = new PdfPTable(REAR_TABLE_WIDTHS); mainTable.getDefaultCell().setBorder(0); mainTable.setWidthPercentage(100);//from w w w . ja v a 2s . com 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_ROWS)); psiCell.setColspan(2); mainTable.addCell(psiCell); mainTable.addCell(BaseElement.createBigSeparator(90)); mainTable.addCell(separatorCell); PdfPTable othersTable = new OthersTable(); mainTable.addCell(othersTable); PdfPCell cyberneticsCell = new PdfPCell(new CyberneticsTable(characterPlayer)); cyberneticsCell.setColspan(2); mainTable.addCell(cyberneticsCell); return mainTable; }