public void setFontFamily(String typeface, byte charset, byte pictAndFamily, boolean isSymbol){ CTTextCharacterProperties rPr = getRPr(); if(typeface == null){ if(rPr.isSetLatin()) rPr.unsetLatin(); if(rPr.isSetCs()) rPr.unsetCs(); if(rPr.isSetSym()) rPr.unsetSym(); } else { if(isSymbol){ CTTextFont font = rPr.isSetSym() ? rPr.getSym() : rPr.addNewSym(); font.setTypeface(typeface); } else { CTTextFont latin = rPr.isSetLatin() ? rPr.getLatin() : rPr.addNewLatin(); latin.setTypeface(typeface); if(charset != -1) latin.setCharset(charset); if(pictAndFamily != -1) latin.setPitchFamily(pictAndFamily); } } }
public void setFontColor(Color color){ CTTextCharacterProperties rPr = getRPr(); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); CTSRgbColor clr = fill.isSetSrgbClr() ? fill.getSrgbClr() : fill.addNewSrgbClr(); clr.setVal(new byte[]{(byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()}); if(fill.isSetHslClr()) fill.unsetHslClr(); if(fill.isSetPrstClr()) fill.unsetPrstClr(); if(fill.isSetSchemeClr()) fill.unsetSchemeClr(); if(fill.isSetScrgbClr()) fill.unsetScrgbClr(); if(fill.isSetSysClr()) fill.unsetSysClr(); }
@Override public boolean fetch(CTTextCharacterProperties props){ if (props != null && props.isSetBaseline()) { setValue(props.getBaseline() < 0); return true; } return false; } };
rPr.setB(pr.getBArray(0).getVal()); rPr.setU(STTextUnderlineType.SNG); } else if (u1 == STUnderlineValues.DOUBLE) { rPr.setU(STTextUnderlineType.DBL); } else if (u1 == STUnderlineValues.NONE) { rPr.setU(STTextUnderlineType.NONE); rPr.setI(pr.getIArray(0).getVal()); CTTextFont rFont = rPr.isSetLatin() ? rPr.getLatin() : rPr.addNewLatin(); rFont.setTypeface(pr.getRFontArray(0).getVal()); rPr.setSz(sz); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor xlsColor = pr.getColorArray(0); if (xlsColor.isSetRgb()) {
default: case LATIN: font = props.getLatin(); if (font == null && create) { font = props.addNewLatin(); font = props.getEa(); if (font == null && create) { font = props.addNewEa(); font = props.getCs(); if (font == null && create) { font = props.addNewCs(); font = props.getSym(); if (font == null && create) { font = props.addNewSym();
tb1.setText(address); CTTextCharacterProperties rpr = tb1.getCTShape().getTxBody().getPArray(0).getRArray(0).getRPr(); rpr.addNewLatin().setTypeface("Trebuchet MS"); rpr.setSz(900); // 9 pt col = Color.pink; rpr.addNewSolidFill().addNewSrgbClr().setVal(new byte[]{(byte)col.getRed(),(byte)col.getGreen(),(byte)col.getBlue()});
public XDDFHyperlink getHyperlink() { return findDefinedProperty(props -> props.isSetHlinkClick(), props -> props.getHlinkClick()) .map(link -> new XDDFHyperlink(link)) .orElse(null); }
@Override public CTSolidColorFillProperties addNewSolidFill() { return props.addNewSolidFill(); }
@Override public XSLFHyperlink createHyperlink(){ XSLFHyperlink hl = getHyperlink(); if (hl != null) { return hl; } CTTextCharacterProperties rPr = getRPr(true); return new XSLFHyperlink(rPr.addNewHlinkClick(), _p.getParentShape().getSheet()); }
@Override public XSLFHyperlink getHyperlink(){ CTTextCharacterProperties rPr = getRPr(false); if (rPr == null) { return null; } CTHyperlink hl = rPr.getHlinkClick(); if (hl == null) { return null; } return new XSLFHyperlink(hl, _p.getParentShape().getSheet()); }
rPr.setB(pr.getBArray(0).getVal()); rPr.setU(STTextUnderlineType.SNG); } else if (u1 == STUnderlineValues.DOUBLE) { rPr.setU(STTextUnderlineType.DBL); } else if (u1 == STUnderlineValues.NONE) { rPr.setU(STTextUnderlineType.NONE); rPr.setI(pr.getIArray(0).getVal()); CTTextFont rFont = rPr.isSetLatin() ? rPr.getLatin() : rPr.addNewLatin(); rFont.setTypeface(pr.getRFontArray(0).getVal()); rPr.setSz(sz); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor xlsColor = pr.getColorArray(0); if (xlsColor.isSetRgb()) {
default: case LATIN: font = props.getLatin(); if (font == null && create) { font = props.addNewLatin(); font = props.getEa(); if (font == null && create) { font = props.addNewEa(); font = props.getCs(); if (font == null && create) { font = props.addNewCs(); font = props.getSym(); if (font == null && create) { font = props.addNewSym();
@Override public boolean fetch(CTTextCharacterProperties props){ if (props != null && props.isSetBaseline()) { setValue(props.getBaseline() > 0); return true; } return false; } };