use of org.openxmlformats.schemas.wordprocessingml.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);
}
use of org.openxmlformats.schemas.wordprocessingml.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;
}
use of org.openxmlformats.schemas.wordprocessingml.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);
}
use of org.openxmlformats.schemas.wordprocessingml.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;
}
use of org.openxmlformats.schemas.wordprocessingml.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;
}
Aggregations