[]
Sheets.FormulaPanel.FormulaEditor
• new FormulaEditor(host
, options?
)
Represents a formula editor.
example
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
formulaEditor = new GC.Spread.Sheets.FormulaPanel.FormulaEditor(document.getElementById("fe"));
formulaEditor.attach(spread);
}
Name | Type | Description |
---|---|---|
host |
HTMLElement |
The DOM element. |
options? |
IFormulaEditorOptions |
- |
• options: IFormulaEditorOptions
Indicates the options of the formula editor.
property
tabSize - Indicate the number of spaces inserted when the "Tab" key is pressed. Default is 4.
property
formatWidthLimit - Indicates the width limit when formatting, Default is 'auto'. 'auto' means that this follows the width of the dom and will try to avoid the width of a line exceeding the width of the dom.
example
formulaEditor.options.tabSize = 2;
formulaEditor.options.formatWidthLimit = -1;
▸ attach(workbook
): any
description
attach to a workbook for formula editor.
Name | Type | Description |
---|---|---|
workbook |
Workbook |
Indicates the workbook which is attached. |
any
void
▸ commandManager(): CommandManager
Gets the command manager.
example
//This example executes a command that performs a specified action.
formulaEditor.commandManager().execute({ cmd: "formatDocument" });
The command manager.
▸ destroy(): void
Destroys current formula editor.
void
▸ detach(): void
description
detach the workbook for formula editor.
void
void
▸ format(): void
format the document(formula string).
void
▸ refresh(): void
refresh the formula editor.
void
▸ text(value?
): string
Gets or sets the text.
Name | Type | Description |
---|---|---|
value? |
string |
The text. |
string
If no value is set, returns the text; otherwise, there is no return value.