Java Code Examples for com.lowagie.text.pdf.PdfPCell#setBorderWidthTop()

The following examples show how to use com.lowagie.text.pdf.PdfPCell#setBorderWidthTop() . 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: PurchaseOrderQuotePdf.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * A helper method to create a PdfPCell. We can specify the content, font, horizontal alignment, border (borderless, no
 * bottom border, no right border, no top border, etc.
 *
 * @param content              The text content to be displayed in the cell.
 * @param borderless           boolean true if the cell should be borderless.
 * @param noBottom             boolean true if the cell should have borderWidthBottom = 0.
 * @param noRight              boolean true if the cell should have borderWidthRight = 0.
 * @param noTop                boolean true if the cell should have borderWidthTop = 0.
 * @param horizontalAlignment  The desired horizontal alignment for the cell.
 * @param font                 The font type to be used in the cell.
 * @return                     An instance of PdfPCell which content and attributes were set by the input parameters.
 */
private PdfPCell createCell(String content, boolean borderless, boolean noBottom, boolean noRight, boolean noTop, int horizontalAlignment, Font font) {
    PdfPCell tableCell = new PdfPCell(new Paragraph(content, font));
    if (borderless) {
        tableCell.setBorder(0);
    }
    if (noBottom) {
        tableCell.setBorderWidthBottom(0);
    }
    if (noTop) {
        tableCell.setBorderWidthTop(0);
    }
    if (noRight) {
        tableCell.setBorderWidthRight(0);
    }
    tableCell.setHorizontalAlignment(horizontalAlignment);
    return tableCell;
}
 
Example 2
Source File: PdfTimetableGridTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
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 3
Source File: PdfExamGridTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
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: PdfExamGridTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void printHeaderCell(String name, boolean vertical, boolean eod, boolean eol) {
    PdfPCell c = createCell();
    if (!eol && !eod) c.setBorderWidthRight(0);
    if (name==null) {
        c.setBorderWidthLeft(0);
        c.setBorderWidthTop(0);
        c.setBorderWidthBottom(0);
    } else {
        addText(c, name);
    }
    iPdfTable.addCell(c);
}
 
Example 5
Source File: PdfExamGridTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void printRowHeaderCell(String name, int idx, int maxIdx, boolean vertical, boolean head, boolean in) {
    PdfPCell c = createCell();
    c.setBorderWidthTop(idx==0 && (head || (!in && !vertical)) ? 1 : 0);
    c.setBorderWidthBottom(idx<maxIdx ? 0 : 1);
    c.setBorderWidthRight(0);
    if (idx==0) addText(c, name);
    iPdfTable.addCell(c);
}