Example usage for com.lowagie.text Cell setHeader

List of usage examples for com.lowagie.text Cell setHeader

Introduction

In this page you can find the example usage for com.lowagie.text Cell setHeader.

Prototype

public void setHeader(boolean value) 

Source Link

Document

Sets header.

Usage

From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java

License:Open Source License

/**
 * Helper method to create a Header Cell from text
 *
 * @returns {@link Cell} with the header flag set
 *//*  w ww  .j  a  v  a2 s.  com*/
protected Cell getHeaderCell(final String text) throws BadElementException {
    final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    final Cell retval = new Cell(new Chunk(text, headerFont));
    retval.setBorder(NO_BORDER);
    retval.setHeader(true);
    return retval;
}

From source file:org.netxilia.server.rest.pdf.SheetPdfProvider.java

License:Open Source License

/**
 * Generates the header cells, which persist on every page of the PDF document.
 * /*w  w  w.  ja v  a 2  s.  co m*/
 * @throws BadElementException
 *             IText exception
 * @throws NetxiliaBusinessException
 * @throws NetxiliaResourceException
 */
protected void generateHeaders(ISheet sheet, Table tablePDF, Font font, int columnCount)
        throws BadElementException, NetxiliaResourceException, NetxiliaBusinessException {

    Cell hdrCell = getCell("", font, Element.ALIGN_CENTER, 50);
    hdrCell.setGrayFill(0.9f);
    hdrCell.setHeader(true);
    tablePDF.addCell(hdrCell);

    List<ColumnData> columnData = sheet.receiveColumns(Range.ALL).getNonBlocking();

    for (int i = 0; i < columnCount; ++i) {
        ColumnData column = i < columnData.size() ? columnData.get(i) : null;
        hdrCell = getCell(CellReference.columnLabel(i), font, Element.ALIGN_CENTER,
                column != null ? column.getWidth() : 120);
        hdrCell.setGrayFill(0.9f);
        hdrCell.setHeader(true);
        tablePDF.addCell(hdrCell);

    }
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell columnHeaderCell(String label, boolean leaf, int hAlign) throws BadElementException {
    Paragraph para = new Paragraph(label);
    para.setFont(new Font(Font.HELVETICA, 10, Font.NORMAL, Color.WHITE));

    Cell cell = new Cell();
    cell.addElement(para);/* ww w  .ja va 2s. co m*/
    cell.setHorizontalAlignment(hAlign);
    cell.setHeader(true);
    cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
    cell.setBackgroundColor(new Color(55, 96, 145));

    cell.setBorderWidth(0);

    return cell;
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell cornerCell() {
    Cell cell = new Cell();
    cell.setHeader(true);
    cell.setBorderWidth(0);// w w w .j  a v  a2  s . c  om
    cell.setBackgroundColor(new Color(55, 96, 145));
    return cell;
}

From source file:org.tpspencer.tal.mvc.document.DocumentWriterImpl.java

License:Apache License

public void startTable(String[] headings) {
    if (sections.size() == 0)
        throw new IllegalArgumentException("Cannot start a list if there is no section");
    if (table != null)
        throw new IllegalArgumentException("Cannot nest a table in another table");

    try {/*  w  ww.j  a v  a2 s  . c  om*/
        table = new Table(headings.length);
        table.setPadding(2);
        table.setBorderColor(Color.GRAY);
        table.setBorderWidth(1);

        for (int i = 0; i < headings.length; i++) {
            Cell c = new Cell(new Phrase(getText(headings[i]), headingFont));
            c.setUseAscender(true);
            c.setBackgroundColor(Color.DARK_GRAY);
            c.setVerticalAlignment(Element.ALIGN_MIDDLE);
            c.setHeader(true);
            table.addCell(c);
        }

        table.endHeaders();
    } catch (Exception e) {
        throw new IllegalArgumentException("Error creating table", e);
    }
}

From source file:sg.edu.nus.util.ReportWriter.java

private static void createTable(Section subCatPart) throws BadElementException {
    Table t = new Table(3, 2);

    t.setBorderColor(Color.GRAY);
    t.setPadding(4);/*  ww w .  ja  v a2  s.co  m*/
    t.setSpacing(4);
    t.setBorderWidth(1);

    Cell c1 = new Cell("Table Header 1");
    c1.setHeader(true);
    t.addCell(c1);
    c1 = new Cell("Table Header 2");
    t.addCell(c1);
    c1 = new Cell("Table Header 3");
    t.addCell(c1);
    t.endHeaders();

    t.addCell("1.0");
    t.addCell("1.1");
    t.addCell("1.2");
    t.addCell("2.1");
    t.addCell("2.2");
    t.addCell("2.3");

    subCatPart.add(t);

}