use of org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor in project poi by apache.
the class XSLFTextParagraph method setBulletFontColor.
/**
* Set the color to be used on bullet characters within a given paragraph.
*
* @param color the bullet color
*/
public void setBulletFontColor(PaintStyle color) {
if (!(color instanceof SolidPaint)) {
throw new IllegalArgumentException("Currently XSLF only supports SolidPaint");
}
// TODO: implement setting bullet color to null
SolidPaint sp = (SolidPaint) color;
Color col = DrawPaint.applyColorTransform(sp.getSolidColor());
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr();
CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr();
clr.setVal(new byte[] { (byte) col.getRed(), (byte) col.getGreen(), (byte) col.getBlue() });
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor 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);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor in project poi by apache.
the class XSSFShape method setLineStyleColor.
@Override
public void setLineStyleColor(int red, int green, int blue) {
CTShapeProperties props = getShapeProperties();
CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn();
CTSolidColorFillProperties fill = ln.isSetSolidFill() ? ln.getSolidFill() : ln.addNewSolidFill();
CTSRgbColor rgb = CTSRgbColor.Factory.newInstance();
rgb.setVal(new byte[] { (byte) red, (byte) green, (byte) blue });
fill.setSrgbClr(rgb);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor in project poi by apache.
the class XSSFTextRun method getFontColor.
public Color getFontColor() {
CTTextCharacterProperties rPr = getRPr();
if (rPr.isSetSolidFill()) {
CTSolidColorFillProperties fill = rPr.getSolidFill();
if (fill.isSetSrgbClr()) {
CTSRgbColor clr = fill.getSrgbClr();
byte[] rgb = clr.getVal();
return new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2]);
}
}
return new Color(0, 0, 0);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor in project poi by apache.
the class XSSFTextRun method setFontColor.
public void setFontColor(Color color) {
CTTextCharacterProperties rPr = getRPr();
CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill();
CTSRgbColor clr = fill.isSetSrgbClr() ? fill.getSrgbClr() : fill.addNewSrgbClr();
clr.setVal(new byte[] { (byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue() });
if (fill.isSetHslClr())
fill.unsetHslClr();
if (fill.isSetPrstClr())
fill.unsetPrstClr();
if (fill.isSetSchemeClr())
fill.unsetSchemeClr();
if (fill.isSetScrgbClr())
fill.unsetScrgbClr();
if (fill.isSetSysClr())
fill.unsetSysClr();
}
Aggregations