window.Asc.plugin.executeMethod("AddContentControl", [args], callback)

Description

This method allows to add an empty content control to the document.

Usage

This method should be used in the following way:

window.Asc.plugin.executeMethod("AddContentControl", [wrap, obj]);

Where:

  • wrap is a numeric value that specifies the content control type. It can have one of the following values: 1 (block) or 2 (inline),
  • obj is a JSON object of the following form:
{
    "Id" : 0,
    "Lock" : 0,
    "Tag" : "{tag}"
}

The obj object has the values that can be the following:

  • "Id" (e.g. {"Id": 2} ) is a unique identifier of the content control. It can be used to search for a certain content control and make reference to it in your code.
  • "Tag" ( e.g. {"Tag": "String"} ) is a tag assigned to the content control. One and the same tag can be assigned to several content controls so that you can make reference to them in your code.
  • "Lock" (e.g. {"Lock": 0} ) is a value that defines if it is possible to delete and/or edit the content control or not. The values can be the following:
Numeric value Edit Delete
0 No Yes
1 No No
2 Yes No
3 Yes Yes
Returns

The method returns a JSON object containing the data about the created content control in the following form (JSON):

{
    "Tag": "{tag}",
    "Id": 0,
    "Lock": 0,
    "InternalId": "1_713"
}