GetProperty
Returns a property of the CDocBuilderValue object.
Please note, that for the
.docbuilderfile theCDocBuilderValue.GetPropertymethod is not used.
Syntax
- Python
- C++
- COM
- Java
- .Net
def GetProperty(self, name: str) -> CDocBuilderValue
CDocBuilderValue GetProperty(const wchar_t* sName);
HRESULT GetProperty([in] BSTR name, [out, retval] I_DOCBUILDER_VALUE** result);
CDocBuilderValue getProperty(String name);
CDocBuilderValue^ GetProperty(String^ sName);
Parameters
- Python
- C++
- COM
- Java
- .Net
| Name | Type | Description |
|---|---|---|
| name | str | The name of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| sName | const wchar_t* | The name of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| name | BSTR | The name of the CDocBuilderValue object property. |
| result | I_DOCBUILDER_VALUE** | The returned object property. |
| Name | Type | Description |
|---|---|---|
| name | String | The name of the CDocBuilderValue object property. |
| Name | Type | Description |
|---|---|---|
| sName | String^ | The name 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")
docPr = document.GetProperty("color")
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");
CValue oDocPr = oDocument.GetProperty("color");
CDocBuilder::Dispose();
CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
IONLYOFFICEDocBuilderContext* oContext = NULL;
IONLYOFFICEDocBuilderValue* oGlobal = NULL;
IONLYOFFICEDocBuilderValue* oApi = NULL;
oBuilder->Initialize();
oBuilder->GetContext(&oContext);
oContext->GetGlobal(&oGlobal);
oGlobal->GetProperty(_bstr_t("Api"), &oApi);
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");
CDocBuilderValue docPr = doc.getProperty("color");
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");
CValue oDocPr = oDocument.GetProperty("color");
CDocBuilder.Destroy();
Alternative ways to get a property
There are two more ways to get a property of the CDocBuilderValue object:
1. Using the Get method
- Python
- C++
- Java
- .Net
def Get(self, name: str) -> CDocBuilderValue
CDocBuilderValue Get(const char* name);
CDocBuilderValue Get(const wchar_t* name);
CDocBuilderValue get(String name);
CDocBuilderValue^ Get(String^ name);
Example
- Python
- C++
- Java
- .Net
builder = docbuilder.CDocBuilder()
context = builder.GetContext()
globalObj = context.GetGlobal()
api = globalObj["Api"]
document = api.Call("GetDocument")
docPr = document.Get("color")
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");
CValue oDocPr = oDocument.Get("color");
CDocBuilder::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");
CDocBuilderValue docPr = doc.get("color");
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");
CValue oDocPr = oDocument.Get("color");
CDocBuilder.Destroy();
2. Using the index operator
- Python
- C++
- Java
- .Net
value["property_name"]
CDocBuilderValue operator[](const char* name);
CDocBuilderValue operator[](const wchar_t* name);
value["property_name"]
property CDocBuilderValue^ default[String^]
Example
- Python
- C++
- Java
- .Net
builder = docbuilder.CDocBuilder()
context = builder.GetContext()
globalObj = context.GetGlobal()
api = globalObj["Api"]
document = api.Call("GetDocument")
docPr = document["color"]
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");
CValue oDocPr = oDocument["color"];
CDocBuilder::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");
CDocBuilderValue docPr = doc["color"];
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");
CValue oDocPr = oDocument["color"];
CDocBuilder.Destroy();