Example usage for org.apache.poi.xssf.usermodel XSSFCellStyle getVerticalAlignment

List of usage examples for org.apache.poi.xssf.usermodel XSSFCellStyle getVerticalAlignment

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFCellStyle getVerticalAlignment.

Prototype

@Override
    public VerticalAlignment getVerticalAlignment() 

Source Link

Usage

From source file:de.escnet.ExcelTable.java

License:Open Source License

private void styleVerticalAlignment(Map<String, String> styles, XSSFCell cell) {
    XSSFCellStyle cellStyle = cell.getCellStyle();
    if (cellStyle != null) {
        short alignment = cellStyle.getVerticalAlignment();
        if (alignment == XSSFCellStyle.VERTICAL_BOTTOM) {
            styles.put("vertical-align", "bottom");
            return;
        }/*from  w  w  w  .j ava 2s  . c o m*/

        if (alignment == XSSFCellStyle.VERTICAL_CENTER) {
            styles.put("vertical-align", "middle");
            return;
        }
    }

    styles.put("vertical-align", "top");
}

From source file:net.mcnewfamily.rmcnew.shared.Util.java

License:Open Source License

public static void copyXSSFCellStyle(XSSFCell srcCell, XSSFCell destCell) {
    XSSFCellStyle srcCellStyle = srcCell.getCellStyle();
    XSSFCellStyle destCellStyle = destCell.getCellStyle();
    //        destCellStyle.cloneStyleFrom(srcCellStyle);
    destCellStyle.setAlignment(srcCellStyle.getAlignment());
    destCellStyle.setVerticalAlignment(srcCellStyle.getVerticalAlignment());
    destCellStyle.setFont(srcCellStyle.getFont());
    destCellStyle.setBorderBottom(srcCellStyle.getBorderBottom());
    destCellStyle.setBorderLeft(srcCellStyle.getBorderLeft());
    destCellStyle.setBorderRight(srcCellStyle.getBorderRight());
    destCellStyle.setBorderTop(srcCellStyle.getBorderTop());
    destCellStyle.setFillPattern(srcCellStyle.getFillPattern());
    // foreground color must be set before background color is set
    destCellStyle.setFillForegroundColor(srcCellStyle.getFillForegroundColor());
    destCellStyle.setFillBackgroundColor(srcCellStyle.getFillBackgroundColor());
    destCellStyle.setIndention(srcCellStyle.getIndention());
    destCellStyle.setWrapText(srcCellStyle.getWrapText());
    destCell.setCellStyle(destCellStyle);
}