use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties 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.CTSolidColorFillProperties 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.CTSolidColorFillProperties 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();
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSLFBackground method setFillColor.
public void setFillColor(Color color) {
CTBackgroundProperties bgPr = getBgPr(true);
if (color == null) {
if (bgPr.isSetSolidFill()) {
bgPr.unsetSolidFill();
}
if (!bgPr.isSetNoFill()) {
bgPr.addNewNoFill();
}
} else {
if (bgPr.isSetNoFill()) {
bgPr.unsetNoFill();
}
CTSolidColorFillProperties fill = bgPr.isSetSolidFill() ? bgPr.getSolidFill() : bgPr.addNewSolidFill();
XSLFColor col = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
col.setColor(color);
}
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties in project poi by apache.
the class XSSFSimpleShape method prototype.
/**
* Prototype with the default structure of a new auto-shape.
*/
protected static CTShape prototype() {
if (prototype == null) {
CTShape shape = CTShape.Factory.newInstance();
CTShapeNonVisual nv = shape.addNewNvSpPr();
CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
nvp.setId(1);
nvp.setName("Shape 1");
nv.addNewCNvSpPr();
CTShapeProperties sp = shape.addNewSpPr();
CTTransform2D t2d = sp.addNewXfrm();
CTPositiveSize2D p1 = t2d.addNewExt();
p1.setCx(0);
p1.setCy(0);
CTPoint2D p2 = t2d.addNewOff();
p2.setX(0);
p2.setY(0);
CTPresetGeometry2D geom = sp.addNewPrstGeom();
geom.setPrst(STShapeType.RECT);
geom.addNewAvLst();
CTTextBody body = shape.addNewTxBody();
CTTextBodyProperties bodypr = body.addNewBodyPr();
bodypr.setAnchor(STTextAnchoringType.T);
bodypr.setRtlCol(false);
CTTextParagraph p = body.addNewP();
p.addNewPPr().setAlgn(STTextAlignType.L);
CTTextCharacterProperties endPr = p.addNewEndParaRPr();
endPr.setLang("en-US");
endPr.setSz(1100);
CTSolidColorFillProperties scfpr = endPr.addNewSolidFill();
scfpr.addNewSrgbClr().setVal(new byte[] { 0, 0, 0 });
body.addNewLstStyle();
prototype = shape;
}
return prototype;
}
Aggregations