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);
}
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() });
}
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;
}
}
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);
}
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;
}
Aggregations