Have Microsoft Word document docx with a proper hyperlink
HYPERLINK "mailto:firstname.lastname@organization.org" firstname.lastname@organization.org
Open it with MS Word and in the menu File->Info see Words 52.
Now open document
Document document = new Document("path");
and run
document.getBuiltInDocumentProperties().get("Characters").getValue() -> 335
document.getBuiltInDocumentProperties().get("Words").getValue() -> 58
document.getBuiltInDocumentProperties().getBytes() -> 992720
document.getRange().getText().getBytes().length -> 391
do replace in the document of
firstname.lastname@organization.org
with anonymous@great.com
more words even more short words
The replacement happened. And the document was saved.
HYPERLINK "mailto:anonymous@great.com more words even more short words" anonymous@great.com
more words even more short words
therefor, I expect all numbers to be changed accordingly
document.getBuiltInDocumentProperties().get("Characters").getValue() -> 335
document.getBuiltInDocumentProperties().get("Words").getValue() -> 58
document.getBuiltInDocumentProperties().getBytes() -> 992720
document.getRange().getText().getBytes().length -> 425
Open document in MS Word, menu File -> Info see Words 58.
Open the document with API and call stats again
document.getBuiltInDocumentProperties().get("Characters").getValue() -> 335
document.getBuiltInDocumentProperties().get("Words").getValue() -> 58
document.getBuiltInDocumentProperties().getBytes() -> 988506
document.getRange().getText().getBytes().length -> 425