Skip to main content

SetProperty

Sets an argument which can be transferred 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.

note

For JS, the SetProperty method is not called directly. Instead, pass arguments via the CLI flags.

Syntax

def SetProperty(self, name: str, value: str)

Parameters

NameTypeDescription
namestrThe parameter name (see Supported properties).
valuestrThe parameter value which will be used in the document.

Supported properties

NameTypeDefaultDescription
--use-doctrenderer-schemeboolfalseSpecifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file.
--check-fontsbooltrueSpecifies if the system fonts are cached for faster work.
--work-directorystring""The path to the temporary directory.
--cache-scriptsbooltrueSpecifies if the sdkjs scripts are cached.
--save-use-only-namesboolfalseSpecifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt.
--all-fonts-pathstring""The path to the AllFonts.js script.
--argumentstring""The JSON argument which is sent to the global parameters of all the opened JS context.
--fonts-systembooltrueSpecifies if the system fonts are used.
--fonts-dirstring""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

builder = docbuilder.CDocBuilder()
builder.SetProperty("--argument", "{\"name\":\"ONLYOFFICE\"}")

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

builder = docbuilder.CDocBuilder()
builder.SetProperty("--check-fonts", "true")