Get Started
Plugins
Macros
More information
|
window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [args], callback)Description
Defines the method that allows inserting the content control containing data. The data is specified by the js code for Document Builder, or by a link to the shared document. Usage
This method should be used in the following way: window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [arrDocuments]); Parameters
The Props object can have the following values:
Returns
The method returns the data which the created content control contains (in JSON format): [ { "Tag": "Document", "Id": 0, "Lock": 0, "InternalId": "1_713" } ] Example of changing the existed content control
var arrDocuments = [{ "Props": { "InternalId": "2_803" }, "Script": "var oParagraph = Api.CreateParagraph();oParagraph.AddText('New text');Api.GetDocument().InsertContent([oParagraph]);" }] window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [arrDocuments]); Example of adding a new content control
var arrDocuments = [{ "Props": { "Id": 100, "Tag": "CC_Tag", "Lock": 3 }, "Script": "var oParagraph = Api.CreateParagraph();oParagraph.AddText('Hello world!');Api.GetDocument().InsertContent([oParagraph]);" }] window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [arrDocuments]); |