Search in sources :

Example 1 with CTSolidColorFillProperties

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);
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)

Example 2 with CTSolidColorFillProperties

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);
    }
}
Also used : CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties) CTTableCellProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties)

Example 3 with CTSolidColorFillProperties

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);
}
Also used : SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint) Color(java.awt.Color) CTSchemeColor(org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor) CTTextCharacterProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)

Example 4 with CTSolidColorFillProperties

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();
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)

Example 5 with CTSolidColorFillProperties

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);
}
Also used : CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties) CTSRgbColor(org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor)

Aggregations

CTSolidColorFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)13 CTLineProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)5 CTSRgbColor (org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor)5 CTTextCharacterProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties)4 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)3 Color (java.awt.Color)2 CTTableCellProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties)2 CTBackgroundProperties (org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties)2 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)1 Internal (org.apache.poi.util.Internal)1 XSLFFillProperties (org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties)1 XmlObject (org.apache.xmlbeans.XmlObject)1 CTBlipFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties)1 CTFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTFillProperties)1 CTGradientFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTGradientFillProperties)1 CTGroupFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTGroupFillProperties)1 CTNoFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTNoFillProperties)1 CTPatternFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTPatternFillProperties)1 CTPositiveFixedPercentage (org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveFixedPercentage)1 CTScRgbColor (org.openxmlformats.schemas.drawingml.x2006.main.CTScRgbColor)1