TextProperties { public StyleTypeDefinitions.FontStyle getFontStyle() { String fontstyle = mElement.getFoFontStyleAttribute(); String fontweight = mElement.getFoFontWeightAttribute(); StyleTypeDefinitions.OdfFontStyle theFontType = StyleTypeDefinitions.OdfFontStyle.enumValueOf(fontstyle); StyleTypeDefinitions.OdfFontWeight theFontWeight = StyleTypeDefinitions.OdfFontWeight.enumValueOf(fontweight); if (theFontType == StyleTypeDefinitions.OdfFontStyle.NORMAL && theFontWeight == StyleTypeDefinitions.OdfFontWeight.NORMAL) { return StyleTypeDefinitions.FontStyle.REGULAR; } if (theFontType == StyleTypeDefinitions.OdfFontStyle.ITALIC && theFontWeight == StyleTypeDefinitions.OdfFontWeight.NORMAL) { return StyleTypeDefinitions.FontStyle.ITALIC; } if (theFontType == StyleTypeDefinitions.OdfFontStyle.ITALIC && theFontWeight == StyleTypeDefinitions.OdfFontWeight.BOLD) { return StyleTypeDefinitions.FontStyle.BOLDITALIC; } if (theFontType == StyleTypeDefinitions.OdfFontStyle.NORMAL && theFontWeight == StyleTypeDefinitions.OdfFontWeight.BOLD) { return StyleTypeDefinitions.FontStyle.BOLD; } return null; } protected  TextProperties(); protected  TextProperties(StyleTextPropertiesElement textProperties); StyleTypeDefinitions.FontStyle getFontStyle(); StyleTypeDefinitions.TextLinePosition getTextLineStyle(); StyleTypeDefinitions.FontStyle getFontStyle(Document.ScriptType type); void setFontStyle(StyleTypeDefinitions.FontStyle style); void setTextLineStyle(StyleTypeDefinitions.TextLinePosition style); void setFontStyle(StyleTypeDefinitions.FontStyle style, Document.ScriptType type); double getFontSizeInPoint(); double getFontSizeInPoint(Document.ScriptType type); void setFontSizeInPoint(double size); void setFontSizeInPoint(double size, Document.ScriptType type); String getLanguage(); String getLanguage(Document.ScriptType type); void setLanguage(String language); void setLanguage(String language, Document.ScriptType type); String getCountry(); String getCountry(Document.ScriptType type); void setCountry(String country); void setCountry(String country, Document.ScriptType type); Color getFontColor(); void setFontColor(Color fontColor); String getFontName(); String getFontName(Document.ScriptType type); void setFontName(String fontName); void setFontName(String fontName, Document.ScriptType type); Font getFont(); Font getFont(Document.ScriptType type); void setFont(Font font); void setFont(Font font, Locale language); String getFontFamilyName(Document.ScriptType type); static TextProperties getOrCreateTextProperties(OdfStyleBase style); static TextProperties getTextProperties(OdfStyleBase style); void setSubscripted(Integer fontsizePercent); void setSuperscripted(Integer fontsizePercent); Integer getSubscripted(); Integer getSuperscripted(); void setBackgroundColorAttribute(Color bkColor); String getBackgroundColorAttribute();  }
@Test public void testGetFontStyle() { try { SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument(); Table table = document.getTableByName("Sheet1"); Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH); Cell cell = table.getCellByPosition("A1"); cell.setFont(font); cell.setStringValue("testGetFontStyle."); TextProperties textProperties = cell.getStyleHandler().getTextPropertiesForWrite(); textProperties.setFontStyle(StyleTypeDefinitions.FontStyle.BOLDITALIC); StyleTypeDefinitions.FontStyle fontStyle = textProperties.getFontStyle(); Assert.assertEquals(StyleTypeDefinitions.FontStyle.BOLDITALIC, fontStyle); textProperties.setFontStyle(StyleTypeDefinitions.FontStyle.BOLD); StyleTypeDefinitions.FontStyle fontStyle1 = textProperties.getFontStyle(); Assert.assertEquals(StyleTypeDefinitions.FontStyle.BOLD, fontStyle1); textProperties.setFontStyle(StyleTypeDefinitions.FontStyle.ITALIC); StyleTypeDefinitions.FontStyle fontStyle2 = textProperties.getFontStyle(); Assert.assertEquals(StyleTypeDefinitions.FontStyle.ITALIC, fontStyle2); textProperties.setFontStyle(StyleTypeDefinitions.FontStyle.REGULAR); StyleTypeDefinitions.FontStyle fontStyle3 = textProperties.getFontStyle(); Assert.assertEquals(StyleTypeDefinitions.FontStyle.REGULAR, fontStyle3); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } }