List of usage examples for com.lowagie.text Cell setMaxLines
public void setMaxLines(int value)
From source file:datasoul.servicelist.ServiceListExporterDocument.java
License:Open Source License
public void addServicePlan() throws DocumentException { ServiceListTable slt = ServiceListTable.getActiveInstance(); Paragraph p = new Paragraph( java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("SERVICE PLAN"), FontFactory.getFont(FontFactory.HELVETICA, 12)); p.setAlignment(Element.ALIGN_CENTER); document.add(p);/*from w w w . j a v a2s.co m*/ p = new Paragraph(slt.getTitle(), FontFactory.getFont(FontFactory.HELVETICA_BOLD, 16)); p.setAlignment(Element.ALIGN_CENTER); document.add(p); Table t = new Table(4); t.setWidths(new int[] { 10, 5, 50, 35 }); t.setPadding(2.0f); t.setWidth(100.0f); t.addCell(createHeaderCell( java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("TIME"))); t.addCell( createHeaderCell(java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("MIN"))); t.addCell(createHeaderCell( java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("TITLE"))); t.addCell(createHeaderCell( java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("NOTES"))); for (int i = 0; i < slt.getRowCount(); i++) { ServiceItem si = (ServiceItem) slt.getServiceItem(i); Cell c; // Start time c = new Cell(si.getStartTime()); c.setMaxLines(1); c.setVerticalAlignment(Cell.ALIGN_MIDDLE); c.setHorizontalAlignment(Cell.ALIGN_CENTER); t.addCell(c); // Duration c = new Cell(Integer.toString(si.getDuration())); c.setMaxLines(1); c.setVerticalAlignment(Cell.ALIGN_MIDDLE); c.setHorizontalAlignment(Cell.ALIGN_RIGHT); t.addCell(c); // Title c = new Cell(si.getTitle()); c.setVerticalAlignment(Cell.ALIGN_MIDDLE); t.addCell(c); // Notes c = new Cell(si.getNotes()); c.setVerticalAlignment(Cell.ALIGN_MIDDLE); t.addCell(c); } document.add(t); p = new Paragraph(java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("NOTES"), FontFactory.getFont(FontFactory.HELVETICA_BOLD)); document.add(p); p = new Paragraph(slt.getNotes(), FontFactory.getFont(FontFactory.HELVETICA)); p.setIndentationLeft(10.0f); document.add(p); document.newPage(); }
From source file:datasoul.servicelist.ServiceListExporterDocument.java
License:Open Source License
private Cell createHeaderCell(String text) throws BadElementException { Cell c = new Cell(new Chunk(text, FontFactory.getFont(FontFactory.HELVETICA_BOLD))); c.setMaxLines(1); c.setHeader(true);//from ww w. java2s .c o m c.setVerticalAlignment(Cell.ALIGN_MIDDLE); c.setHorizontalAlignment(Cell.ALIGN_CENTER); return c; }