Example usage for org.apache.poi.xssf.usermodel.extensions XSSFCellBorder XSSFCellBorder

List of usage examples for org.apache.poi.xssf.usermodel.extensions XSSFCellBorder XSSFCellBorder

Introduction

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

Prototype

public XSSFCellBorder(CTBorder border) 

Source Link

Document

Creates a Cell Border from the supplied XML definition

Usage

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

public void setBorderBottom(short border) {
    CTBorder ct = getCTBorder();//  w  w w  .  j  a  v a 2  s  .  co  m
    CTBorderPr pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
    if (border == org.apache.poi.ss.usermodel.CellStyle.BORDER_NONE)
        ct.unsetBottom();
    else
        pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

public void setBorderLeft(short border) {
    CTBorder ct = getCTBorder();/*  w w  w.  j ava2 s  .c  om*/
    CTBorderPr pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
    if (border == org.apache.poi.ss.usermodel.CellStyle.BORDER_NONE)
        ct.unsetLeft();
    else
        pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

public void setBorderRight(short border) {
    CTBorder ct = getCTBorder();/*from  w w w  .  ja  v a 2s .c o m*/
    CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
    if (border == org.apache.poi.ss.usermodel.CellStyle.BORDER_NONE)
        ct.unsetRight();
    else
        pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

public void setBorderTop(short border) {
    CTBorder ct = getCTBorder();/* w  w w  .java2s .c o  m*/
    CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
    if (border == org.apache.poi.ss.usermodel.CellStyle.BORDER_NONE)
        ct.unsetTop();
    else
        pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

private void setBottomBorderColor(XSSFColor color) {
    CTBorder ct = getCTBorder();//ww  w .jav  a  2  s  .c o m
    if (color == null && !ct.isSetBottom())
        return;

    CTBorderPr pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
    if (color != null)
        pr.setColor(color.getCTColor());
    else
        pr.unsetColor();

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

private void setLeftBorderColor(XSSFColor color) {
    CTBorder ct = getCTBorder();/*from   w w  w  .  j ava 2 s  .  com*/
    if (color == null && !ct.isSetLeft())
        return;

    CTBorderPr pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
    if (color != null)
        pr.setColor(color.getCTColor());
    else
        pr.unsetColor();

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

private void setRightBorderColor(XSSFColor color) {
    CTBorder ct = getCTBorder();//from ww w.  j  a v a2 s. c  om
    if (color == null && !ct.isSetRight())
        return;

    CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
    if (color != null)
        pr.setColor(color.getCTColor());
    else
        pr.unsetColor();

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}

From source file:com.miraisolutions.xlconnect.XCellStyle.java

License:Open Source License

private void setTopBorderColor(XSSFColor color) {
    CTBorder ct = getCTBorder();//from   w w w . jav a 2  s  .c o  m
    if (color == null && !ct.isSetTop())
        return;

    CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
    if (color != null)
        pr.setColor(color.getCTColor());
    else
        pr.unsetColor();

    int idx = workbook.getStylesSource().putBorder(new XSSFCellBorder(ct));

    CTXf xf = getXf();
    xf.setBorderId(idx);
    xf.setApplyBorder(true);
    getCoreXf().setBorderId(idx);
}