Question

Preferable using the ODFDOM API. I would like to have the entire file's contents in a string, if possible. If not, how would you search the file for a specific substring?

Thanks in advance.

Was it helpful?

Solution

you will need to load the odt document and then get the content root. From there, get the text content which will return you a string. So that should give you an idea on how to search using string? For example:

TextDocument document = TextDocument.loadDocument("test.odt");
String texts = document.getContentRoot().getTextContent());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top