use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder in project poi by apache.
the class XWPFTable method getInsideVBorderColor.
public String getInsideVBorderColor() {
String color = null;
CTTblPr tblPr = getTrPr();
if (tblPr.isSetTblBorders()) {
CTTblBorders ctb = tblPr.getTblBorders();
if (ctb.isSetInsideV()) {
CTBorder border = ctb.getInsideV();
color = border.xgetColor().getStringValue();
}
}
return color;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder in project poi by apache.
the class XWPFTable method getInsideHBorderSize.
public int getInsideHBorderSize() {
int size = -1;
CTTblPr tblPr = getTrPr();
if (tblPr.isSetTblBorders()) {
CTTblBorders ctb = tblPr.getTblBorders();
if (ctb.isSetInsideH()) {
CTBorder border = ctb.getInsideH();
size = border.getSz().intValue();
}
}
return size;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder in project poi by apache.
the class XWPFTable method getInsideHBorderSpace.
public int getInsideHBorderSpace() {
int space = -1;
CTTblPr tblPr = getTrPr();
if (tblPr.isSetTblBorders()) {
CTTblBorders ctb = tblPr.getTblBorders();
if (ctb.isSetInsideH()) {
CTBorder border = ctb.getInsideH();
space = border.getSpace().intValue();
}
}
return space;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder in project poi by apache.
the class XWPFTable method getInsideHBorderColor.
public String getInsideHBorderColor() {
String color = null;
CTTblPr tblPr = getTrPr();
if (tblPr.isSetTblBorders()) {
CTTblBorders ctb = tblPr.getTblBorders();
if (ctb.isSetInsideH()) {
CTBorder border = ctb.getInsideH();
color = border.xgetColor().getStringValue();
}
}
return color;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder in project poi by apache.
the class TestXSSFCellStyle method testGetSetBottomBorderColor.
@Test
public void testGetSetBottomBorderColor() {
//defaults
assertEquals(IndexedColors.BLACK.getIndex(), cellStyle.getBottomBorderColor());
assertNull(cellStyle.getBottomBorderXSSFColor());
int num = stylesTable.getBorders().size();
XSSFColor clr;
//setting indexed color
cellStyle.setBottomBorderColor(IndexedColors.BLUE_GREY.getIndex());
assertEquals(IndexedColors.BLUE_GREY.getIndex(), cellStyle.getBottomBorderColor());
clr = cellStyle.getBottomBorderXSSFColor();
assertTrue(clr.getCTColor().isSetIndexed());
assertEquals(IndexedColors.BLUE_GREY.getIndex(), clr.getIndexed());
//a new border was added to the styles table
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
int borderId = (int) cellStyle.getCoreXf().getBorderId();
assertTrue(borderId > 0);
//check changes in the underlying xml bean
CTBorder ctBorder = stylesTable.getBorderAt(borderId).getCTBorder();
assertEquals(IndexedColors.BLUE_GREY.getIndex(), ctBorder.getBottom().getColor().getIndexed());
//setting XSSFColor
num = stylesTable.getBorders().size();
clr = new XSSFColor(java.awt.Color.CYAN);
cellStyle.setBottomBorderColor(clr);
assertEquals(clr.getCTColor().toString(), cellStyle.getBottomBorderXSSFColor().getCTColor().toString());
byte[] rgb = cellStyle.getBottomBorderXSSFColor().getRGB();
assertEquals(java.awt.Color.CYAN, new java.awt.Color(rgb[0] & 0xFF, rgb[1] & 0xFF, rgb[2] & 0xFF));
//another border was added to the styles table
assertEquals(num + 1, stylesTable.getBorders().size());
//passing null unsets the color
cellStyle.setBottomBorderColor(null);
assertNull(cellStyle.getBottomBorderXSSFColor());
}
Aggregations