use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSLFTableCell method setBorderColor.
@Override
public void setBorderColor(BorderEdge edge, Color color) {
if (color == null) {
throw new IllegalArgumentException("Colors need to be specified.");
}
CTLineProperties ln = setBorderDefaults(edge);
CTSolidColorFillProperties fill = ln.addNewSolidFill();
XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
c.setColor(color);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSLFTableCell method setFillColor.
/**
* Specifies a solid color fill. The shape is filled entirely with the specified color.
*
* @param color the solid color fill.
* The value of <code>null</code> unsets the solidFIll attribute from the underlying xml
*/
@Override
public void setFillColor(Color color) {
CTTableCellProperties spPr = getCellProperties(true);
if (color == null) {
if (spPr.isSetSolidFill()) {
spPr.unsetSolidFill();
}
} else {
CTSolidColorFillProperties fill = spPr.isSetSolidFill() ? spPr.getSolidFill() : spPr.addNewSolidFill();
XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
c.setColor(color);
}
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSLFTextRun method setFontColor.
@Override
public void setFontColor(PaintStyle color) {
if (!(color instanceof SolidPaint)) {
throw new IllegalArgumentException("Currently only SolidPaint is supported!");
}
SolidPaint sp = (SolidPaint) color;
Color c = DrawPaint.applyColorTransform(sp.getSolidColor());
CTTextCharacterProperties rPr = getRPr(true);
CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill();
XSLFColor col = new XSLFColor(fill, getParentParagraph().getParentShape().getSheet().getTheme(), fill.getSchemeClr());
col.setColor(c);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSLFTableCell method getBorderColor.
public Color getBorderColor(BorderEdge edge) {
CTLineProperties ln = getCTLine(edge, false);
if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill()) {
return null;
}
CTSolidColorFillProperties fill = ln.getSolidFill();
XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
return c.getColor();
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSSFShape method setFillColor.
@Override
public void setFillColor(int red, int green, int blue) {
CTShapeProperties props = getShapeProperties();
CTSolidColorFillProperties fill = props.isSetSolidFill() ? props.getSolidFill() : props.addNewSolidFill();
CTSRgbColor rgb = CTSRgbColor.Factory.newInstance();
rgb.setVal(new byte[] { (byte) red, (byte) green, (byte) blue });
fill.setSrgbClr(rgb);
}
Aggregations