Example usage for com.lowagie.text Cell setLeading

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

Introduction

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

Prototype

public void setLeading(float value) 

Source Link

Document

Sets the leading.

Usage

From source file:org.drools.verifier.doc.DroolsDocsComponentFactory.java

License:Apache License

private static Cell newHeaderCell(String text, Font font) throws BadElementException {
    Cell c = new Cell(new Phrase(text, font));
    c.setBackgroundColor(Color.decode("#CCCCFF"));
    c.setLeading(10);
    c.setBorder(1);//from   w w  w .java 2  s.c o  m

    return c;
}

From source file:org.drools.verifier.doc.DroolsDocsComponentFactory.java

License:Apache License

private static Cell newCell(String text) throws BadElementException {
    Cell c = new Cell(new Phrase(text, BODY_TEXT));
    c.setLeading(10);
    c.setBorder(0);//  w w  w.java 2  s.  co m
    c.setBorderWidthBottom(1);

    return c;
}

From source file:org.egov.infra.web.displaytag.export.EGovPdfView.java

License:Open Source License

/**
 * Returns a formatted cell for the given value.
 * @param value cell value//from   w w  w.  j  a v  a2s .c  o m
 * @return Cell
 * @throws BadElementException errors while generating content
 */
private Cell getCell(String value) throws BadElementException {

    value = removeHtmlTagsAndSpaces(value);
    final Cell cell = new Cell(new Chunk(StringUtils.trimToEmpty(value), this.smallFont));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setLeading(8);
    return cell;
}

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

License:Open Source License

/**
 * Returns a formatted cell for the given value.
 * /*from   www .jav  a 2 s .co m*/
 * @param value
 *            cell value
 * @return Cell
 * @throws BadElementException
 *             errors while generating content
 */
private Cell getCell(String value, Font font, int horizAlign, int width) throws BadElementException {
    Cell cell = new Cell(new Chunk(StringUtils.trimToEmpty(value), font));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(horizAlign);
    cell.setLeading(8);
    if (width > 0) {
        cell.setWidth(width);
    }
    return cell;
}

From source file:se.idega.idegaweb.commune.school.report.business.ReportPDFWriter.java

License:Open Source License

/**
 * Builds the report row headers.//from   ww  w .  j  a  va  2  s.c  o m
 */
protected void buildRowHeaders(Table table) throws BadElementException {
    Header[] headers = this._reportModel.getRowHeaders();
    int row = 2;
    String s = null;
    com.lowagie.text.Cell cell = null;
    for (int i = 0; i < headers.length; i++) {
        Header header = headers[i];
        Header[] children = header.getChildren();
        if (children == null) {
            int headerType = header.getHeaderType();
            if (headerType == Header.HEADERTYPE_ROW_SPACER) {
                s = " ";
            } else if (headerType == Header.HEADERTYPE_ROW_NONLOCALIZED_HEADER
                    || header.getHeaderType() == Header.HEADERTYPE_ROW_NONLOCALIZED_NORMAL) {
                s = header.getLocalizationKey();
            } else {
                s = localize(header.getLocalizationKey(), header.getLocalizationKey());
            }
            cell = new com.lowagie.text.Cell(new Phrase(s, this._boldFont));
            if (headerType == Header.HEADERTYPE_ROW_LABEL || headerType == Header.HEADERTYPE_ROW_SPACER) {
                cell.setColspan(this._reportModel.getColumnSize() + 1);
            }
            cell.setNoWrap(true);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            if (headerType == Header.HEADERTYPE_ROW_LABEL) {
                cell.setBackgroundColor(new java.awt.Color(0xe0, 0xe0, 0xe0));
            }
            table.addCell(cell, new Point(row, 0));
            setColSize(s, 0, false);
            row++;
        } else {
            if (header.getHeaderType() == Header.HEADERTYPE_ROW_NONLOCALIZED_HEADER
                    || header.getHeaderType() == Header.HEADERTYPE_ROW_NONLOCALIZED_NORMAL) {
                s = header.getLocalizationKey();
            } else {
                s = localize(header.getLocalizationKey(), header.getLocalizationKey());
            }
            cell = new com.lowagie.text.Cell(new Phrase(s, this._normalFont));
            cell.setColspan(this._reportModel.getColumnSize() + 1);
            cell.setLeading(16);
            table.addCell(cell, new Point(row, 0));
            row++;
            for (int j = 0; j < children.length; j++) {
                Header child = children[j];
                int headerType = child.getHeaderType();
                if (headerType == Header.HEADERTYPE_ROW_SPACER) {
                    s = " ";
                } else if (headerType == Header.HEADERTYPE_ROW_NONLOCALIZED_HEADER
                        || headerType == Header.HEADERTYPE_ROW_NONLOCALIZED_NORMAL) {
                    s = child.getLocalizationKey();
                } else {
                    s = localize(child.getLocalizationKey(), child.getLocalizationKey());
                }
                cell = new com.lowagie.text.Cell(new Phrase(s, this._boldFont));
                if (headerType == Header.HEADERTYPE_ROW_LABEL || headerType == Header.HEADERTYPE_ROW_SPACER) {
                    cell.setColspan(this._reportModel.getColumnSize() + 1);
                }
                cell.setNoWrap(true);
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                if (headerType == Header.HEADERTYPE_ROW_LABEL) {
                    cell.setBackgroundColor(new java.awt.Color(0xe0, 0xe0, 0xe0));
                }
                table.addCell(cell, row, 0);
                setColSize(s, 0, false);
                row++;
            }
        }
    }
}