Domanda

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.

È stato utile?

Soluzione

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());
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top