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

The following examples show how to use com.lowagie.text.pdf.PdfPCell#setBorderColor() . 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: 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 2
Source File: PdfTimetableGridTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
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 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 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: PdfInstructionalOfferingTableBuilder.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.setBackgroundColor(iBgColor);
	return cell;
}
 
Example 6
Source File: PdfWebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
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 7
Source File: PdfWebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
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 8
Source File: PdfDataEntryFormUtil.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
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;
}