window.Asc.plugin.executeMethod ("AddContentControl", [args], callback)
Defines the method that allows adding an empty content control to the document.
This method should be used in the following way:
window.Asc.plugin.executeMethod ("AddContentControl", [type, commonPr]);
Parameter |
Description |
Type |
Example |
type |
A numeric value that specifies the content control type. It can have one of the following values: 1 (block), 2 (inline), 3 (row) or 4 (cell). |
integer |
2 |
commonPr |
Defines the common content control properties:
-
Id - a unique identifier of the content control. It can be used to search for a certain content control and make reference to it in the code,
type: integer,
example: 2;
-
Tag - a tag assigned to the content control. The same tag can be assigned to several content controls so that it is possible to make reference to them in your code,
type: string,
example: "{tag}";
-
Lock - a value which defines if it is possible to delete and/or edit the content control or not,
type: integer,
example: 0;
-
InternalId - a unique internal identifier of the content control,
type: string,
example: "1_713";
-
Alias - the alias attribute,
type: string,
example: "№1";
-
PlaceHolderText - the content control placeholder text,
type: string,
example: "placeholder text";
-
Appearance - defines if the content control is shown as the bounding box (1) or not (2),
type: integer,
example: 1;
-
Color - the color for the current content control in the RGB format (R - red color component value, G - green color component value,
B - blue color component value). For example: {"R": 0, "G": 0, "B": 255},
type: object.
|
object |
|
The Lock parameter can have the following values:
Numeric value |
Edit |
Delete |
0 |
No |
Yes |
1 |
No |
No |
2 |
Yes |
No |
3 |
Yes |
Yes |
The method returns a JSON object containing the data about the created content control in the following form:
{
"Tag": "{tag}",
"Id": 0,
"Lock": 0,
"InternalId": "1_713"
}
Parameter |
Description |
Type |
Example |
Tag |
A tag assigned to the content control. The same tag can be assigned to several content controls so that it is possible to make reference to them in the code. |
string |
"{tag}" |
Id |
A unique identifier of the content control. It can be used to search for a certain content control and make reference to it in the code. |
integer |
2 |
Lock |
A value which defines if it is possible to delete and/or edit the content control or not. |
integer |
0 |
InternalId |
A unique internal identifier of the content control. |
string |
"1_713" |
window.Asc.plugin.executeMethod ("AddContentControl", [1, {"Id" : 7, "Tag" : "{tag}", "Lock" : 0}]);