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

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

Introduction

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

Prototype

@Override
public short getIndention() 

Source Link

Document

Get the number of spaces to indent the text in the cell

Usage

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);
}

From source file:org.bbreak.excella.core.test.util.TestUtil.java

License:Open Source License

private static String getCellStyleString(XSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if (cellStyle != null) {
        XSSFFont font = cellStyle.getFont();
        sb.append("Font=").append(font.getCTFont()).append(",");
        sb.append("DataFormat=").append(cellStyle.getDataFormat()).append(",");
        sb.append("DataFormatString=").append(cellStyle.getDataFormatString()).append(",");
        sb.append("Hidden=").append(cellStyle.getHidden()).append(",");
        sb.append("Locked=").append(cellStyle.getLocked()).append(",");
        sb.append("Alignment=").append(cellStyle.getAlignmentEnum()).append(",");
        sb.append("WrapText=").append(cellStyle.getWrapText()).append(",");
        sb.append("VerticalAlignment=").append(cellStyle.getVerticalAlignmentEnum()).append(",");
        sb.append("Rotation=").append(cellStyle.getRotation()).append(",");
        sb.append("Indention=").append(cellStyle.getIndention()).append(",");
        sb.append("BorderLeft=").append(cellStyle.getBorderLeftEnum()).append(",");
        sb.append("BorderRight=").append(cellStyle.getBorderRightEnum()).append(",");
        sb.append("BorderTop=").append(cellStyle.getBorderTopEnum()).append(",");
        sb.append("BorderBottom=").append(cellStyle.getBorderBottomEnum()).append(",");

        sb.append("LeftBorderColor=").append(getXSSFColorString(cellStyle.getLeftBorderXSSFColor()))
                .append(",");
        sb.append("RightBorderColor=").append(getXSSFColorString(cellStyle.getRightBorderXSSFColor()))
                .append(",");
        sb.append("TopBorderColor=").append(getXSSFColorString(cellStyle.getTopBorderXSSFColor())).append(",");
        sb.append("BottomBorderColor=").append(getXSSFColorString(cellStyle.getBottomBorderXSSFColor()))
                .append(",");

        sb.append("FillPattern=").append(cellStyle.getFillPatternEnum()).append(",");
        sb.append("FillForegroundColor=").append(getXSSFColorString(cellStyle.getFillForegroundXSSFColor()))
                .append(",");
        sb.append("FillBackgroundColor=").append(getXSSFColorString(cellStyle.getFillBackgroundXSSFColor()));
    }// www  .j  av  a2  s .c  o m
    return sb.toString();
}

From source file:org.bbreak.excella.reports.ReportsTestUtil.java

License:Open Source License

/**
 * XSSF????//  w  ww.j a  v  a 2s . com
 * 
 * @param cellStyle 
 * @return ??
 */
private static String getCellStyleString(XSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if (cellStyle != null) {
        XSSFFont font = cellStyle.getFont();
        sb.append("Font=").append(font.getCTFont()).append(",");
        sb.append("DataFormat=").append(cellStyle.getDataFormat()).append(",");
        sb.append("DataFormatString=").append(cellStyle.getDataFormatString()).append(",");
        sb.append("Hidden=").append(cellStyle.getHidden()).append(",");
        sb.append("Locked=").append(cellStyle.getLocked()).append(",");
        sb.append("Alignment=").append(cellStyle.getAlignmentEnum()).append(",");
        sb.append("WrapText=").append(cellStyle.getWrapText()).append(",");
        sb.append("VerticalAlignment=").append(cellStyle.getVerticalAlignmentEnum()).append(",");
        sb.append("Rotation=").append(cellStyle.getRotation()).append(",");
        sb.append("Indention=").append(cellStyle.getIndention()).append(",");
        sb.append("BorderLeft=").append(cellStyle.getBorderLeftEnum()).append(",");
        sb.append("BorderRight=").append(cellStyle.getBorderRightEnum()).append(",");
        sb.append("BorderTop=").append(cellStyle.getBorderTopEnum()).append(",");
        sb.append("BorderBottom=").append(cellStyle.getBorderBottomEnum()).append(",");

        sb.append("LeftBorderColor=").append(getXSSFColorString(cellStyle.getLeftBorderXSSFColor()))
                .append(",");
        sb.append("RightBorderColor=").append(getXSSFColorString(cellStyle.getRightBorderXSSFColor()))
                .append(",");
        sb.append("TopBorderColor=").append(getXSSFColorString(cellStyle.getTopBorderXSSFColor())).append(",");
        sb.append("BottomBorderColor=").append(getXSSFColorString(cellStyle.getBottomBorderXSSFColor()))
                .append(",");

        sb.append("FillPattern=").append(cellStyle.getFillPatternEnum()).append(",");
        try {
            sb.append("FillForegroundColor=").append(getXSSFColorString(cellStyle.getFillForegroundXSSFColor()))
                    .append(",");
        } catch (NullPointerException e) {
            // POI-3.7???
            sb.append("FillForegroundColor=none,");
        }

        try {
            sb.append("FillBackgroundColor=")
                    .append(getXSSFColorString(cellStyle.getFillBackgroundXSSFColor()));
        } catch (NullPointerException e) {
            // POI-3.7???
            sb.append("FillBackgroundColor=none,");
        }
    }
    return sb.toString();
}