-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Milestone
Description
I need to replace a text fragment of a ODT Text Document with a new text.
My code looks something like this:
private void replaceODFTextFragment(OdfTextDocument doc, String pattern, String replace)
throws InvalidNavigationException {
TextNavigation searchPattern = new TextNavigation(pattern, doc);
while (searchPattern.hasNext()) {
logger.info("..found match "+pattern + " -----> Replace: "+replace);
TextSelection textSelection = (TextSelection) searchPattern.getCurrentItem();
textSelection.replaceWith(replace);
break;
}
}But this is not working.
The OdfTextDocument is not updated at all.
Also it is not possible to navigate to the next element as stated in the documentation [here](https://odftoolkit.org/api/odfdom/org/odftoolkit/odfdom/incubator/search/Navigation.html#getNextMatchElement(org.w3c.dom.Node).
There is no getNextMatchElement method in version 0.11.0 of this project.
Can anybody help me out here.
I use the library successful for OdfSpreadsheetDocument objects and this works well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels