Search in sources :

Example 6 with CTColor

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

the class XSSFBorderFormatting method setRightBorderColor.

@Override
public void setRightBorderColor(short color) {
    CTColor ctColor = CTColor.Factory.newInstance();
    ctColor.setIndexed(color);
    setRightBorderColor(ctColor);
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 7 with CTColor

use of org.openxmlformats.schemas.drawingml.x2006.main.CTColor 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() });
}
Also used : SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint) Color(java.awt.Color) CTColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColor) CTSRgbColor(org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor) CTTextParagraphProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties) CTSRgbColor(org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor) CTColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColor)

Example 8 with CTColor

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

the class XSSFFont method getColor.

/**
     * get the indexed color value for the font
     * References a color defined in IndexedColors.
     *
     * @return short - indexed color to use
     * @see IndexedColors
     */
public short getColor() {
    CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0);
    if (color == null)
        return IndexedColors.BLACK.getIndex();
    long index = color.getIndexed();
    if (index == XSSFFont.DEFAULT_FONT_COLOR) {
        return IndexedColors.BLACK.getIndex();
    } else if (index == IndexedColors.RED.getIndex()) {
        return IndexedColors.RED.getIndex();
    } else {
        return (short) index;
    }
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 9 with CTColor

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

the class XSSFFont method setThemeColor.

/**
     * set the theme color for the font to use
     *
     * @param theme - theme color to use
     */
public void setThemeColor(short theme) {
    CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
    ctColor.setTheme(theme);
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor)

Example 10 with CTColor

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

the class XSSFFont method getThemeColor.

/**
     * get the color value for the font
     * References a color defined in theme.
     *
     * @return short - theme defined to use
     */
public short getThemeColor() {
    CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0);
    long index = color == null ? 0 : color.getTheme();
    return (short) index;
}
Also used : CTColor(org.openxmlformats.schemas.spreadsheetml.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