use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontName in project poi by apache.
the class TestXSSFFont method testFontName.
@Test
public void testFontName() {
CTFont ctFont = CTFont.Factory.newInstance();
CTFontName fname = ctFont.addNewName();
fname.setVal("Arial");
ctFont.setNameArray(0, fname);
XSSFFont xssfFont = new XSSFFont(ctFont);
assertEquals("Arial", xssfFont.getFontName());
xssfFont.setFontName("Courier");
assertEquals("Courier", ctFont.getNameArray(0).getVal());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontName in project poi by apache.
the class XSSFFont method setFontName.
/**
* 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);
}
Aggregations