Example usage for org.apache.poi.ss.usermodel CellStyle setVerticalAlignment

List of usage examples for org.apache.poi.ss.usermodel CellStyle setVerticalAlignment

Introduction

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

Prototype

void setVerticalAlignment(VerticalAlignment align);

Source Link

Document

set the type of vertical alignment for the cell

Usage

From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl.java

License:Apache License

@Override
public CellStyle stringNoneStyle(Workbook workbook, boolean isWarp) {
    CellStyle style = workbook.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setDataFormat(STRING_FORMAT);/*from   ww w .  ja va  2  s  .  c  o m*/
    if (isWarp) {
        style.setWrapText(true);
    }
    return style;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerBorderImpl.java

License:Apache License

@Override
public CellStyle getHeaderStyle(short color) {
    CellStyle titleStyle = workbook.createCellStyle();
    Font font = workbook.createFont();
    font.setFontHeightInPoints((short) 12);
    titleStyle.setFont(font);/*from   www  .j av  a 2 s . c om*/
    titleStyle.setBorderLeft((short) 1); // 
    titleStyle.setBorderRight((short) 1); // ?
    titleStyle.setBorderBottom((short) 1);
    titleStyle.setBorderTop((short) 1);
    titleStyle.setAlignment(CellStyle.ALIGN_CENTER);
    titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    return titleStyle;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerBorderImpl.java

License:Apache License

@Override
public CellStyle stringNoneStyle(Workbook workbook, boolean isWarp) {
    CellStyle style = workbook.createCellStyle();
    style.setBorderLeft((short) 1); // 
    style.setBorderRight((short) 1); // ?
    style.setBorderBottom((short) 1);
    style.setBorderTop((short) 1);
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setDataFormat(STRING_FORMAT);/*from w w w  .ja  v  a 2 s .  com*/
    if (isWarp) {
        style.setWrapText(true);
    }
    return style;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerBorderImpl.java

License:Apache License

@Override
public CellStyle getTitleStyle(short color) {
    CellStyle titleStyle = workbook.createCellStyle();
    titleStyle.setBorderLeft((short) 1); // 
    titleStyle.setBorderRight((short) 1); // ?
    titleStyle.setBorderBottom((short) 1);
    titleStyle.setBorderTop((short) 1);
    titleStyle.setAlignment(CellStyle.ALIGN_CENTER);
    titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    titleStyle.setWrapText(true);//from w  w  w .ja  v a2s  . c om
    return titleStyle;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerColorImpl.java

License:Apache License

@Override
public CellStyle getHeaderStyle(short headerColor) {
    CellStyle titleStyle = workbook.createCellStyle();
    Font font = workbook.createFont();
    font.setFontHeightInPoints((short) 24);
    titleStyle.setFont(font);/*from w w  w. j  a  v a2s  . c  om*/
    titleStyle.setFillForegroundColor(headerColor);
    titleStyle.setAlignment(CellStyle.ALIGN_CENTER);
    titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    return titleStyle;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerColorImpl.java

License:Apache License

@Override
public CellStyle getTitleStyle(short color) {
    CellStyle titleStyle = workbook.createCellStyle();
    titleStyle.setFillForegroundColor(color); // 
    titleStyle.setAlignment(CellStyle.ALIGN_CENTER);
    titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    titleStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // 
    titleStyle.setWrapText(true);// ww  w. j ava2  s .  c om
    return titleStyle;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerColorImpl.java

License:Apache License

@Override
public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) {
    CellStyle style = workbook.createCellStyle();
    style.setBorderLeft((short) 1); // 
    style.setBorderRight((short) 1); // ?
    style.setBorderBottom((short) 1);
    style.setBorderTop((short) 1);
    style.setFillForegroundColor((short) 41); // 
    style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setDataFormat(STRING_FORMAT);/*www  .  j  a va2s .  c o  m*/
    if (isWarp) {
        style.setWrapText(true);
    }
    return style;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerDefaultImpl.java

License:Apache License

@Override
public CellStyle getTitleStyle(short color) {
    CellStyle titleStyle = workbook.createCellStyle();
    titleStyle.setAlignment(CellStyle.ALIGN_CENTER);
    titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    titleStyle.setWrapText(true);// w ww .ja  v  a 2  s  .co  m
    return titleStyle;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerDefaultImpl.java

License:Apache License

@Override
public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) {
    CellStyle style = workbook.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setDataFormat(STRING_FORMAT);/*from  w w w.ja v a 2  s .  c om*/
    if (isWarp) {
        style.setWrapText(true);
    }
    return style;
}

From source file:cn.bzvs.excel.export.styler.ExcelExportStylerDefaultImpl.java

License:Apache License

@Override
public CellStyle getHeaderStyle(short color) {
    CellStyle titleStyle = workbook.createCellStyle();
    Font font = workbook.createFont();
    font.setFontHeightInPoints((short) 12);
    titleStyle.setFont(font);/*from   www.j a va2 s  .  co  m*/
    titleStyle.setAlignment(CellStyle.ALIGN_CENTER);
    titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    return titleStyle;
}