Search in sources :

Example 1 with CTBorderPr

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr in project poi by apache.

the class XSSFCellStyle method setRightBorderColor.

/**
     * Set the color to use for the right border as a {@link XSSFColor} value
     *
     * @param color the color to use
     */
public void setRightBorderColor(XSSFColor color) {
    CTBorder ct = getCTBorder();
    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 = _stylesSource.putBorder(new XSSFCellBorder(ct, _theme, _stylesSource.getIndexedColors()));
    _cellXf.setBorderId(idx);
    _cellXf.setApplyBorder(true);
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) CTBorderPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr) XSSFCellBorder(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)

Example 2 with CTBorderPr

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr in project poi by apache.

the class XSSFCellStyle method setBorderRight.

/**
     * Set the type of border to use for the right border of the cell
      *
     * @param border the type of border to use
     * @since POI 3.15
     */
@Override
public void setBorderRight(BorderStyle border) {
    CTBorder ct = getCTBorder();
    CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
    if (border == BorderStyle.NONE)
        ct.unsetRight();
    else
        pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1));
    int idx = _stylesSource.putBorder(new XSSFCellBorder(ct, _theme, _stylesSource.getIndexedColors()));
    _cellXf.setBorderId(idx);
    _cellXf.setApplyBorder(true);
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) CTBorderPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr) XSSFCellBorder(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)

Example 3 with CTBorderPr

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr in project poi by apache.

the class XSSFCellBorder method getBorderStyle.

/**
     * Get the type of border to use for the selected border
     *
     * @param side -  - where to apply the color definition
     * @return borderstyle - the type of border to use. default value is NONE if border style is not set.
     * @see BorderStyle
     */
public BorderStyle getBorderStyle(BorderSide side) {
    CTBorderPr ctBorder = getBorder(side);
    STBorderStyle.Enum border = ctBorder == null ? STBorderStyle.NONE : ctBorder.getStyle();
    return BorderStyle.values()[border.intValue() - 1];
}
Also used : CTBorderPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr) STBorderStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)

Example 4 with CTBorderPr

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr in project poi by apache.

the class XSSFCellStyle method setBorderTop.

/**
     * Set the type of border to use for the top border of the cell
     *
     * @param border the type of border to use
     * @since POI 3.15
     */
@Override
public void setBorderTop(BorderStyle border) {
    CTBorder ct = getCTBorder();
    CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
    if (border == BorderStyle.NONE)
        ct.unsetTop();
    else
        pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1));
    int idx = _stylesSource.putBorder(new XSSFCellBorder(ct, _theme, _stylesSource.getIndexedColors()));
    _cellXf.setBorderId(idx);
    _cellXf.setApplyBorder(true);
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) CTBorderPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr) XSSFCellBorder(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)

Example 5 with CTBorderPr

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr in project poi by apache.

the class XSSFCellStyle method setTopBorderColor.

/**
     * Set the color to use for the top border as a {@link XSSFColor} value
     *
     * @param color the color to use
     */
public void setTopBorderColor(XSSFColor color) {
    CTBorder ct = getCTBorder();
    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 = _stylesSource.putBorder(new XSSFCellBorder(ct, _theme, _stylesSource.getIndexedColors()));
    _cellXf.setBorderId(idx);
    _cellXf.setApplyBorder(true);
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) CTBorderPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr) XSSFCellBorder(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)

Aggregations

CTBorderPr (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr)10 CTBorder (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder)9 XSSFCellBorder (org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)8 CTStylesheet (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTStylesheet)1 STBorderStyle (org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)1