Overview

When you input a formula, you might forget the available function names. SpreadJS provides a formula list that displays the function description when you are entering a formula. When the formula list is displayed, press the Tab key to automatically complete the formula name.

If you enter a range in a formula, the range indicator is displayed. You can use the mouse to click and select a range. Use the Function class to add your own function. For example: You can also get the function description as shown below: You can change the in-cell across sheet formula textbox and its popup elements by modify the css definition.
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount: 2}); initSpread(spread); }; function initSpread(spread) { var spreadNS = GC.Spread.Sheets; var fbx = new spreadNS.FormulaTextBox.FormulaTextBox(document.getElementById('formulaBar')); fbx.workbook(spread); spread.suspendPaint(); var sheet2 = spread.sheets[1]; sheet2.setArray(0, 0, [[1, 4, 7], [2, 5, 8], [3, 6, 9]]); var sheet = spread.sheets[0]; sheet.options.allowCellOverflow = true; sheet.setValue(1, 2, "A helpful text box is displayed when typing any formula in a cell or the area above the sheet."); sheet.setValue(2, 2, "For example: =sum(1,2,3)"); for (var i = 5; i < 35; i++) { for (var j = 1; j < 15; j++) { sheet.setValue(i, j, i * j); } } // used to help show table support feature sheet.tables.add("Table1", 4, 7, 5, 4); for (var c = 7; c <= 10; c++) { sheet.setColumnWidth(c, 90); } sheet.setFormula(3, 0, "Table1[[#Headers],[Column2]]"); // used to help show custom name support feature sheet.addCustomName("RangeB6C9", "$B$6:$C$9", 0, 0); sheet.addCustomName("Range2", "SUM($C$11:$D$14)", 0, 0); sheet.setFormula(4, 0, "AVERAGE(RangeB6C9)"); // used to help show multi supported reference types var formula = "SUM(B6:C9,E6:F9,Table1[#Data],Range2,F11:J14,D16:I17)"; sheet.setActiveCell(1, 0); sheet.getCell(1, 0).formula(formula); fbx.text("=" + formula); // used to help show cross sheet reference sheet.setFormula(5, 0, "SUM(sheet2!A1:C3)"); sheet.getRange(1, 0, 5, 1).foreColor("green"); spread.resumePaint(); }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div class="demo-options"> <div class="option-row"> <div id="formulaBar" contenteditable="true" spellcheck="false" style="font-family: Calibri;border: 1px solid #808080;width:100%;box-sizing: border-box;"></div> </div> </div> <div id="ss" style="width:100%; height: calc(100% - 20px)"></div> </div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } body { position: absolute; margin: 0; top: 0; bottom: 0; left: 0; right: 0; } .gc-across-sheet-ftb { z-index: -1 !important; } .gc-across-sheet-func-popup { z-index: -1 !important; }