public void setFontSize(Double size) { if (size == null) { if (props.isSetSz()) { props.unsetSz(); } } else if (size < 1 || 400 < size) { throw new IllegalArgumentException("Minimum inclusive = 1. Maximum inclusive = 400."); } else { props.setSz((int) (100 * size)); } }
@Override public boolean fetch(CTTextCharacterProperties props){ if (props != null && props.isSetSz()) { setValue(props.getSz()*0.01); return true; } return false; } };
@Override public Double getDefaultFontSize() { CTTextCharacterProperties endPr = _p.getEndParaRPr(); if (endPr == null || !endPr.isSetSz()) { // inherit the font size from the master style CTTextParagraphProperties masterStyle = getDefaultMasterStyle(); if (masterStyle != null) { endPr = masterStyle.getDefRPr(); } } return (endPr == null || !endPr.isSetSz()) ? 12 : (endPr.getSz() / 100.); }
@Override public void setFontSize(Double fontSize){ CTTextCharacterProperties rPr = getRPr(true); if(fontSize == null) { if (rPr.isSetSz()) { rPr.unsetSz(); } } else { if (fontSize < 1.0) { throw new IllegalArgumentException("Minimum font size is 1pt but was " + fontSize); } rPr.setSz((int)(100*fontSize)); } }
/** * * @param fontSize font size in points. * The value of <code>-1</code> unsets the Sz attribute from the underlying xml bean */ public void setFontSize(double fontSize){ CTTextCharacterProperties rPr = getRPr(); if(fontSize == -1.0) { if(rPr.isSetSz()) rPr.unsetSz(); } else { if(fontSize < 1.0) { throw new IllegalArgumentException("Minimum font size is 1pt but was " + fontSize); } rPr.setSz((int)(100*fontSize)); } }
/** * @return font size in points or -1 if font size is not set. */ public double getFontSize(){ double scale = 1; double size = XSSFFont.DEFAULT_FONT_SIZE; // default font size CTTextNormalAutofit afit = getParentParagraph().getParentShape().getTxBody().getBodyPr().getNormAutofit(); if(afit != null) scale = (double)afit.getFontScale() / 100000; CTTextCharacterProperties rPr = getRPr(); if(rPr.isSetSz()){ size = rPr.getSz()*0.01; } return size * scale; }
public void setFontSize(Double size) { if (size == null) { if (props.isSetSz()) { props.unsetSz(); } } else if (size < 1 || 400 < size) { throw new IllegalArgumentException("Minimum inclusive = 1. Maximum inclusive = 400."); } else { props.setSz((int) (100 * size)); } }
@Override public Double getDefaultFontSize() { CTTextCharacterProperties endPr = _p.getEndParaRPr(); if (endPr == null || !endPr.isSetSz()) { // inherit the font size from the master style CTTextParagraphProperties masterStyle = getDefaultMasterStyle(); if (masterStyle != null) { endPr = masterStyle.getDefRPr(); } } return (endPr == null || !endPr.isSetSz()) ? 12 : (endPr.getSz() / 100.); }
@Override public boolean fetch(CTTextCharacterProperties props){ if (props != null && props.isSetSz()) { setValue(props.getSz()*0.01); return true; } return false; } };
public boolean fetch(CTTextCharacterProperties props){ if(props.isSetSz()){ setValue(props.getSz()*0.01); return true; } return false; } };
@Override public void setFontSize(Double fontSize){ CTTextCharacterProperties rPr = getRPr(true); if(fontSize == null) { if (rPr.isSetSz()) { rPr.unsetSz(); } } else { if (fontSize < 1.0) { throw new IllegalArgumentException("Minimum font size is 1pt but was " + fontSize); } rPr.setSz((int)(100*fontSize)); } }
/** * * @param fontSize font size in points. * The value of <code>-1</code> unsets the Sz attribute from the underlying xml bean */ public void setFontSize(double fontSize){ CTTextCharacterProperties rPr = getRPr(); if(fontSize == -1.0) { if(rPr.isSetSz()) rPr.unsetSz(); } else { if(fontSize < 1.0) { throw new IllegalArgumentException("Minimum font size is 1pt but was " + fontSize); } rPr.setSz((int)(100*fontSize)); } }
/** * * @param fontSize font size in points. * The value of <code>-1</code> unsets the Sz attribyte from the underlying xml bean */ public void setFontSize(double fontSize){ CTTextCharacterProperties rPr = getRPr(); if(fontSize == -1.0) { if(rPr.isSetSz()) rPr.unsetSz(); } else { if(fontSize < 1.0) { throw new IllegalArgumentException("Minimum font size is 1pt but was " + fontSize); } rPr.setSz((int)(100*fontSize)); } }
/** * ensure that the paragraph contains at least one character. * We need this trick to correctly measure text */ private void ensureNotEmpty(){ XSLFTextRun r = addNewTextRun(); r.setText(" "); CTTextCharacterProperties endPr = _p.getEndParaRPr(); if(endPr != null) { if(endPr.isSetSz()) r.setFontSize(endPr.getSz() / 100); } }
/** * @return font size in points or -1 if font size is not set. */ public double getFontSize(){ double scale = 1; double size = XSSFFont.DEFAULT_FONT_SIZE; // default font size CTTextNormalAutofit afit = getParentParagraph().getParentShape().getTxBody().getBodyPr().getNormAutofit(); if(afit != null) scale = (double)afit.getFontScale() / 100000; CTTextCharacterProperties rPr = getRPr(); if(rPr.isSetSz()){ size = rPr.getSz()*0.01; } return size * scale; }