CellSelection extends TextSelection { public void advancedReplaceWith(String newText, CellValueAdapter adapter) throws InvalidNavigationException { super.replaceWith(newText); if (mCell != null) { String text = mCell.getDisplayText(); mCell.setDisplayText(text, adapter); } } CellSelection(Navigation search, String text, OdfElement containerElement,
			int index, Cell cell); void advancedReplaceWith(String newText, CellValueAdapter adapter); void advancedReplaceWith(String newText); Cell getCell();  }
@Test public void testAdvancedReplacewith() { Map<String, String> valueProperties = new HashMap<String, String>(); valueProperties.put("Amount", "3,000,000"); valueProperties.put("Task", "Develop"); valueProperties.put("Date", "11/09/2010"); valueProperties.put("Time", "14:30"); valueProperties.put("Status", "true"); Map<String, String> typeProperties = new HashMap<String, String>(); typeProperties.put("Amount", "float"); typeProperties.put("Task", "string"); typeProperties.put("Date", "date"); typeProperties.put("Time", "time"); typeProperties.put("Status", "boolean"); for (String key : valueProperties.keySet()) { String value = valueProperties.get(key); TextNavigation navigate = new TextNavigation(key, doc); while (navigate.hasNext()) { CellSelection selection = (CellSelection) navigate.nextSelection(); try { selection.advancedReplaceWith(value); String valueType = selection.getCell().getValueType(); Assert.assertEquals(typeProperties.get(key), valueType); } catch (InvalidNavigationException e) { e.printStackTrace(); } } } }