Skip to main content

SetProperties

Sets the properties to the document.

Syntax

expression.SetProperties(obj);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
objRequiredobjectThe document properties.
obj.copyoutenabledRequiredbooleanDisables copying from the editor if it is set to false.
obj.hideContentControlTrackRequiredbooleanDisables tracking the content control if it is set to true.
obj.watermark_on_drawRequiredstringA string value for watermark in JSON format.
obj.disableAutostartMacrosRequiredbooleanSets a flag that specifies that macros are started automatically when the editor opens.
obj.fillFormsRequiredstringSets rules in JSON format for filling document forms by tags.

Returns

This method doesn't return any data.

Example

var initSettings = {
"copyoutenabled" : false,
"hideContentControlTrack" : false,
"watermark_on_draw" : JSON.stringify ( {
"transparent" : 0.3,
"type" : "rect",
"width" : 100,
"height" : 100,
"rotate" : -45,
"margins" : [ 10, 10, 10, 10 ],
"fill" : [255, 0, 0],
"stroke-width" : 1,
"stroke" : [0, 0, 255],
"align" : 1,

"paragraphs" : [ {
"align" : 2,
"fill" : [255, 0, 0],
"linespacing" : 1,

"runs" : [
{
"text" : "Do not steal, %user_name%!",
"fill" : [0, 0, 0],
"font-family" : "Arial",
"font-size" : 40,
"bold" : true,
"italic" : false,
"strikeout" : false,
"underline" : false
},
{
"text" : "<%br%>"
}
]
}
]
}),
"disableAutostartMacros" : true,
"fillForms" : JSON.stringify ( {
"tags" : {
"111" : {
"text" : "Text in form with tag 111",
"checkBox" : "true",
"picture" : "https://upload.wikimedia.org/wikipedia/commons/9/91/ONLYOFFICE_logo.png",
"comboBox" : "item1"
},
"222" : {
"text" : "Text in form with tag 222",
"checkBox" : "false",
"comboBox" : "item2"
},
"333" : {
"text" : "OnlyOffice"
}
}
})
};
window.Asc.plugin.executeMethod ("SetProperties", [initSettings], function () {
window.Asc.plugin.executeCommand ("close", "");
});