Forced save document from plugin

Integration questions/issues
Post Reply
sergey_rogulin
Posts: 2
Joined: Mon May 18, 2020 7:49 am

Forced save document from plugin

Post by sergey_rogulin » Mon May 18, 2020 8:07 am

Hi!

I have a plugin for DocEditor (web-version) with the simple button. When the user click by that button, plugin must insert ContentControl in the current document and then plugin must forced save document (that`s needed for starting synchronization between server and document storage). After synchronization document processed (by the storage engine) and then downloaded to user.

The question is: how to forced save document with sync without manually clicking by the "save" button (located at the topbar) after inserting the ContentControl :?:

Currently inserting executed by the calling JS-API method:

Code: Select all

window.Asc.plugin.executeMethod('InsertAndReplaceContentControls', ...) 
with payload:

Code: Select all

var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
var oRun = oParagraph.AddText("...");
oDocument.InsertContent([oParagraph], true);

Carl
Posts: 378
Joined: Thu Apr 12, 2018 10:00 am

Re: Forced save document from plugin

Post by Carl » Mon May 18, 2020 11:29 am

Hello sergey_rogulin,

You can force save a document by sending an api request to the Command Service:
https://api.onlyoffice.com/editors/command#c
https://api.onlyoffice.com/editors/command#forcesave

Please try using it to force save a document via your plugin.

sergey_rogulin
Posts: 2
Joined: Mon May 18, 2020 7:49 am

Re: Forced save document from plugin

Post by sergey_rogulin » Mon May 25, 2020 6:29 am

Hi, Carl!

Thanks for the help, this approach helped solve the problem.

Post Reply