SetProperty
Sets a property to the CDocBuilderValue object.
Please note, that for the
.docbuilderfile theCDocBuilderValue.SetPropertymethod is not used.
Syntax
void SetProperty(String^ sName, CDocBuilderValue^ sValue);
Parameters
| Parameter | Type | Description | 
|---|---|---|
| sName | String^ | The name of the CDocBuilderValueobject property. | 
| sValue | CDocBuilderValue^ | The value of the CDocBuilderValueobject property. | 
Example
.Net
string workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder";
CDocBuilder.Initialize(workDirectory);
CDocBuilder oBuilder = new CDocBuilder();
CContext oContext = oBuilder.GetContext();
CValue oGlobal = oContext.GetGlobal();
CValue oApi = oGlobal["Api"];
CValue oDocument = oApi.Call("GetDocument");
oDocument.SetProperty("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"});
CDocBuilder.Destroy();
There are two more ways to set a property to the CDocBuilderValue object:
- 
use the Setmethod that takes the object property name and value as arguments:void Set(String^ name, CDocBuilderValue^ value);Example.Netstring workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder";
 CDocBuilder.Initialize(workDirectory);
 CDocBuilder oBuilder = new CDocBuilder();
 CContext oContext = oBuilder.GetContext();
 CValue oGlobal = oContext.GetGlobal();
 CValue oApi = oGlobal["Api"];
 CValue oDocument = oApi.Call("GetDocument");
 oDocument.Set("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"});
 CDocBuilder.Destroy();
- 
use the default[]postfix expression:property CDocBuilderValue^ default[String^]Example.Netstring workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder";
 CDocBuilder.Initialize(workDirectory);
 CDocBuilder oBuilder = new CDocBuilder();
 CContext oContext = oBuilder.GetContext();
 CValue oGlobal = oContext.GetGlobal();
 CValue oApi = oGlobal["Api"];
 CValue oDocument = oApi.Call("GetDocument");
 oDocument["color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"}];
 CDocBuilder.Destroy();