SetPropertyW

void SetPropertyW(sParam: const wchar_t*, sValue: const wchar_t*)

Description

Sets an argument in the Unicode format which can be trasferred to the program outside the CDocBuilder.ExecuteCommand method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script.

Please note, that for the .docbuilder file the CDocBuilder.SetPropertyW method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below.

Parameters

sParamconst wchar_t*
The parameter name in the Unicode format, the value is always --argument.
sValueconst wchar_t*
The parameter value in the Unicode format which will be used in the document.

Supported properties

--use-doctrenderer-schemebooldefault: false
Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file.
--check-fontsbooldefault: true
Specifies if the system fonts are cached for faster work.
--work-directoryconst wchar_t*default: ""
The path to the temporary directory.
--cache-scriptsbooldefault: true
Specifies if the sdkjs scripts are cached.
--save-use-only-namesbooldefault: false
Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt.
--all-fonts-pathconst wchar_t*default: ""
The path to the AllFonts.js script.
--argumentconst wchar_t*default: ""
The JSON argument which is sent to the global parameters of all the opened JS context.
--fonts-systembooldefault: true
Specifies if the system fonts are used.
--fonts-dirconst wchar_t*default: ""
The path to the additional fonts directory (may be many records).

Once added, the argument will be available as the Argument variable with its parameter values set:

Argument.name === "ONLYOFFICE" // true

Example

C++

std::wstring sWorkDirectory = NSUtils::GetBuilderDirectory();
CDocBuilder::Initialize(sWorkDirectory.c_str());
CDocBuilder oBuilder;
oBuilder.SetPropertyW("--argument", L"{\"name\":\"ONLYOFFICE\"}");
CDocBuilder::Dispose();

.docbuilder

docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder

Adding or removing fonts

It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the check-fonts variable is used:

Example

C++

std::wstring sWorkDirectory = NSUtils::GetBuilderDirectory();
CDocBuilder::Initialize(sWorkDirectory.c_str());
CDocBuilder oBuilder;
oBuilder.SetPropertyW("--check-fonts", L"true");
CDocBuilder::Dispose();

.docbuilder

docbuilder.exe "--check-fonts=true" test.docbuilder

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).