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

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

Introduction

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

Prototype

@Removal(version = "4.2")
@Deprecated
HorizontalAlignment getAlignmentEnum();

Source Link

Document

get the type of horizontal alignment for the cell

Usage

From source file:org.tiefaces.components.websheet.utility.CellStyleUtility.java

License:MIT License

/**
 * Gets the alignment from cell./*from   ww w  . j ava 2s.c  o m*/
 *
 * @param poiCell
 *            the poi cell
 * @param cellStyle
 *            the cell style
 * @return the alignment from cell
 */
private static String getAlignmentFromCell(final Cell poiCell, final CellStyle cellStyle) {

    String style = "";
    switch (cellStyle.getAlignmentEnum()) {
    case LEFT:
        style = TieConstants.TEXT_ALIGN_LEFT;
        break;
    case RIGHT:
        style = TieConstants.TEXT_ALIGN_RIGHT;
        break;
    case CENTER:
        style = TieConstants.TEXT_ALIGN_CENTER;
        break;
    case GENERAL:
        style = getAlignmentFromCellType(poiCell);
        break;
    default:
        break;
    }
    return style;
}

From source file:uk.co.certait.test.ExcelToHtmlConverter.java

License:Apache License

private void styleContents(CellStyle style) {
    styleOut("text-align", style.getAlignmentEnum(), HALIGN);
    styleOut("vertical-align", style.getVerticalAlignmentEnum(), VALIGN);
    fontStyle(style);/*from w  w  w. j a va  2 s.c  o m*/
    borderStyles(style);
    helper.colorStyles(style, out);
}

From source file:uk.co.certait.test.ExcelToHtmlConverter.java

License:Apache License

private String tagStyle(Cell cell, CellStyle style) {
    if (style.getAlignmentEnum() == HorizontalAlignment.GENERAL) {
        switch (ultimateCellType(cell)) {
        case STRING:
            return "style=\"text-align: left;\"";
        case BOOLEAN:
        case ERROR:
            return "style=\"text-align: center;\"";
        case NUMERIC:
        default:/*from   www  .  java  2s .com*/
            // "right" is the default
            break;
        }
    }
    return "";
}