CellStyleHandler extends DefaultStyleHandler { public String getCountry(ScriptType type) { String country = null; TextProperties textProperties = getTextPropertiesForRead(); if (textProperties != null) country = textProperties.getCountry(type); if (country != null && country.length() > 0) return country; boolean isDefault = isUseDefaultStyle; OdfStyleBase parentStyle = null; if (!isDefault) parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle()); while ((!isDefault) && (parentStyle != null)) { TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle); country = parentStyleSetting.getCountry(type); if (country != null && country.length() > 0) return country; if (parentStyle instanceof OdfDefaultStyle) isDefault = true; else parentStyle = getParentStyle((OdfStyle) parentStyle); } if (!isDefault) { OdfDefaultStyle defaultStyle = getCellDefaultStyle(); TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle); country = defaultStyleSetting.getCountry(type); } return country; } CellStyleHandler(Cell aCell); @Override String getUsedStyleName(); @Override OdfStyle getStyleElementForWrite(); String getCountry(ScriptType type); Font getFont(ScriptType type); String getLanguage(ScriptType type); void setCountry(String country, ScriptType type); void setFont(Font font); void setFont(Font font, Locale language); void setLanguage(String language, ScriptType type); Color getBackgroundColor(); Border getBorder(CellBordersType type); VerticalAlignmentType getVerticalAlignment(); boolean isTextWrapped(); void setBackgroundColor(Color color); void setBorders(Border border, CellBordersType bordersType); void setVerticalAlignment(VerticalAlignmentType alignType); void setTextWrapped(boolean isWrapped); void setHorizontalAlignment(HorizontalAlignmentType alignType); HorizontalAlignmentType getHorizontalAlignment();  }
@Test public void testGetCountry() { try { Document doc = Document.loadDocument(ResourceUtilities.getTestResourceAsStream(TEST_FILE_NAME)); Table table = doc.getTableByName("slideTable"); CellStyleHandler styleHandler = table.getCellByPosition(1, 1).getStyleHandler(); styleHandler.setCountry("English", Document.ScriptType.WESTERN); String country = styleHandler.getCountry(Document.ScriptType.WESTERN); Assert.assertEquals("English", country); } catch (Exception e) { Logger.getLogger(CellStyleHandlerTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(e.getMessage()); } }