Premium plugin : Formula editors advanced - GBonnaire/jspreadsheet-plugins-and-editors Wiki

JSpreadsheet Plugin : Formula editors advanced

For JSpreadsheet v7:

You can buy this plugin on Repo plugin formula Demo is available on demo formula

For JSpreadsheet v8:

You can buy this plugin on Repo plugin formula Demo coming soon

Features

Dependencies

Options of plugin

For translation (required on v7)

For JSS v8 you can use dictionary with jSuites

jSuites.setDictionary({
    "Example": "Exemple",
    "Results": "Resultats",
    "Parameters": "Paramètres",
    "Learn more": "En savoir plus",
    "Read more": "Lire plus",
});

Methods of plugin

Formula documentation

You can write your documentation of formulas, by default, this documentation is the same of Google Sheet formula. For write your documentation, add new item on the var jspreadsheet.formulasDoc

1 item of jspreadsheet.formulasDoc is construct like :

jspreadsheet.formulasDoc['MYFUNCTION()'] = {
       syntax:"MYFUNCTION(value, value)",
       description:"My custom function description ",
       examples:"MYFUNCTION(2008, 7) equals 25",
       params:[
           {type:"Float", comment:"First value"},
           {type:"Float", comment:"Second value"}
        ],
       link:"https://mydocs.domain.ext/doc/123456"
};

Important on jspreadsheet.formulasDoc object, define key property formula with () to end else it considers it as a variable.

Get started

Header on page for v7

<script src="https://jspreadsheet.com/v7/jspreadsheet.js"></script>
<script src="https://jspreadsheet.com/v7/jsuites.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v7/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://jspreadsheet.com/v7/jspreadsheet.css" type="text/css" />

<script src="/path/to/jss.formula.js"></script>
<link rel="stylesheet" href="/path/to/jss.formula.css" type="text/css" />

Header on page for v8

<script src="https://jsuites.net/v4/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />

<script src="https://jspreadsheet.com/v8/jspreadsheet.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v8/jspreadsheet.css" type="text/css" />

<script src="http://www.jspreadsheet.com/v8/plugins/formula.js"></script>

<script src="/path/to/jss.formula.js"></script>
<link rel="stylesheet" href="/path/to/jss.formula.css" type="text/css" />

Initialize plugin on JSpreadsheet

jspreadsheet(document.getElementById('spreadsheet'), {
	...
	plugins: [
      ...
      { 
         name:'formula',
         plugin:jss_formula,
         options:{
            allowFormulaOnTypes: "myCustomEditor",
            allowAutocomplete: false,
            allowHelper: false,
         }
      },
      ...  
    ],
    ...
});

Example with custom formula

Add on header of page after loading plugin

<script>
   var MY_CUSTOM_FORMULA = function(a,b) {return a+b;};
   jspreadsheet.formulasDoc["MY_CUSTOM_FORMULA()"] = {syntax:"MY_CUSTOM_FORMULA(number,number)",description:"One custom formula for test"};
</script>

Initialize plugin on JSpreadsheet

jspreadsheet(document.getElementById('spreadsheet'), {
	...
	plugins: [
      ...
   	{ name:'formula', plugin:jss_formula },
      ...  
    ],
    ...
});

Copyright and license

Copyright GBonnaire.fr and Code released under the commercial License. This plugin requiere license of Repo.gbonnaire.fr