Example usage for com.lowagie.text Element ALIGN_TOP

List of usage examples for com.lowagie.text Element ALIGN_TOP

Introduction

In this page you can find the example usage for com.lowagie.text Element ALIGN_TOP.

Prototype

int ALIGN_TOP

To view the source code for com.lowagie.text Element ALIGN_TOP.

Click Source Link

Document

A possible value for vertical alignment.

Usage

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setCeldaPDF(String texto, int tipo, int tamanio, int estilo, int alineacion, int borde,
        int padding, int colspan) {
    PdfPCell celda = new PdfPCell(new Paragraph(texto, new Font(tipo, tamanio, estilo)));
    celda.setHorizontalAlignment(alineacion);
    celda.setPadding(padding);//from   w  ww . j  a v  a  2 s  .c  o  m
    celda.setColspan(colspan);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderColor(Color.LIGHT_GRAY);
    celda.setBorderWidth(borde);
    return celda;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setCeldaPDF(PdfPTable tabla, int alineacion, int borde) {
    PdfPCell celda = new PdfPCell(tabla);
    celda.setHorizontalAlignment(alineacion);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderColor(Color.LIGHT_GRAY);
    celda.setBorderWidth(borde);/*ww  w.ja v  a2  s .  c o  m*/
    return celda;
}

From source file:net.bull.javamelody.internal.web.pdf.PdfDatabaseInformationsReport.java

License:Apache License

private void writeRow(String[] row) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setVerticalAlignment(Element.ALIGN_TOP);
    for (final String value : row) {
        if (value == null || value.isEmpty()) {
            addCell("");
        } else {// w  w  w. ja  va 2s  .  c  om
            if (isNumber(value)) {
                defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            } else {
                defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            }
            addCell(value);
        }
    }
}

From source file:net.bull.javamelody.internal.web.pdf.PdfMBeansReport.java

License:Apache License

private static PdfPTable createAttributesTable() {
    final PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100);/*from  w w w  .j a  va2  s .c  om*/
    final PdfPCell defaultCell = table.getDefaultCell();
    defaultCell.setPaddingLeft(2);
    defaultCell.setPaddingRight(2);
    defaultCell.setVerticalAlignment(Element.ALIGN_TOP);
    defaultCell.setBorder(0);
    return table;
}

From source file:net.bull.javamelody.PdfDatabaseInformationsReport.java

License:Apache License

private void writeRow(String[] row) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setVerticalAlignment(Element.ALIGN_TOP);
    for (final String value : row) {
        if (value == null || value.length() == 0) {
            addCell("");
        } else {//from  w w w. j  a  v a2s.  c  o  m
            if (isNumber(value)) {
                defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            } else {
                defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            }
            addCell(value);
        }
    }
}

From source file:open.dolphin.hiro.PrescriptionPDFMaker.java

/**
 * ??
 * 
 * @param pcell
 */
private void setAlignTop(PdfPCell pcell) {
    pcell.setVerticalAlignment(Element.ALIGN_TOP);
}

From source file:org.apache.poi.xwpf.converter.internal.itext.StyleEngineForIText.java

License:Open Source License

private StyleParagraphProperties mapStyleParagraphProperties(CTPPr xwpfParagraphProperties) {
    StyleParagraphProperties paragraphProperties = new StyleParagraphProperties();
    CTSpacing spacing = xwpfParagraphProperties.getSpacing();
    if (spacing != null) {

        BigInteger spacingBefore = spacing.getBefore();

        if (spacingBefore != null) {
            paragraphProperties.setSpacingBefore(spacingBefore.intValue());
        }//w  w w  .  j  a  v  a2  s. c  om
        BigInteger spacingAfter = spacing.getAfter();
        if (spacingAfter != null) {
            paragraphProperties.setSpacingAfter(spacingAfter.intValue());
        }
    }

    // TODO : text Alignement...

    CTTextAlignment alignment = xwpfParagraphProperties.getTextAlignment();

    if (alignment != null) {
        STTextAlignment textAlignment = alignment.xgetVal();

        if (STTextAlignment.BASELINE.equals(textAlignment)) {
            paragraphProperties.setAlignment(Element.ALIGN_BASELINE);
        } else if (STTextAlignment.BOTTOM.equals(textAlignment)) {
            paragraphProperties.setAlignment(Element.ALIGN_BOTTOM);
        } else if (STTextAlignment.CENTER.equals(textAlignment)) {
            paragraphProperties.setAlignment(Element.ALIGN_CENTER);
        } else if (STTextAlignment.TOP.equals(textAlignment)) {
            paragraphProperties.setAlignment(Element.ALIGN_TOP);
        }

    }
    CTInd ctInd = xwpfParagraphProperties.getInd();
    if (ctInd != null) {
        processIndent(paragraphProperties, ctInd);

    }

    // CTParaRPr ctParaRPr = xwpfParagraphProperties.getRPr();
    // if (ctParaRPr != null) {
    //
    // }
    return paragraphProperties;
}

From source file:org.areasy.common.doclet.document.tags.HtmlTagUtility.java

License:Open Source License

/**
 * Returns the Element constant associated with the specified vertical
 * alignment (top, middle, bottom, baseline).
 *//*from   w  ww .  ja  va2s. com*/
public static int getVerticalAlignment(String htmlAlignString, int defaultAlign) {
    if (htmlAlignString == null)
        return defaultAlign;

    if ("top".equalsIgnoreCase(htmlAlignString))
        return Element.ALIGN_TOP;
    if ("middle".equalsIgnoreCase(htmlAlignString))
        return Element.ALIGN_MIDDLE;
    if ("bottom".equalsIgnoreCase(htmlAlignString))
        return Element.ALIGN_BOTTOM;
    if ("baseline".equalsIgnoreCase(htmlAlignString))
        return Element.ALIGN_BASELINE;

    return defaultAlign;
}

From source file:org.displaytag.export.PdfView.java

License:Artistic License

/**
 * Initialize the main info holder table.
 * @throws BadElementException for errors during table initialization
 *//*from w w w  .  j  av  a2s  . c o m*/
protected void initTable() throws BadElementException {
    tablePDF = new Table(this.model.getNumberOfColumns());
    //        tablePDF.setDefaultVerticalAlignment(Element.ALIGN_TOP);
    //modify by mz
    tablePDF.setAlignment(Element.ALIGN_TOP);
    tablePDF.setCellsFitPage(true);
    tablePDF.setWidth(100);

    tablePDF.setPadding(2);
    tablePDF.setSpacing(0);

    smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.NORMAL, new Color(0, 0, 0));

}

From source file:org.displaytag.export.PdfView.java

License:Artistic License

/**
 * Returns a formatted cell for the given value.
 * @param value cell value//from w w w  . java2  s.  c  o  m
 * @return Cell
 * @throws BadElementException errors while generating content
 */
private Cell getCell(String value) throws BadElementException {
    Cell cell = new Cell(new Chunk(StringUtils.trimToEmpty(value), smallFont));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setLeading(8);
    return cell;
}