[]
Sheets.FormulaPanel.FormulaEditor
• new FormulaEditor(host, options?)
表示一个公式编辑器。
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 |
宿主元素。 |
options? |
IFormulaEditorOptions |
选项。默认是 { tabSize: 4, formatWidthLimit: 'auto' } |
• options: IFormulaEditorOptions
表示公式编辑器的选项。
property tabSize - 指示当按下"Tab"键时插入的空格数。默认是4。
property formatWidthLimit - 指示格式化时的宽度限制,默认是'auto'。'auto'表示跟随dom的宽度,并尝试避免一行宽度超过dom的宽度。
example
formulaEditor.options.tabSize = 2;
formulaEditor.options.formatWidthLimit = -1;
▸ attach(workbook): void
将公式编辑器附加到工作簿。
| Name | Type | Description |
|---|---|---|
workbook |
Workbook |
要附加的工作簿。 |
void
void
▸ commandManager(): CommandManager
获取命令管理器。
example
//此示例执行一个执行指定操作的命令。
formulaEditor.commandManager().execute({ cmd: "formatDocument" });
命令管理器。
▸ destroy(): void
销毁当前公式编辑器。
void
▸ detach(): void
将公式编辑器从工作簿分离。
void
void
▸ format(): void
格式化文档(公式字符串)。
void
▸ refresh(): void
刷新公式编辑器。
void
▸ text(value?): string
获取或设置文本。
| Name | Type | Description |
|---|---|---|
value? |
string |
文本值。 |
string
如果未设置值,则返回文本;否则无返回值。