Unable to add SearchTextFragment to docx

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)

.

1 Like

@shiva.k
Thanks for the details. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): ANNOTATIONJAVA-1518

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@shiva.k

This annotation type is not supported for Words files.

Can u please provide the file types supporting SearchTextFragment.

@shiva.k

It’s only supported for PDF format.