List of usage examples for com.itextpdf.text Phrase Phrase
public Phrase(final float leading, final String string)
Phrase
with a certain leading and a certain String
. From source file:com.netsteadfast.greenstep.bsc.command.KpiReportPdfCommand.java
License:Apache License
private void createBody(PdfPTable table, VisionVO vision) throws Exception { Map<String, String> managementMap = BscKpiCode.getManagementMap(false); //Map<String, String> calculationMap = BscKpiCode.getCalculationMap(false); PdfPCell cell = null;// www . j a v a 2 s . c o m for (PerspectiveVO perspective : vision.getPerspectives()) { Image pImage = Image.getInstance(BscReportSupportUtils.getByteIconBase("PERSPECTIVES", perspective.getTarget(), perspective.getMin(), perspective.getScore(), "", "", 0)); pImage.setWidthPercentage(10f); String content = this.getItemsContent(perspective.getName(), perspective.getScore(), perspective.getWeight(), perspective.getTarget(), perspective.getMin()); cell = new PdfPCell(); cell.addElement(pImage); cell.addElement(new Phrase("\n" + content, this.getFont(perspective.getFontColor(), false))); this.setCellBackgroundColor(cell, perspective.getBgColor()); cell.setRowspan(perspective.getRow()); table.addCell(cell); for (ObjectiveVO objective : perspective.getObjectives()) { Image oImage = Image.getInstance(BscReportSupportUtils.getByteIconBase("OBJECTIVES", objective.getTarget(), objective.getMin(), objective.getScore(), "", "", 0)); oImage.setWidthPercentage(10f); content = this.getItemsContent(objective.getName(), objective.getScore(), objective.getWeight(), objective.getTarget(), objective.getMin()); cell = new PdfPCell(); cell.addElement(oImage); cell.addElement(new Phrase("\n" + content, this.getFont(objective.getFontColor(), false))); this.setCellBackgroundColor(cell, objective.getBgColor()); cell.setRowspan(objective.getRow()); table.addCell(cell); for (KpiVO kpi : objective.getKpis()) { /* content = this.getKpisContent( kpi, managementMap, calculationMap); */ Image kImage = Image.getInstance(BscReportSupportUtils.getByteIconBase("KPI", kpi.getTarget(), kpi.getMin(), kpi.getScore(), kpi.getCompareType(), kpi.getManagement(), kpi.getQuasiRange())); kImage.setWidthPercentage(10f); content = this.getKpisContent(kpi, managementMap); cell = new PdfPCell(); cell.addElement(kImage); cell.addElement(new Phrase("\n" + content, this.getFont(kpi.getFontColor(), false))); this.setCellBackgroundColor(cell, kpi.getBgColor()); table.addCell(cell); } } } }
From source file:com.netsteadfast.greenstep.bsc.command.KpiReportPdfCommand.java
License:Apache License
private void createDateRange(PdfPTable table, VisionVO vision, Context context, int maxRows) throws Exception { String frequency = (String) context.get("frequency"); String startYearDate = StringUtils.defaultString((String) context.get("startYearDate")).trim(); String endYearDate = StringUtils.defaultString((String) context.get("endYearDate")).trim(); String startDate = StringUtils.defaultString((String) context.get("startDate")).trim(); String endDate = StringUtils.defaultString((String) context.get("endDate")).trim(); String date1 = startDate;//from w ww .j a v a2 s. co m String date2 = endDate; if (BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency)) { date1 = startYearDate + "/01/01"; date2 = endYearDate + "/12/" + SimpleUtils.getMaxDayOfMonth(Integer.parseInt(endYearDate), 12); } Map<String, Object> headContentMap = new HashMap<String, Object>(); this.fillHeadContent(context, headContentMap); String content = "Frequency: " + BscMeasureDataFrequency.getFrequencyMap(false).get(frequency) + " Date range: " + date1 + " ~ " + date2 + "\n" + StringUtils.defaultString((String) headContentMap.get("headContent")); PdfPCell cell = null; cell = new PdfPCell(); cell.addElement(new Phrase(content, this.getFont(BscReportPropertyUtils.getFontColor(), false))); this.setCellBackgroundColor(cell, BscReportPropertyUtils.getBackgroundColor()); cell.setColspan(maxRows); table.addCell(cell); for (PerspectiveVO perspective : vision.getPerspectives()) { for (ObjectiveVO objective : perspective.getObjectives()) { for (KpiVO kpi : objective.getKpis()) { cell = new PdfPCell(); cell.addElement(new Phrase(kpi.getName(), this.getFont(kpi.getFontColor(), false))); this.setCellBackgroundColor(cell, kpi.getBgColor()); cell.setColspan(4); cell.setRowspan(2); table.addCell(cell); for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) { cell = new PdfPCell(); cell.addElement( new Phrase(dateScore.getDate(), this.getFont(dateScore.getFontColor(), false))); this.setCellBackgroundColor(cell, dateScore.getBgColor()); table.addCell(cell); } for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) { Image image = Image .getInstance(BscReportSupportUtils.getByteIcon(kpi, dateScore.getScore())); image.setWidthPercentage(20f); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateScore.getScore()), this.getFont(dateScore.getFontColor(), false))); cell.addElement(image); this.setCellBackgroundColor(cell, dateScore.getBgColor()); table.addCell(cell); } } } } }
From source file:com.netsteadfast.greenstep.bsc.command.OrganizationReportPdfCommand.java
License:Apache License
private void createHead(PdfPTable table, VisionVO vision, Context context) throws Exception { String bgColor = "#F2F2F2"; String fnColor = "#000000"; PdfPCell cell = new PdfPCell(); cell.addElement(new Phrase("Department Balance SourceCard", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(MAX_COLSPAN);//from w ww . ja v a 2s. c o m table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(vision.getTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(MAX_COLSPAN); table.addCell(cell); String dateType = (String) context.get("dateType"); String year = (String) context.get("startYearDate"); String orgId = (String) context.get("orgId"); String departmentName = ""; String dateTypeName = "Year"; if ("1".equals(dateType)) { dateTypeName = "In the first half"; } if ("2".equals(dateType)) { dateTypeName = "In the second half"; } OrganizationVO organization = new OrganizationVO(); organization.setOrgId(orgId); DefaultResult<OrganizationVO> result = this.organizationService.findByUK(organization); if (result.getValue() != null) { organization = result.getValue(); departmentName = organization.getName(); } cell = new PdfPCell(); cell.addElement(new Phrase("Department", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(departmentName, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(year + " " + dateTypeName, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportPropertyUtils.getPerspectiveTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportPropertyUtils.getObjectiveTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportPropertyUtils.getKpiTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Weight", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Maximum\nTarget\nMinimum", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Score", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); }
From source file:com.netsteadfast.greenstep.bsc.command.OrganizationReportPdfCommand.java
License:Apache License
private void createBody(PdfPTable table, VisionVO vision) throws Exception { String bgColor = "#ffffff"; String fnColor = "#000000"; PdfPCell cell = null;/*from www. j a v a 2 s. c o m*/ for (PerspectiveVO perspective : vision.getPerspectives()) { cell = new PdfPCell(); cell.addElement(new Phrase(perspective.getName(), this.getFont(fnColor, false))); this.setCellBackgroundColor(cell, bgColor); cell.setRowspan(perspective.getRow()); table.addCell(cell); for (ObjectiveVO objective : perspective.getObjectives()) { cell = new PdfPCell(); cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, false))); this.setCellBackgroundColor(cell, bgColor); cell.setRowspan(objective.getRow()); table.addCell(cell); for (KpiVO kpi : objective.getKpis()) { cell = new PdfPCell(); cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, false))); this.setCellBackgroundColor(cell, bgColor); cell.setRowspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, false))); this.setCellBackgroundColor(cell, bgColor); cell.setRowspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase( "max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: " + kpi.getMin() + "\n" + "unit: " + kpi.getUnit(), this.getFont(fnColor, false))); this.setCellBackgroundColor(cell, bgColor); cell.setRowspan(1); table.addCell(cell); DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateRangeScore.getScore()), this.getFont(dateRangeScore.getFontColor(), false))); this.setCellBackgroundColor(cell, dateRangeScore.getBgColor()); cell.setRowspan(1); table.addCell(cell); } } } }
From source file:com.netsteadfast.greenstep.bsc.command.PersonalReportPdfCommand.java
License:Apache License
private void createHead(PdfPTable table, VisionVO vision, Context context) throws Exception { String bgColor = "#F2F2F2"; String fnColor = "#000000"; PdfPCell cell = new PdfPCell(); cell.addElement(new Phrase("Personal Balance SourceCard", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(MAX_COLSPAN);/* ww w . java2s . c o m*/ table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(vision.getTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(MAX_COLSPAN); table.addCell(cell); String dateType = (String) context.get("dateType"); String year = (String) context.get("startYearDate"); String empId = (String) context.get("empId"); String account = (String) context.get("account"); String fullName = ""; String jobTitle = ""; String departmentName = ""; String dateTypeName = "Year"; if ("1".equals(dateType)) { dateTypeName = "In the first half"; } if ("2".equals(dateType)) { dateTypeName = "In the second half"; } EmployeeVO employee = new EmployeeVO(); employee.setEmpId(empId); employee.setAccount(account); DefaultResult<EmployeeVO> result = this.employeeService.findByUK(employee); if (result.getValue() != null) { fullName = result.getValue().getEmpId() + " - " + result.getValue().getFullName(); jobTitle = result.getValue().getEmpId() + " - " + result.getValue().getFullName(); List<String> appendIds = this.organizationService .findForAppendOrganizationOids(result.getValue().getEmpId()); List<String> appendNames = this.organizationService.findForAppendNames(appendIds); StringBuilder sb = new StringBuilder(); for (int i = 0; appendNames != null && i < appendNames.size(); i++) { sb.append(appendNames.get(i)).append(Constants.ID_DELIMITER); } departmentName = sb.toString(); } cell = new PdfPCell(); cell.addElement(new Phrase("Job Title", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(jobTitle, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Department", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(departmentName, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("name: " + fullName, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Annual assessment: " + year, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportPropertyUtils.getObjectiveTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(BscReportPropertyUtils.getKpiTitle(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Maximum\nTarget\nMinimum", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Weight", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Formula", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase("Score", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(dateTypeName, this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); cell.setRowspan(1); table.addCell(cell); }
From source file:com.netsteadfast.greenstep.bsc.command.PersonalReportPdfCommand.java
License:Apache License
private void createBody(PdfPTable table, VisionVO vision) throws Exception { String bgColor = "#ffffff"; String fnColor = "#000000"; for (PerspectiveVO perspective : vision.getPerspectives()) { for (ObjectiveVO objective : perspective.getObjectives()) { int kx = 0; for (KpiVO kpi : objective.getKpis()) { PdfPCell cell = new PdfPCell(); if (kx == 0) { cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1);//from w ww . j a v a 2 s. c om cell.setRowspan(objective.getRow()); table.addCell(cell); } cell = new PdfPCell(); cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement( new Phrase( "max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: " + kpi.getMin() + "\n" + "unit: " + kpi.getUnit(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(); cell.addElement(new Phrase(kpi.getFormula().getName(), this.getFont(fnColor, true))); this.setCellBackgroundColor(cell, bgColor); cell.setColspan(1); table.addCell(cell); DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0); // ? cell = new PdfPCell(); cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateRangeScore.getScore()), this.getFont(dateRangeScore.getFontColor(), true))); this.setCellBackgroundColor(cell, dateRangeScore.getBgColor()); cell.setColspan(1); table.addCell(cell); kx++; } } } }
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 .j ava 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.pdfwriter.PrintInventoryReport.java
public void create(ObservableList list, String totalSales) { try {/*from www .j a v a 2 s . co 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.photoshop.misc.Factuurgenerator.java
private void creatCell(String cellnaam, PdfPTable table, boolean header) { if (header == true) { Font font = new Font(FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.WHITE); PdfPCell c1 = new PdfPCell(new Phrase(cellnaam, font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); c1.setBackgroundColor(new BaseColor(0, 121, 182)); c1.setMinimumHeight(20);/*from w ww .j av a 2 s .com*/ table.addCell(c1); } if (header == false) { PdfPCell c1 = new PdfPCell(new Phrase(cellnaam)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); } }
From source file:com.photoshop.misc.Indexkaartgenerator.java
private void creatCell(String cellnaam, PdfPTable table, boolean header) { if (header == true) { Font font = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.WHITE); PdfPCell c1 = new PdfPCell(new Phrase(cellnaam, font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); c1.setBackgroundColor(new BaseColor(0, 121, 182)); c1.setMinimumHeight(20);/*from w w w . j av a 2 s. co m*/ table.addCell(c1); } if (header == false) { PdfPCell c1 = new PdfPCell(new Phrase(cellnaam)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); } }