* 'SIMPLE' with 'Odf Toolkit'
*/
@Test
public void testReplacewith() {
search = null;
search = new TextNavigation("SIMPLE", doc);
TextSelection nextSelect = null;
TextNavigation nextsearch = new TextNavigation("next", doc);
nextSelect = (TextSelection) nextsearch.nextSelection();
// replace all the "SIMPLE" to "Odf Toolkit"
// except the sentence
// "Task5.Change the SIMPLE to Odf Toolkit, and bold them."
OdfStyle style = new OdfStyle(contentDOM);
style.setProperty(StyleTextPropertiesElement.FontWeight, "bold");
style.setStyleFamilyAttribute("text");
int i = 0;
while (search.hasNext()) {
if (i > 0) {
TextSelection item = (TextSelection) search.nextSelection();
try {
item.replaceWith("Odf Toolkit");
item.applyStyle(style);
} catch (InvalidNavigationException e) {
Assert.fail(e.getMessage());
}
}
i++;
}
search = new TextNavigation("Odf Toolkit", doc);
int j = 0;
while (search.hasNext()) {
search.nextSelection();
j++;
}