I was trying out annotation library to add SearchTextFragment for a docx file but it failed. Is this type of annotation supported for office files.
System details:
Groupdocs.Annotation Java : 23.8
Java : 17
OS : Windows 11
try(final Annotator annotator = new Annotator(getClass().getResourceAsStream("/Test Document.docx"))){
SearchTextFragment searchTextFragment = new SearchTextFragment();
searchTextFragment.setText("phone");//If the document does not contain this text, nothing will be highlighted
searchTextFragment.setFontSize(10.);
searchTextFragment.setFontFamily("Calibri");
searchTextFragment.setFontColor(65535);
searchTextFragment.setBackgroundColor(16761035);
annotator.add(searchTextFragment);
annotator.save("Test Document annotated.docx");
}
Error
class com.groupdocs.annotation.internal.c.a.ms.System.IO.IOException: Document 'WORDS' doesn't support '9984' component
com.groupdocs.annotation.Annotator.add(Unknown Source)
Document file
Test Document.docx (6.2 KB)
.