Example usage for com.lowagie.text Cell setUseAscender

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

Introduction

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

Prototype

public void setUseAscender(boolean use) 

Source Link

Document

Sets the value of useAscender.

Usage

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 {//from w w  w  .j  a v a  2 s.co m
        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:org.tpspencer.tal.mvc.document.DocumentWriterImpl.java

License:Apache License

public void addTableRow(String[] cols, AppElement element) {
    if (table == null)
        throw new IllegalArgumentException("Cannot add a row if there is no table!");

    try {/*w w  w.  j  a va 2  s  .  co m*/
        for (int i = 0; i < cols.length; i++) {
            Cell c = new Cell(new Phrase(getText(cols[i], element), paraFont));
            c.setUseAscender(true);
            c.setVerticalAlignment("middle");
            table.addCell(c);
        }
    } catch (Exception e) {
        throw new IllegalArgumentException("Error adding row to a table", e);
    }
}

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

License:Apache License

public void addTableRow(String[] cols) {
    if (table == null)
        throw new IllegalArgumentException("Cannot add a row if there is no table!");

    try {/*from   w  ww  . ja v a  2s.c  o m*/
        for (int i = 0; i < cols.length; i++) {
            Cell c = new Cell(new Phrase(cols[i], paraFont));
            c.setUseAscender(true);
            c.setVerticalAlignment("middle");
            table.addCell(c);
        }
    } catch (Exception e) {
        throw new IllegalArgumentException("Error adding row to a table", e);
    }
}