SetProperty
Sets a property to the CDocBuilderValue object.
Please note, that for the
.docbuilderfile theCDocBuilderValue.SetPropertymethod is not used.
Syntax
- Python
- C++
- COM
- Java
- .Net
def SetProperty(self, name: str, value: CDocBuilderValue) -> None
void SetProperty(const wchar_t* sName, CDocBuilderValue sValue);
HRESULT SetProperty([in] BSTR name, [in] I_DOCBUILDER_VALUE** value);
void setProperty(String name, Object value);
void SetProperty(String^ sName, CDocBuilderValue^ sValue);
Parameters
- Python
- C++
- COM
- Java
- .Net
| Name | Type | Description |
|---|---|---|
| name | str | The name of the CDocBuilderValue object property. |
| value | CDocBuilderValue | The value of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| sName | const wchar_t* | The name of the CDocBuilderValue object property. |
| sValue | CDocBuilderValue | The value of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| name | BSTR | The name of the CDocBuilderValue object property. |
| value | I_DOCBUILDER_VALUE** | The value of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| name | String | The name of the CDocBuilderValue object property. |
| value | Object | The value of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| sName | String^ | The name of the CDocBuilderValue object property. |
| sValue | CDocBuilderValue^ | The value of the CDocBuilderValue object property. |
Example
- Python
- C++
- COM
- Java
- .Net
builder = docbuilder.CDocBuilder()
context = builder.GetContext()
globalObj = context.GetGlobal()
api = globalObj["Api"]
document = api.Call("GetDocument")
document.SetProperty("color", colorValue)
std::wstring sWorkDirectory = NSUtils::GetBuilderDirectory();
CDocBuilder::Initialize(sWorkDirectory.c_str());
CDocBuilder oBuilder;
CContext oContext = oBuilder.GetContext();
CValue oGlobal = oContext.GetGlobal();
CValue oApi = oGlobal["Api"];
CValue oDocument = oApi.Call("GetDocument");
oDocument.SetProperty("color", colorValue);
CDocBuilder::Dispose();
CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
IONLYOFFICEDocBuilderContext* oContext = NULL;
IONLYOFFICEDocBuilderValue* oGlobal = NULL;
IONLYOFFICEDocBuilderValue* oApi = NULL;
IONLYOFFICEDocBuilderValue* oDocument = NULL;
oBuilder->Initialize();
oBuilder->GetContext(&oContext);
oContext->GetGlobal(&oGlobal);
oGlobal->GetProperty(_bstr_t("Api"), &oApi);
oApi->Call(_bstr_t("GetDocument"), ATL::CComVariant(), ATL::CComVariant(), ATL::CComVariant(), ATL::CComVariant(), ATL::CComVariant(), ATL::CComVariant(), &oDocument);
oDocument->SetProperty("color", colorValue);
oBuilder->Dispose();
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
CDocBuilderContext context = builder.getContext();
CDocBuilderValue global = context.getGlobal();
CDocBuilderValue api = global.get("Api");
CDocBuilderValue doc = api.call("GetDocument");
doc.setProperty("color", colorValue);
CDocBuilder.dispose();
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", colorValue);
CDocBuilder.Destroy();
Alternative ways to set a property
There are two more ways to set a property to the CDocBuilderValue object:
1. Using the Set method
- Python
- C++
- Java
- .Net
def Set(self, name: str, value: CDocBuilderValue) -> None
void Set(const wchar_t* name, CDocBuilderValue value);
void set(String name, Object value);
void Set(String^ name, CDocBuilderValue^ value);
2. Using the index operator
- Python
- C++
- Java
- .Net
document["property_name"] = value
document["property_name"] = value;
document["property_name"] = value;
document["property_name"] = value;