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

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

Introduction

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

Prototype

@Removal(version = "4.2")
@Deprecated
BorderStyle getBorderRightEnum();

Source Link

Document

get the type of border to use for the right border of the cell

Usage

From source file:guru.qas.martini.report.DefaultState.java

License:Apache License

protected void colorRow(short color, Row row) {
    short firstCellNum = row.getFirstCellNum();
    short lastCellNum = row.getLastCellNum();
    for (int i = firstCellNum; i <= lastCellNum; i++) {
        Cell cell = row.getCell(i);/*from   w  w w  . java2s.  c om*/
        if (null != cell) {
            CellStyle cellStyle = cell.getCellStyle();
            Workbook workbook = cell.getSheet().getWorkbook();
            CellStyle clone = workbook.createCellStyle();

            clone.cloneStyleFrom(cellStyle);
            clone.setFillForegroundColor(color);
            clone.setFillPattern(FillPatternType.SOLID_FOREGROUND);

            BorderStyle borderStyle = cellStyle.getBorderLeftEnum();
            clone.setBorderLeft(BorderStyle.NONE == borderStyle ? BorderStyle.THIN : borderStyle);
            short borderColor = cellStyle.getLeftBorderColor();
            clone.setLeftBorderColor(0 == borderColor ? IndexedColors.BLACK.getIndex() : borderColor);

            borderStyle = cellStyle.getBorderRightEnum();
            clone.setBorderRight(BorderStyle.NONE == borderStyle ? BorderStyle.THIN : borderStyle);
            borderColor = cellStyle.getRightBorderColor();
            clone.setRightBorderColor(0 == borderColor ? IndexedColors.BLACK.getIndex() : borderColor);

            borderStyle = cellStyle.getBorderTopEnum();
            clone.setBorderTop(BorderStyle.NONE == borderStyle ? BorderStyle.THIN : borderStyle);
            borderColor = cellStyle.getTopBorderColor();
            clone.setTopBorderColor(0 == borderColor ? IndexedColors.BLACK.getIndex() : borderColor);

            borderStyle = cellStyle.getBorderBottomEnum();
            clone.setBorderBottom(BorderStyle.NONE == borderStyle ? BorderStyle.THIN : borderStyle);
            borderColor = cellStyle.getBottomBorderColor();
            clone.setBottomBorderColor(borderColor);
            cell.setCellStyle(clone);
        }
    }
}

From source file:org.sysmodb.xml.XMLStyleGenerator.java

License:BSD License

public static boolean isStyleEmpty(CellStyle style, XMLStyleHelper helper) {

    if (style.getBorderTopEnum() != BorderStyle.NONE)
        return false;
    if (style.getBorderBottomEnum() != BorderStyle.NONE)
        return false;
    if (style.getBorderLeftEnum() != BorderStyle.NONE)
        return false;
    if (style.getBorderRightEnum() != BorderStyle.NONE)
        return false;

    // Background/fill colour
    if ((helper.getBGColour(style)) != null)
        return false;

    return helper.areFontsEmpty(style);
}

From source file:org.sysmodb.xml.XMLStyleGenerator.java

License:BSD License

public static void writeStyle(XMLStreamWriter xmlWriter, CellStyle style, XMLStyleHelper helper)
        throws XMLStreamException {
    String border = "none";
    xmlWriter.writeStartElement("style");
    xmlWriter.writeAttribute("id", "style" + style.getIndex());
    if ((border = BORDERS.get(style.getBorderTopEnum())) != "none") {
        xmlWriter.writeStartElement("border-top");
        xmlWriter.writeCharacters(border);
        xmlWriter.writeEndElement();/* w w  w.  j  a  v a  2s.c  o  m*/
    }

    if ((border = BORDERS.get(style.getBorderBottomEnum())) != "none") {
        xmlWriter.writeStartElement("border-bottom");
        xmlWriter.writeCharacters(border);
        xmlWriter.writeEndElement();
    }

    if ((border = BORDERS.get(style.getBorderLeftEnum())) != "none") {
        xmlWriter.writeStartElement("border-left");
        xmlWriter.writeCharacters(border);
        xmlWriter.writeEndElement();
    }

    if ((border = BORDERS.get(style.getBorderRightEnum())) != "none") {
        xmlWriter.writeStartElement("border-right");
        xmlWriter.writeCharacters(border);
        xmlWriter.writeEndElement();
    }

    // Background/fill colour
    String backgroundColour;
    if ((backgroundColour = helper.getBGColour(style)) != null) {
        xmlWriter.writeStartElement("background-color");
        xmlWriter.writeCharacters(backgroundColour);
        xmlWriter.writeEndElement();
    }

    helper.writeFontProperties(xmlWriter, style);

    xmlWriter.writeEndElement();

}

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

License:Apache License

private void borderStyles(CellStyle style) {
    styleOut("border-left", style.getBorderLeftEnum(), BORDER);
    styleOut("border-right", style.getBorderRightEnum(), BORDER);
    styleOut("border-top", style.getBorderTopEnum(), BORDER);
    styleOut("border-bottom", style.getBorderBottomEnum(), BORDER);
}