Example usage for org.apache.poi.ss.usermodel VerticalAlignment BOTTOM

List of usage examples for org.apache.poi.ss.usermodel VerticalAlignment BOTTOM

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel VerticalAlignment BOTTOM.

Prototype

VerticalAlignment BOTTOM

To view the source code for org.apache.poi.ss.usermodel VerticalAlignment BOTTOM.

Click Source Link

Document

The vertical alignment is aligned-to-bottom.

Usage

From source file:com.catexpress.util.FormatosPOI.java

public CellStyle estiloHeader(Workbook wb, int tipo) {
    Font fuente = wb.createFont();
    CreationHelper createHelper = wb.getCreationHelper();
    fuente.setFontName("Calibri");
    fuente.setBold(true);/* www  . j  a v a 2s  .c om*/

    if (tipo == TITULO || tipo == SUCURSAL || tipo == LABEL || tipo == FECHA) {
        fuente.setFontHeightInPoints((short) 16);
    } else if (tipo == USUARIO) {
        fuente.setFontHeightInPoints((short) 20);
    }

    CellStyle estiloCelda = wb.createCellStyle();
    estiloCelda.setFont(fuente);

    if (tipo == TITULO || tipo == USUARIO || tipo == LABEL || tipo == FECHA) {
        estiloCelda.setFillForegroundColor(IndexedColors.WHITE.getIndex());
    } else if (tipo == SUCURSAL) {
        estiloCelda.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    }
    estiloCelda.setFillPattern(CellStyle.SOLID_FOREGROUND);

    if (tipo == LABEL || tipo == FECHA) {
        estiloCelda.setWrapText(false);
    } else if (tipo == TITULO || tipo == SUCURSAL || tipo == USUARIO) {
        estiloCelda.setWrapText(true);
    }

    estiloCelda.setAlignment(HorizontalAlignment.CENTER);

    if (tipo == LABEL || tipo == FECHA) {
        estiloCelda.setVerticalAlignment(VerticalAlignment.BOTTOM);
    } else if (tipo == TITULO || tipo == SUCURSAL || tipo == USUARIO) {
        estiloCelda.setVerticalAlignment(VerticalAlignment.CENTER);
    }

    if (tipo == SUCURSAL) {
        estiloCelda.setBorderBottom(BorderStyle.MEDIUM);
        estiloCelda.setBorderTop(BorderStyle.MEDIUM);
        estiloCelda.setBorderLeft(BorderStyle.MEDIUM);
        estiloCelda.setBorderRight(BorderStyle.MEDIUM);
    }

    if (tipo == FECHA) {
        estiloCelda.setDataFormat(createHelper.createDataFormat().getFormat("dd \"de\" mmmm \"de\" yyyy"));
    }

    return estiloCelda;
}

From source file:jdbreport.model.io.xls.poi.Excel2003Writer.java

License:Apache License

protected VerticalAlignment convertVerticalAlign(int vAlignment) {
    switch (vAlignment) {
    case jdbreport.model.CellStyle.TOP:
        return VerticalAlignment.TOP;
    case jdbreport.model.CellStyle.BOTTOM:
        return VerticalAlignment.BOTTOM;
    case jdbreport.model.CellStyle.CENTER:
        return VerticalAlignment.CENTER;
    }//from  w w w  .ja  va2  s .  com
    return VerticalAlignment.TOP;
}

From source file:org.dashbuilder.dataset.service.DataSetExportServicesImpl.java

License:Apache License

private Map<String, CellStyle> createStyles(Workbook wb) {
    Map<String, CellStyle> styles = new HashMap<>();
    CellStyle style;/*w w w  .j a v a  2s  .co m*/

    Font titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short) 12);
    titleFont.setBold(true);
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(titleFont);
    style.setWrapText(false);
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(IndexedColors.GREY_80_PERCENT.getIndex());
    styles.put("header", style);

    Font cellFont = wb.createFont();
    cellFont.setFontHeightInPoints((short) 10);
    cellFont.setBold(true);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.RIGHT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat(BuiltinFormats.getBuiltinFormat(3)));
    styles.put("integer_number_cell", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.RIGHT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat(BuiltinFormats.getBuiltinFormat(4)));
    styles.put("decimal_number_cell", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.LEFT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat((short) BuiltinFormats.getBuiltinFormat("text"));
    styles.put(TEXT_CELL, style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat()
            .getFormat(DateFormatConverter.convert(Locale.getDefault(), dateFormatPattern)));
    styles.put("date_cell", style);
    return styles;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.HSSFCellStyleProducer.java

License:Open Source License

/**
 * Converts the given element alignment into one of the VerticalAlignment-constants.
 *
 * @param e the JFreeReport element alignment.
 * @return the VerticalAlignment-Alignment.
 * @throws IllegalArgumentException if an Unknown JFreeReport alignment is given.
 *///from   w  w  w.  ja va 2 s.c om
protected static VerticalAlignment convertVerticalAlignment(final ElementAlignment e) {
    if (ElementAlignment.TOP.equals(e)) {
        return VerticalAlignment.TOP;
    } else if (ElementAlignment.BOTTOM.equals(e)) {
        return VerticalAlignment.BOTTOM;
    } else if (ElementAlignment.MIDDLE.equals(e)) {
        return VerticalAlignment.CENTER;
    }

    throw new IllegalArgumentException("Invalid alignment");
}

From source file:uk.co.certait.htmlexporter.writer.excel.ExcelStyleGenerator.java

License:Apache License

protected void applyverticalAlignment(Style style, XSSFCellStyle cellStyle) {
    if (style.isVerticallyAlignedTop()) {
        cellStyle.setVerticalAlignment(VerticalAlignment.TOP);
    } else if (style.isVerticallyAlignedBottom()) {
        cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);
    } else if (style.isVerticallyAlignedMiddle()) {
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    }//from   www.j a  v a2 s  .c  om
}