Java Code Examples for com.lowagie.text.pdf.PdfPCell#setBorderWidth()
The following examples show how to use
com.lowagie.text.pdf.PdfPCell#setBorderWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncCell.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** Creates a new instance of IncCell */ public IncCell(String tag, ChainedProperties props) { cell = new PdfPCell((Phrase)null); String value = props.getProperty("colspan"); if (value != null) cell.setColspan(Integer.parseInt(value)); value = props.getProperty("align"); if (tag.equals("th")) cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (value != null) { if ("center".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_CENTER); else if ("right".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_RIGHT); else if ("left".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_LEFT); else if ("justify".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); } value = props.getProperty("valign"); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); if (value != null) { if ("top".equalsIgnoreCase(value)) cell.setVerticalAlignment(Element.ALIGN_TOP); else if ("bottom".equalsIgnoreCase(value)) cell.setVerticalAlignment(Element.ALIGN_BOTTOM); } value = props.getProperty("border"); float border = 0; if (value != null) border = Float.parseFloat(value); cell.setBorderWidth(border); value = props.getProperty("cellpadding"); if (value != null) cell.setPadding(Float.parseFloat(value)); cell.setUseDescender(true); value = props.getProperty("bgcolor"); cell.setBackgroundColor(Markup.decodeColor(value)); }
Example 2
Source File: IncCell.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** Creates a new instance of IncCell */ public IncCell(String tag, ChainedProperties props) { cell = new PdfPCell((Phrase)null); String value = props.getProperty("colspan"); if (value != null) cell.setColspan(Integer.parseInt(value)); value = props.getProperty("align"); if (tag.equals("th")) cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (value != null) { if ("center".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_CENTER); else if ("right".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_RIGHT); else if ("left".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_LEFT); else if ("justify".equalsIgnoreCase(value)) cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); } value = props.getProperty("valign"); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); if (value != null) { if ("top".equalsIgnoreCase(value)) cell.setVerticalAlignment(Element.ALIGN_TOP); else if ("bottom".equalsIgnoreCase(value)) cell.setVerticalAlignment(Element.ALIGN_BOTTOM); } value = props.getProperty("border"); float border = 0; if (value != null) border = Float.parseFloat(value); cell.setBorderWidth(border); value = props.getProperty("cellpadding"); if (value != null) cell.setPadding(Float.parseFloat(value)); cell.setUseDescender(true); value = props.getProperty("bgcolor"); cell.setBackgroundColor(Markup.decodeColor(value)); }
Example 3
Source File: PdfTimetableGridTable.java From unitime with Apache License 2.0 | 5 votes |
public PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(sBorderColor); cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(1); cell.setBorderWidthBottom(1); cell.setBorderWidthLeft(1); cell.setBorderWidthRight(1); return cell; }
Example 4
Source File: PdfTimetableGridTable.java From unitime with Apache License 2.0 | 5 votes |
public PdfPCell createCellNoBorder() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(sBorderColor); cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); return cell; }
Example 5
Source File: PdfTimetableGridTable.java From unitime with Apache License 2.0 | 5 votes |
private void addLegendRow(String color, String text) { PdfPCell c = createCellNoBorder(); c.setBorderWidth(1); c.setBackgroundColor(getColor(color)); iPdfTable.addCell(c); c = createCellNoBorder(); addText(c, " "+text); c.setHorizontalAlignment(Element.ALIGN_LEFT); iPdfTable.addCell(c); }
Example 6
Source File: PdfExamGridTable.java From unitime with Apache License 2.0 | 5 votes |
public PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(sBorderColor); cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(1); cell.setBorderWidthBottom(1); cell.setBorderWidthLeft(1); cell.setBorderWidthRight(1); return cell; }
Example 7
Source File: PdfExamGridTable.java From unitime with Apache License 2.0 | 5 votes |
public PdfPCell createCellNoBorder() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(sBorderColor); cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); return cell; }
Example 8
Source File: PdfExamGridTable.java From unitime with Apache License 2.0 | 5 votes |
private void addLegendRow(String color, String text) { PdfPCell c = createCellNoBorder(); c.setBorderWidth(1); c.setBackgroundColor(getColor(color)); iPdfTable.addCell(c); c = createCellNoBorder(); addText(c, " "+text); c.setHorizontalAlignment(Element.ALIGN_LEFT); iPdfTable.addCell(c); }
Example 9
Source File: PdfInstructionalOfferingTableBuilder.java From unitime with Apache License 2.0 | 5 votes |
public PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(sBorderColor); cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(iBgColor); return cell; }
Example 10
Source File: PdfWebTable.java From unitime with Apache License 2.0 | 5 votes |
private PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(Color.BLACK); cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); return cell; }
Example 11
Source File: PdfWebTable.java From unitime with Apache License 2.0 | 5 votes |
private float addText(PdfPCell cell, String text, boolean bold, boolean italic, boolean underline, Color color, boolean borderTop, boolean borderBottom, boolean borderLeft, boolean borderRight, Color borderColor, Color bgColor ) { cell.setBorderWidth(1); if (borderTop) { cell.setBorder(PdfPCell.TOP); if (borderColor==null) cell.setBorderColorTop(Color.BLACK); else cell.setBorderColorTop(borderColor); } if (borderBottom) { cell.setBorder(PdfPCell.BOTTOM); if (borderColor==null) cell.setBorderColorBottom(Color.BLACK); else cell.setBorderColorBottom(borderColor); } if (borderLeft) { cell.setBorder(PdfPCell.LEFT); if (borderColor==null) cell.setBorderColorLeft(Color.BLACK); else cell.setBorderColorLeft(borderColor); } if (borderRight) { cell.setBorder(PdfPCell.RIGHT); if (borderColor==null) cell.setBorderColorRight(Color.BLACK); else cell.setBorderColorRight(borderColor); } return addText(cell, text, bold, italic, underline, color, bgColor); }
Example 12
Source File: PdfWebTable.java From unitime with Apache License 2.0 | 5 votes |
private float addText(PdfPCell cell, String text, boolean bold, boolean italic, boolean underline, Color color, boolean border, Color borderColor, Color bgColor) { if (border) { cell.setBorderWidth(1); cell.setBorder(PdfPCell.RIGHT | PdfPCell.LEFT | PdfPCell.TOP | PdfPCell.BOTTOM ); if (borderColor==null) cell.setBorderColor(Color.BLACK); else cell.setBorderColor(borderColor); } return addText(cell, text, bold, italic, underline, color, bgColor); }
Example 13
Source File: PdfDataEntryFormUtil.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static PdfPCell getPdfPCell( float minHeight, int cellContentType, boolean hasBorder ) { PdfPCell cell = new PdfPCell(); cell.setMinimumHeight( minHeight ); if( hasBorder ) { cell.setBorderWidth( 0.1f ); cell.setBorderColor( COLOR_CELLBORDER ); } else { cell.setBorder( Rectangle.NO_BORDER ); } cell.setPadding( 2.0f ); switch ( cellContentType ) { case CELL_COLUMN_TYPE_ENTRYFIELD: cell.setHorizontalAlignment( Element.ALIGN_CENTER ); cell.setVerticalAlignment( Element.ALIGN_MIDDLE ); break; case CELL_COLUMN_TYPE_HEADER: cell.setHorizontalAlignment( Element.ALIGN_CENTER ); cell.setVerticalAlignment( Element.ALIGN_MIDDLE ); break; case CELL_COLUMN_TYPE_LABEL: cell.setHorizontalAlignment( Element.ALIGN_RIGHT ); cell.setVerticalAlignment( Element.ALIGN_TOP ); default: break; } return cell; }