Page 1 of 1
Programmatically Adding Comments
Posted: Thu Feb 12, 2026 1:08 pm
by willy_mwangi
I'm wondering whether there is an API available to allow a plugin to add a comment to a file programmatically. Any pointers will be highly apprectiated.
Re: Programmatically Adding Comments
Posted: Thu Feb 12, 2026 4:30 pm
by Radu
Hi,
Can you elaborate on your request? What do you mean by comment? Do you mean an XML comment or a comment added similar to Oxygen's "Add comment" action? Do you have an existing Oxygen plugin or planning to build one?
Regards,
Radu
Re: Programmatically Adding Comments
Posted: Thu Feb 12, 2026 11:32 pm
by willy_mwangi
I want to add a comment similar to Oxygen's "Add comment" action. I have an existing plugin.
Re: Programmatically Adding Comments
Posted: Fri Feb 13, 2026 9:27 pm
by Radu
Hi,
Unfortunately we do not have such an API, if you want I can add an internal issue to consider adding it in a future version.
For now one would probably need as a workaround to:
(1) Create a document fragment from a range:
ro.sync.ecss.extensions.api.AuthorDocumentController.createDocumentFragment(int, int)
(2) Serialize the document fragment to XML:
ro.sync.ecss.extensions.api.AuthorDocumentController.serializeFragmentToXML(AuthorDocumentFragment)
(3) Delete the range from the document:
ro.sync.ecss.extensions.api.AuthorDocumentController.delete(int, int)
(4)
Modify the XML serialized from the fragment to add the processing instruction inside it.
(5)
Insert the XML fragment which now contains also the comment processing instructions inside the document:
ro.sync.ecss.extensions.api.AuthorDocumentController.insertXMLFragment(String, int)
I added an internal issue to provide APIs for adding comments in possibly a future Oxygen version, pasting the issue ID below for future reference:
EXM-56764 APIs to add comments programatically
Regards,
Radu
Re: Programmatically Adding Comments
Posted: Tue Feb 17, 2026 11:17 am
by willy_mwangi
Thank you for the response. Looking forward to seeing this capability in the SDK.