Do you want to:
Ask a how-to question / clarify the intended API behavior.
DocSpace version:
Not known. I am using the hosted ONLYOFFICE DocSpace Cloud service:
Type of installation of the DocSpace:
Hosted cloud service provided by ONLYOFFICE. I did not install DocSpace myself, so a self-hosted installation guide is not applicable.
OS: Windows 11
Browser version: Chrome 155.0.8059.85
Additional information:
I would like to clarify the intended handling of logical values passed to JavaScript custom functions.
In the ONLYOFFICE DocSpace web spreadsheet editor, a TRUE cell passed to a custom function with an @param {any} parameter arrives as the JavaScript string “TRUE”, rather than the boolean true. This any behavior was confirmed in the web-based spreadsheet editor.
Additional tests using the unmodified official SDKJS master compared the following parameter declarations:
| Parameter declaration | Observed JavaScript value for TRUE |
|---|---|
| any | Array element is the string “TRUE” |
| boolean | Boolean true |
| boolean | Array element is the string “TRUE” |
The SDK revision used for these comparisons was ONLYOFFICE/sdkjs commit:
9d2138866d929be32f1d107e8b5bfae36156e097
The boolean and boolean comparisons above were performed in the SDK harness; they have not yet been confirmed separately in the DocSpace web UI.
Minimal custom functions for comparison:
(function () {
/**
* Inspect an any[][] argument.
* @customfunction
* @param {any[][]} value Input.
* @returns {string} JavaScript type and value.
*/
function PROBE_ANY_MATRIX(value) {
return typeof value[0][0] + ":value=" + String(value[0][0]);
}
Api.AddCustomFunction(PROBE_ANY_MATRIX);
/**
* Inspect a boolean argument.
* @customfunction
* @param {boolean} value Input.
* @returns {string} JavaScript type and value.
*/
function PROBE_BOOL(value) {
return typeof value + ":value=" + String(value);
}
Api.AddCustomFunction(PROBE_BOOL);
/**
* Inspect a boolean[][] argument.
* @customfunction
* @param {boolean[][]} value Input.
* @returns {string} JavaScript type and value.
*/
function PROBE_BOOL_MATRIX(value) {
return typeof value[0][0] + ":value=" + String(value[0][0]);
}
Api.AddCustomFunction(PROBE_BOOL_MATRIX);
})();
After registering these functions, enter:
A1: =TRUE()
D1: =PROBE_ANY_MATRIX(A1)
D2: =PROBE_BOOL(A1)
D3: =PROBE_BOOL_MATRIX(A1)
The SDK results are:
D1: string:value=TRUE
D2: boolean:value=true
D3: string:value=TRUE
Built-in functions still recognize the original cell as a logical value: ISLOGICAL(A1) returns TRUE, TYPE(A1) returns 4, and ISNUMBER(A1) returns FALSE in the SDK tests.
The API documentation lists any, boolean, and boolean as supported parameter types:
Is conversion to a string intended for any parameters? Also, should elements of a boolean argument be JavaScript booleans, as they are for a scalar boolean argument?
If this is intended behavior, could the conversion rules be documented? Otherwise, could you investigate the inconsistency, particularly for boolean?