Can we executeMethod "AddContentControl" in plugin when document mode is view?

Is it possible to use the “AddContentControl” function in the plugin’s code.js file to add a content control when the document is opened in view mode?

Looking forward to your reply.


Hello @chiragencodedots

Unfortunately, in the View Mode plugin won’t be able to insert any content including a Content Control via mentioned method AddContentControl.

Hello @Constantine

In that scenario, OnlyOffice will not meet our requirements. Could you please suggest an alternative approach? We aim to limit editing capabilities while still permitting the usage of Content Controls to add custom comments in our plugin.

Hello @Constantine

Can you please provide your comment? We are waiting for your response

Thanks & Regards

If your final goal is to have a document that cannot be edited and have at the same possibility to insert Content Controls in it with the plugin, considering that in view mode it is impossible, you can work around it with method SetEditingRestrictions.
Basically, your document should be opened in editing mode and set to ["readOnly"] via plugin straight away, then when it is needed to insert a Content Control your plugin executes mentioned method with ["none"] value to temporarily allow editing, insert a Content Control and then disable editing again by executing method with value ["readOnly"].

If it is not what you are looking for, please provide more details about the usage case.

1 Like

@Constantine Thanks for your help I implemented the same way to restrict the editing access of document

1 Like