/** * get the name of the font (i.e. Arial) * * @return String - a string representing the name of the font to use */ public String getFontName() { CTFontName name = _ctFont.sizeOfNameArray() == 0 ? null : _ctFont.getNameArray(0); return name == null ? DEFAULT_FONT_NAME : name.getVal(); }
/** * set the name for the font (i.e. Arial). * If the font doesn't exist (because it isn't installed on the system), * or the charset is invalid for that font, then another font should * be substituted. * The string length for this attribute shall be 0 to 31 characters. * Default font name is Calibri. * * @param name - value representing the name of the font to use * @see #DEFAULT_FONT_NAME */ public void setFontName(String name) { CTFontName fontName = _ctFont.sizeOfNameArray() == 0 ? _ctFont.addNewName() : _ctFont.getNameArray(0); fontName.setVal(name == null ? DEFAULT_FONT_NAME : name); }
/** * Copy font attributes from CTFont bean into CTRPrElt bean */ private void setRunAttributes(CTFont ctFont, CTRPrElt pr){ if(ctFont.sizeOfBArray() > 0) pr.addNewB().setVal(ctFont.getBArray(0).getVal()); if(ctFont.sizeOfUArray() > 0) pr.addNewU().setVal(ctFont.getUArray(0).getVal()); if(ctFont.sizeOfIArray() > 0) pr.addNewI().setVal(ctFont.getIArray(0).getVal()); if(ctFont.sizeOfColorArray() > 0) { CTColor c1 = ctFont.getColorArray(0); CTColor c2 = pr.addNewColor(); if(c1.isSetAuto()) c2.setAuto(c1.getAuto()); if(c1.isSetIndexed()) c2.setIndexed(c1.getIndexed()); if(c1.isSetRgb()) c2.setRgb(c1.getRgb()); if(c1.isSetTheme()) c2.setTheme(c1.getTheme()); if(c1.isSetTint()) c2.setTint(c1.getTint()); } if(ctFont.sizeOfSzArray() > 0) pr.addNewSz().setVal(ctFont.getSzArray(0).getVal()); if(ctFont.sizeOfNameArray() > 0) pr.addNewRFont().setVal(ctFont.getNameArray(0).getVal()); if(ctFont.sizeOfFamilyArray() > 0) pr.addNewFamily().setVal(ctFont.getFamilyArray(0).getVal()); if(ctFont.sizeOfSchemeArray() > 0) pr.addNewScheme().setVal(ctFont.getSchemeArray(0).getVal()); if(ctFont.sizeOfCharsetArray() > 0) pr.addNewCharset().setVal(ctFont.getCharsetArray(0).getVal()); if(ctFont.sizeOfCondenseArray() > 0) pr.addNewCondense().setVal(ctFont.getCondenseArray(0).getVal()); if(ctFont.sizeOfExtendArray() > 0) pr.addNewExtend().setVal(ctFont.getExtendArray(0).getVal()); if(ctFont.sizeOfVertAlignArray() > 0) pr.addNewVertAlign().setVal(ctFont.getVertAlignArray(0).getVal()); if(ctFont.sizeOfOutlineArray() > 0) pr.addNewOutline().setVal(ctFont.getOutlineArray(0).getVal()); if(ctFont.sizeOfShadowArray() > 0) pr.addNewShadow().setVal(ctFont.getShadowArray(0).getVal()); if(ctFont.sizeOfStrikeArray() > 0) pr.addNewStrike().setVal(ctFont.getStrikeArray(0).getVal()); }
/** * get the name of the font (i.e. Arial) * * @return String - a string representing the name of the font to use */ public String getFontName() { CTFontName name = _ctFont.sizeOfNameArray() == 0 ? null : _ctFont.getNameArray(0); return name == null ? DEFAULT_FONT_NAME : name.getVal(); }
/** * get the name of the font (i.e. Arial) * * @return String - a string representing the name of the font to use */ public String getFontName() { CTFontName name = _ctFont.sizeOfNameArray() == 0 ? null : _ctFont.getNameArray(0); return name == null ? DEFAULT_FONT_NAME : name.getVal(); }
/** * set the name for the font (i.e. Arial). * If the font doesn't exist (because it isn't installed on the system), * or the charset is invalid for that font, then another font should * be substituted. * The string length for this attribute shall be 0 to 31 characters. * Default font name is Calibri. * * @param name - value representing the name of the font to use * @see #DEFAULT_FONT_NAME */ public void setFontName(String name) { CTFontName fontName = _ctFont.sizeOfNameArray() == 0 ? _ctFont.addNewName() : _ctFont.getNameArray(0); fontName.setVal(name == null ? DEFAULT_FONT_NAME : name); }
/** * set the name for the font (i.e. Arial). * If the font doesn't exist (because it isn't installed on the system), * or the charset is invalid for that font, then another font should * be substituted. * The string length for this attribute shall be 0 to 31 characters. * Default font name is Calibri. * * @param name - value representing the name of the font to use * @see #DEFAULT_FONT_NAME */ public void setFontName(String name) { CTFontName fontName = _ctFont.sizeOfNameArray() == 0 ? _ctFont.addNewName() : _ctFont.getNameArray(0); fontName.setVal(name == null ? DEFAULT_FONT_NAME : name); }
/** * Copy font attributes from CTFont bean into CTRPrElt bean */ private void setRunAttributes(CTFont ctFont, CTRPrElt pr){ if(ctFont.sizeOfBArray() > 0) pr.addNewB().setVal(ctFont.getBArray(0).getVal()); if(ctFont.sizeOfUArray() > 0) pr.addNewU().setVal(ctFont.getUArray(0).getVal()); if(ctFont.sizeOfIArray() > 0) pr.addNewI().setVal(ctFont.getIArray(0).getVal()); if(ctFont.sizeOfColorArray() > 0) { CTColor c1 = ctFont.getColorArray(0); CTColor c2 = pr.addNewColor(); if(c1.isSetAuto()) c2.setAuto(c1.getAuto()); if(c1.isSetIndexed()) c2.setIndexed(c1.getIndexed()); if(c1.isSetRgb()) c2.setRgb(c1.getRgb()); if(c1.isSetTheme()) c2.setTheme(c1.getTheme()); if(c1.isSetTint()) c2.setTint(c1.getTint()); } if(ctFont.sizeOfSzArray() > 0) pr.addNewSz().setVal(ctFont.getSzArray(0).getVal()); if(ctFont.sizeOfNameArray() > 0) pr.addNewRFont().setVal(ctFont.getNameArray(0).getVal()); if(ctFont.sizeOfFamilyArray() > 0) pr.addNewFamily().setVal(ctFont.getFamilyArray(0).getVal()); if(ctFont.sizeOfSchemeArray() > 0) pr.addNewScheme().setVal(ctFont.getSchemeArray(0).getVal()); if(ctFont.sizeOfCharsetArray() > 0) pr.addNewCharset().setVal(ctFont.getCharsetArray(0).getVal()); if(ctFont.sizeOfCondenseArray() > 0) pr.addNewCondense().setVal(ctFont.getCondenseArray(0).getVal()); if(ctFont.sizeOfExtendArray() > 0) pr.addNewExtend().setVal(ctFont.getExtendArray(0).getVal()); if(ctFont.sizeOfVertAlignArray() > 0) pr.addNewVertAlign().setVal(ctFont.getVertAlignArray(0).getVal()); if(ctFont.sizeOfOutlineArray() > 0) pr.addNewOutline().setVal(ctFont.getOutlineArray(0).getVal()); if(ctFont.sizeOfShadowArray() > 0) pr.addNewShadow().setVal(ctFont.getShadowArray(0).getVal()); if(ctFont.sizeOfStrikeArray() > 0) pr.addNewStrike().setVal(ctFont.getStrikeArray(0).getVal()); }
/** * Copy font attributes from CTFont bean into CTRPrElt bean */ private void setRunAttributes(CTFont ctFont, CTRPrElt pr){ if(ctFont.sizeOfBArray() > 0) pr.addNewB().setVal(ctFont.getBArray(0).getVal()); if(ctFont.sizeOfUArray() > 0) pr.addNewU().setVal(ctFont.getUArray(0).getVal()); if(ctFont.sizeOfIArray() > 0) pr.addNewI().setVal(ctFont.getIArray(0).getVal()); if(ctFont.sizeOfColorArray() > 0) { CTColor c1 = ctFont.getColorArray(0); CTColor c2 = pr.addNewColor(); if(c1.isSetAuto()) c2.setAuto(c1.getAuto()); if(c1.isSetIndexed()) c2.setIndexed(c1.getIndexed()); if(c1.isSetRgb()) c2.setRgb(c1.getRgb()); if(c1.isSetTheme()) c2.setTheme(c1.getTheme()); if(c1.isSetTint()) c2.setTint(c1.getTint()); } if(ctFont.sizeOfSzArray() > 0) pr.addNewSz().setVal(ctFont.getSzArray(0).getVal()); if(ctFont.sizeOfNameArray() > 0) pr.addNewRFont().setVal(ctFont.getNameArray(0).getVal()); if(ctFont.sizeOfFamilyArray() > 0) pr.addNewFamily().setVal(ctFont.getFamilyArray(0).getVal()); if(ctFont.sizeOfSchemeArray() > 0) pr.addNewScheme().setVal(ctFont.getSchemeArray(0).getVal()); if(ctFont.sizeOfCharsetArray() > 0) pr.addNewCharset().setVal(ctFont.getCharsetArray(0).getVal()); if(ctFont.sizeOfCondenseArray() > 0) pr.addNewCondense().setVal(ctFont.getCondenseArray(0).getVal()); if(ctFont.sizeOfExtendArray() > 0) pr.addNewExtend().setVal(ctFont.getExtendArray(0).getVal()); if(ctFont.sizeOfVertAlignArray() > 0) pr.addNewVertAlign().setVal(ctFont.getVertAlignArray(0).getVal()); if(ctFont.sizeOfOutlineArray() > 0) pr.addNewOutline().setVal(ctFont.getOutlineArray(0).getVal()); if(ctFont.sizeOfShadowArray() > 0) pr.addNewShadow().setVal(ctFont.getShadowArray(0).getVal()); if(ctFont.sizeOfStrikeArray() > 0) pr.addNewStrike().setVal(ctFont.getStrikeArray(0).getVal()); }