Search in sources :

Example 1 with CTBorder

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder 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 CTBorder

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

the class XSSFCellStyle method getCTBorder.

/**
     * Get a <b>copy</b> of the currently used CTBorder, if none is used, return a new instance.
     */
private CTBorder getCTBorder() {
    CTBorder ct;
    if (_cellXf.getApplyBorder()) {
        int idx = (int) _cellXf.getBorderId();
        XSSFCellBorder cf = _stylesSource.getBorderAt(idx);
        ct = (CTBorder) cf.getCTBorder().copy();
    } else {
        ct = CTBorder.Factory.newInstance();
    }
    return ct;
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) XSSFCellBorder(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)

Example 3 with CTBorder

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder 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 4 with CTBorder

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

the class XWPFTable method getInsideVBorderSize.

public int getInsideVBorderSize() {
    int size = -1;
    CTTblPr tblPr = getTrPr();
    if (tblPr.isSetTblBorders()) {
        CTTblBorders ctb = tblPr.getTblBorders();
        if (ctb.isSetInsideV()) {
            CTBorder border = ctb.getInsideV();
            size = border.getSz().intValue();
        }
    }
    return size;
}
Also used : CTTblBorders(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders) CTBorder(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder) CTTblPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr)

Example 5 with CTBorder

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

the class XWPFTable method getInsideVBorderSpace.

public int getInsideVBorderSpace() {
    int space = -1;
    CTTblPr tblPr = getTrPr();
    if (tblPr.isSetTblBorders()) {
        CTTblBorders ctb = tblPr.getTblBorders();
        if (ctb.isSetInsideV()) {
            CTBorder border = ctb.getInsideV();
            space = border.getSpace().intValue();
        }
    }
    return space;
}
Also used : CTTblBorders(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders) CTBorder(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder) CTTblPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr)

Aggregations

CTBorder (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder)25 CTBorder (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder)11 Test (org.junit.Test)10 CTBorderPr (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr)10 CTTblBorders (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders)10 CTTblPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr)10 XSSFCellBorder (org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder)9 STBorderStyle (org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)5 CTString (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString)2 POIXMLException (org.apache.poi.POIXMLException)1 XmlException (org.apache.xmlbeans.XmlException)1 CTFill (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFill)1 CTFont (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont)1 CTStylesheet (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTStylesheet)1 CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)1 CTPBdr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPBdr)1 CTPPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr)1