Search in sources :

Example 11 with CTColor

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor in project poi by apache.

the class XSSFFont method setColor.

/**
     * set the color for the font in Standard Alpha Red Green Blue color value
     *
     * @param color - color to use
     */
public void setColor(XSSFColor color) {
    if (color == null)
        _ctFont.setColorArray(null);
    else {
        CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
        if (ctColor.isSetIndexed()) {
            ctColor.unsetIndexed();
        }
        ctColor.setRgb(color.getRGB());
    }
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 12 with CTColor

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor in project poi by apache.

the class XSSFPatternFormatting method setFillBackgroundColor.

public void setFillBackgroundColor(short bg) {
    CTColor bgColor = CTColor.Factory.newInstance();
    bgColor.setIndexed(bg);
    setFillBackgroundColor(bgColor);
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 13 with CTColor

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor in project poi by apache.

the class XSSFPatternFormatting method setFillForegroundColor.

public void setFillForegroundColor(short fg) {
    CTColor fgColor = CTColor.Factory.newInstance();
    fgColor.setIndexed(fg);
    setFillForegroundColor(fgColor);
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 14 with CTColor

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor in project poi by apache.

the class XSSFFontFormatting method getFontColorIndex.

/**
     * @return font color index
     */
@Override
public short getFontColorIndex() {
    if (_font.sizeOfColorArray() == 0)
        return -1;
    int idx = 0;
    CTColor color = _font.getColorArray(0);
    if (color.isSetIndexed())
        idx = (int) color.getIndexed();
    return (short) idx;
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 15 with CTColor

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor in project poi by apache.

the class XWPFRun method getColor.

/**
     * Get text color. The returned value is a string in the hex form "RRGGBB".
     */
public String getColor() {
    String color = null;
    if (run.isSetRPr()) {
        CTRPr pr = run.getRPr();
        if (pr.isSetColor()) {
            CTColor clr = pr.getColor();
            color = clr.xgetVal().getStringValue();
        }
    }
    return color;
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) XmlString(org.apache.xmlbeans.XmlString) CTColor(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTColor)

Aggregations

CTColor (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)27 Test (org.junit.Test)12 CTColor (org.openxmlformats.schemas.drawingml.x2006.main.CTColor)10 CTPatternFill (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPatternFill)6 CTSRgbColor (org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor)5 Color (java.awt.Color)4 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)4 CTHslColor (org.openxmlformats.schemas.drawingml.x2006.main.CTHslColor)4 CTSystemColor (org.openxmlformats.schemas.drawingml.x2006.main.CTSystemColor)4 CTFont (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont)4 PresetColor (org.apache.poi.sl.usermodel.PresetColor)3 XmlObject (org.apache.xmlbeans.XmlObject)2 CTColorScheme (org.openxmlformats.schemas.drawingml.x2006.main.CTColorScheme)2 CTFill (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFill)2 CTColor (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTColor)2 CTRPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr)2 FileOutputStream (java.io.FileOutputStream)1 LinkedHashMap (java.util.LinkedHashMap)1 DrawPaint (org.apache.poi.sl.draw.DrawPaint)1 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)1