ONLYOFFICE / DesktopEditors

An office suite that combines text, spreadsheet and presentation editors allowing to create, view and edit local documents
https://www.onlyoffice.com
Other
2.64k stars 311 forks source link

Proposal for Extending Spreadsheet Functionality with Custom User-Defined Formulas #1583

Closed eSkry closed 3 weeks ago

eSkry commented 4 weeks ago

This issue is unique.

Your idea.

Description: The basic set of formulas is often insufficient. It would be beneficial to enable users to create custom plugins to extend the standard function set.

Idea: Add a registerFormula method to the Plugin API. This method should accept a formula name and a handler function. In the spreadsheet editor, users should be able to invoke the registered function just like any other formula: =MY_CUSTOM_FUNC(A2, "arg2").

Example:

window.Task.plugin.functions.registerFormula(
    "MY_FUNCTION_NAME",
    function(myarg1, myarg2, myarg3) {
        // Calculate
        return result;
    },
    "This function does..." // Description
);

Usage in spreadsheet cells: =MY_FUNCTION_NAME(A4, "dsfa", 34)

askonev commented 4 weeks ago

@eSkry On version 8.1, the functionality of adding custom functions based on js is implemented. It is also possible to use the functions of the builder api methods in the block