List of usage examples for com.lowagie.text.pdf PdfPCell setColspan
public void setColspan(int colspan)
From source file:biblivre3.administration.reports.AllUsersReport.java
License:Open Source License
private final ArrayList<PdfPTable> createListTable(Map<String, List<String>> data) { try {//from w ww . j ava2 s.c o m ArrayList<PdfPTable> tabelas = new ArrayList<PdfPTable>(); PdfPTable table = null; PdfPCell cell; for (String description : data.keySet()) { table = new PdfPTable(4); table.setWidthPercentage(100f); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(description.toUpperCase()))); cell.setColspan(4); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NAME")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ENROL")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_INSERTION_DATE")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_UPDATE_DATE")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); for (String line : data.get(description)) { String[] dados = line.split("\t"); //Nome cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[0]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); //Matricula cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[1]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); //Data de Inclusao cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[2]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); //Data de Cancelamento/Alteracao cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[3]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } if (table != null) { tabelas.add(table); } } return tabelas; } catch (Exception e) { logger.error(e.getMessage(), e); return null; } }
From source file:biblivre3.administration.reports.AssetHoldingByDateReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { AssetHoldingByDateDto dto = (AssetHoldingByDateDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_ASSET_HOLDING_BY_DATE_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);// w w w .j a v a 2 s . c o m document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(8); table.setWidthPercentage(100f); createHeader(table); PdfPCell cell; List<String[]> dataList = dto.getData(); for (String[] data : dataList) { cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[0]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[1]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[2]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[3]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[4]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[5]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); }
From source file:biblivre3.administration.reports.AssetHoldingByDateReport.java
License:Open Source License
private void createHeader(PdfPTable table) { PdfPCell cell; cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("LABEL_CREATION_DATE")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell);/* w ww. jav a2 s .co m*/ cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_ASSET_HOLDING")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_TITLE")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(2); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_AUTHOR")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(2); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_DATE")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("LABEL_DATE_TUMBLING")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); }
From source file:biblivre3.administration.reports.AssetHoldingFullReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { AssetHoldingDto dto = (AssetHoldingDto) reportData; String title = ""; if (this.topographic) { title = this.getText("REPORTS_TOPOGRAPHIC_TITLE"); } else {// w w w .j ava2s . co m title = this.getText("REPORTS_ASSET_HOLDING_TITLE"); } Paragraph p1 = new Paragraph(title); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1); document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(20); table.setWidthPercentage(100f); createHeader(table); PdfPCell cell; List<String[]> dataList = dto.getData(); Collections.sort(dataList, this); for (String[] data : dataList) { PdfContentByte cb = getWriter().getDirectContent(); String holdingSerial = StringUtils.leftPad(data[0], 10, "0"); Barcode39 code39 = new Barcode39(); code39.setExtended(true); code39.setCode(holdingSerial); code39.setStartStopText(false); Image image39 = code39.createImageWithBarcode(cb, null, null); image39.scalePercent(100f); cell = new PdfPCell(new Paragraph(new Phrase(new Chunk(image39, 0, 0)))); cell.setColspan(6); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[1]))); cell.setColspan(3); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); Paragraph para = new Paragraph(); para.add(new Phrase(this.getSmallFontChunk(data[2] + "\n"))); para.add(new Phrase(this.getSmallFontChunk(data[3] + "\n"))); if (StringUtils.isNotBlank(data[4])) { para.add(new Phrase(this.getBoldChunk(this.getText("REPORTS_LOCATION") + ": "))); para.add(new Phrase(this.getSmallFontChunk(data[4] + " "))); } if (StringUtils.isNotBlank(data[5])) { para.add(new Phrase(this.getBoldChunk(this.getText("REPORTS_EDITION") + ": "))); para.add(new Phrase(this.getSmallFontChunk(data[5] + " "))); } if (StringUtils.isNotBlank(data[6])) { para.add(new Phrase(this.getBoldChunk(this.getText("REPORTS_DATE") + ": "))); para.add(new Phrase(this.getSmallFontChunk(data[6]))); } cell = new PdfPCell(para); cell.setColspan(11); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); cell.setPaddingTop(5f); cell.setPaddingLeft(7f); cell.setPaddingBottom(4f); table.addCell(cell); } document.add(table); }
From source file:biblivre3.administration.reports.AssetHoldingFullReport.java
License:Open Source License
private void createHeader(PdfPTable table) { PdfPCell cell; cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("LABEL_SERIAL")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(6); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell);//from w ww.ja v a 2 s .c o m cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_ASSET_HOLDING")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(3); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_HOLDING")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(11); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); }
From source file:biblivre3.administration.reports.AssetHoldingReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { AssetHoldingDto dto = (AssetHoldingDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_ASSET_HOLDING_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);/* w w w .jav a 2s . co m*/ document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(7); table.setWidthPercentage(100f); createHeader(table); PdfPCell cell; List<String[]> dataList = dto.getData(); Collections.sort(dataList, this); for (String[] data : dataList) { cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[0]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[1]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[2]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[3]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[4]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); }
From source file:biblivre3.administration.reports.AssetHoldingReport.java
License:Open Source License
private void createHeader(PdfPTable table) { PdfPCell cell; cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_ASSET_HOLDING")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell);/* w w w . j a v a2s. com*/ cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_AUTHOR")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(2); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_TITLE")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(2); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_EDITION")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_DATE")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); }
From source file:biblivre3.administration.reports.BibliographyReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { BibliographyReportDto dto = (BibliographyReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_BIBLIOGRAPHY_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);/*from ww w.j ava2 s.c o m*/ document.add(new Phrase("\n")); Paragraph p2 = new Paragraph( this.getHeaderChunk(this.getText("REPORTS_AUTHOR") + ": " + dto.getAuthorName())); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p2); document.add(new Phrase("\n")); if (dto.getData() != null) { PdfPTable table = new PdfPTable(8); table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); createHeader(table); PdfPCell cell; for (String[] data : dto.getData()) { cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0]))); cell.setColspan(3); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[2]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[3]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[4]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); document.add(new Phrase("\n")); } }
From source file:biblivre3.administration.reports.BibliographyReport.java
License:Open Source License
private void createHeader(PdfPTable table) { PdfPCell cell; cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TITLE")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(3); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell);//from www .j av a 2 s.com cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_EDITION")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_EDITOR")))); cell.setBackgroundColor(headerBgColor); cell.setColspan(2); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_YEAR")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_LOCAL")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); }
From source file:biblivre3.administration.reports.DeweyReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { DeweyReportDto dto = (DeweyReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_DEWEY_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);// ww w . ja va2 s . c om document.add(new Phrase("\n\n")); PdfPTable table = new PdfPTable(6); table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); createHeader(table); PdfPCell cell; int totalRecords = 0; int totalHoldings = 0; List<String[]> dataList = dto.getData(); Collections.sort(dataList, this); for (String[] data : dataList) { if (StringUtils.isBlank(data[0])) { data[0] = this.getText("REPORTS_DEWEY_UNCLASSIFIED"); } totalRecords += Integer.parseInt(data[1]); totalHoldings += Integer.parseInt(data[2]); } if (totalRecords > 0) { dataList.add(new String[] { this.getText("REPORTS_TOTAL"), String.valueOf(totalRecords), String.valueOf(totalHoldings) }); } for (String[] data : dataList) { cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[2]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); }