Closed ccruson closed 6 years ago
Hello @ccruson. You can use InsertAndReplaceContentControls
method for create more than one content control at a time (documentation)
(function(window, undefined){
window.Asc.plugin.init = function()
{
window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [
[
{
"Props":
{
"Id": 7,
"Tag":
"{String}",
"Lock": 0
},
"Script": "var oDocument = Api.GetDocument();\
var oParagraph = Api.CreateParagraph();\
oParagraph.AddText('Hello world!');\
oDocument.InsertContent([oParagraph]);"
},
{
"Props":
{
"Id": 8,
"Tag": "{String}",
"Lock": 0
},
"Script": "var oDocument = Api.GetDocument();\
var oParagraph = Api.CreateParagraph();\
oParagraph.AddText('Hello world!');\
oDocument.InsertContent([oParagraph]);"
} ]
]);
window.Asc.plugin.onMethodReturn = function(returnValue)
{
var _plugin = window.Asc.plugin;
if (_plugin.info.methodName == "InsertAndReplaceContentControls")
{
this.executeCommand("close", '');
}
};
};
})(window, undefined);
Closing due no responce
This is more of a question than an issue. Is there a way to create more than one content control at a time? It would be nice if I could pass an array to this function and have them added all at once.