public byte[] getValue() { return color.getVal(); }
public String toRGBHex() { StringBuilder sb = new StringBuilder(6); for (byte b: color.getVal()) { sb.append(String.format(Locale.ROOT, "%02X", b)); } return sb.toString().toUpperCase(Locale.ROOT); } }
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); }
public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuClr()){ if(props.getBuClr().isSetSrgbClr()){ CTSRgbColor clr = props.getBuClr().getSrgbClr(); byte[] rgb = clr.getVal(); setValue(new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2])); return true; } } return false; } };
byte[] val = srgb.getVal(); color = new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]); } else if (ch instanceof CTSystemColor) {
if (ctColor.isSetSrgbClr()) { rgb = ctColor.getSrgbClr().getVal(); } else if (ctColor.isSetSysClr()) {
public byte[] getValue() { return color.getVal(); }
public String toRGBHex() { StringBuilder sb = new StringBuilder(6); for (byte b: color.getVal()) { sb.append(String.format(Locale.ROOT, "%02X", b)); } return sb.toString().toUpperCase(Locale.ROOT); } }
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); }
private Color getLineColor(CTLineProperties ln){ if(ln == null || ln.isSetNoFill() || !ln.isSetSolidFill()) return null; CTSolidColorFillProperties fill = ln.getSolidFill(); if(!fill.isSetSrgbClr()) { // TODO for now return null for all colors except explicit RGB return null; } byte[] val = fill.getSrgbClr().getVal(); return new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]); } /**
public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuClr()){ if(props.getBuClr().isSetSrgbClr()){ CTSRgbColor clr = props.getBuClr().getSrgbClr(); byte[] rgb = clr.getVal(); setValue(new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2])); return true; } } return false; } };
/** * * @return solid fill color of null if not set */ @Override public Color getFillColor(){ CTTableCellProperties spPr = getXmlObject().getTcPr(); if(!spPr.isSetSolidFill() ) return null; CTSolidColorFillProperties fill = spPr.getSolidFill(); if(!fill.isSetSrgbClr()) { // TODO for now return null for all colors except explicit RGB return null; } byte[] val = fill.getSrgbClr().getVal(); return new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]); }
} else if (ch instanceof CTSRgbColor) { CTSRgbColor srgb = (CTSRgbColor)ch; byte[] val = srgb.getVal(); color = new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]); } else if (ch instanceof CTSystemColor) {
public XSSFColor getThemeColor(int idx) { CTColorScheme colorScheme = theme.getTheme().getThemeElements().getClrScheme(); CTColor ctColor = null; int cnt = 0; for (XmlObject obj : colorScheme.selectPath("./*")) { if (obj instanceof org.openxmlformats.schemas.drawingml.x2006.main.CTColor) { if (cnt == idx) { ctColor = (org.openxmlformats.schemas.drawingml.x2006.main.CTColor) obj; byte[] rgb = null; if (ctColor.getSrgbClr() != null) { // Colour is a regular one rgb = ctColor.getSrgbClr().getVal(); } else if (ctColor.getSysClr() != null) { // Colour is a tint of white or black rgb = ctColor.getSysClr().getLastClr(); } return new XSSFColor(rgb); } cnt++; } } return null; }
byte[] val = srgb.getVal(); color = new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]); } else if (ch instanceof CTSystemColor) {
if (ctColor.isSetSrgbClr()) { rgb = ctColor.getSrgbClr().getVal(); } else if (ctColor.isSetSysClr()) {