# GC.Spread.Sheets.Workbook

## Content

# Class: Workbook

[Spread](../modules/GC.Spread).[Sheets](../modules/GC.Spread.Sheets).Workbook

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Workbook#constructor)

### Properties

- [contextMenu](GC.Spread.Sheets.Workbook#contextmenu)
- [name](GC.Spread.Sheets.Workbook#name)
- [options](GC.Spread.Sheets.Workbook#options)
- [sheetTabStyles](GC.Spread.Sheets.Workbook#sheettabstyles)
- [sheets](GC.Spread.Sheets.Workbook#sheets)
- [touchToolStrip](GC.Spread.Sheets.Workbook#touchtoolstrip)

### Methods

- [addCustomFunction](GC.Spread.Sheets.Workbook#addcustomfunction)
- [addCustomName](GC.Spread.Sheets.Workbook#addcustomname)
- [addNamedStyle](GC.Spread.Sheets.Workbook#addnamedstyle)
- [addSheet](GC.Spread.Sheets.Workbook#addsheet)
- [addSheetTab](GC.Spread.Sheets.Workbook#addsheettab)
- [addSparklineEx](GC.Spread.Sheets.Workbook#addsparklineex)
- [bind](GC.Spread.Sheets.Workbook#bind)
- [calculate](GC.Spread.Sheets.Workbook#calculate)
- [changeSheetIndex](GC.Spread.Sheets.Workbook#changesheetindex)
- [changeSheetPosition](GC.Spread.Sheets.Workbook#changesheetposition)
- [clearCustomFunctions](GC.Spread.Sheets.Workbook#clearcustomfunctions)
- [clearCustomNames](GC.Spread.Sheets.Workbook#clearcustomnames)
- [clearSheetTabs](GC.Spread.Sheets.Workbook#clearsheettabs)
- [clearSheets](GC.Spread.Sheets.Workbook#clearsheets)
- [commandManager](GC.Spread.Sheets.Workbook#commandmanager)
- [dataManager](GC.Spread.Sheets.Workbook#datamanager)
- [destroy](GC.Spread.Sheets.Workbook#destroy)
- [export](GC.Spread.Sheets.Workbook#export)
- [focus](GC.Spread.Sheets.Workbook#focus)
- [fromJSON](GC.Spread.Sheets.Workbook#fromjson)
- [getActiveSheet](GC.Spread.Sheets.Workbook#getactivesheet)
- [getActiveSheetIndex](GC.Spread.Sheets.Workbook#getactivesheetindex)
- [getActiveSheetTab](GC.Spread.Sheets.Workbook#getactivesheettab)
- [getActiveSheetTabIndex](GC.Spread.Sheets.Workbook#getactivesheettabindex)
- [getCircularReference](GC.Spread.Sheets.Workbook#getcircularreference)
- [getCustomFunction](GC.Spread.Sheets.Workbook#getcustomfunction)
- [getCustomName](GC.Spread.Sheets.Workbook#getcustomname)
- [getCustomNames](GC.Spread.Sheets.Workbook#getcustomnames)
- [getExternalReferences](GC.Spread.Sheets.Workbook#getexternalreferences)
- [getHost](GC.Spread.Sheets.Workbook#gethost)
- [getNamedStyle](GC.Spread.Sheets.Workbook#getnamedstyle)
- [getNamedStyles](GC.Spread.Sheets.Workbook#getnamedstyles)
- [getSheet](GC.Spread.Sheets.Workbook#getsheet)
- [getSheetCount](GC.Spread.Sheets.Workbook#getsheetcount)
- [getSheetFromName](GC.Spread.Sheets.Workbook#getsheetfromname)
- [getSheetIndex](GC.Spread.Sheets.Workbook#getsheetindex)
- [getSheetPosition](GC.Spread.Sheets.Workbook#getsheetposition)
- [getSheetTab](GC.Spread.Sheets.Workbook#getsheettab)
- [getSheetTabCount](GC.Spread.Sheets.Workbook#getsheettabcount)
- [getSheetTabIndex](GC.Spread.Sheets.Workbook#getsheettabindex)
- [hitTest](GC.Spread.Sheets.Workbook#hittest)
- [import](GC.Spread.Sheets.Workbook#import)
- [invalidateLayout](GC.Spread.Sheets.Workbook#invalidatelayout)
- [isPaintSuspended](GC.Spread.Sheets.Workbook#ispaintsuspended)
- [nextControl](GC.Spread.Sheets.Workbook#nextcontrol)
- [open](GC.Spread.Sheets.Workbook#open)
- [pageInfo](GC.Spread.Sheets.Workbook#pageinfo)
- [previousControl](GC.Spread.Sheets.Workbook#previouscontrol)
- [print](GC.Spread.Sheets.Workbook#print)
- [refresh](GC.Spread.Sheets.Workbook#refresh)
- [removeCustomFunction](GC.Spread.Sheets.Workbook#removecustomfunction)
- [removeCustomName](GC.Spread.Sheets.Workbook#removecustomname)
- [removeNamedStyle](GC.Spread.Sheets.Workbook#removenamedstyle)
- [removeSheet](GC.Spread.Sheets.Workbook#removesheet)
- [removeSheetTab](GC.Spread.Sheets.Workbook#removesheettab)
- [removeSparklineEx](GC.Spread.Sheets.Workbook#removesparklineex)
- [repaint](GC.Spread.Sheets.Workbook#repaint)
- [resumeCalcService](GC.Spread.Sheets.Workbook#resumecalcservice)
- [resumeEvent](GC.Spread.Sheets.Workbook#resumeevent)
- [resumePaint](GC.Spread.Sheets.Workbook#resumepaint)
- [save](GC.Spread.Sheets.Workbook#save)
- [savePDF](GC.Spread.Sheets.Workbook#savepdf)
- [search](GC.Spread.Sheets.Workbook#search)
- [setActiveSheet](GC.Spread.Sheets.Workbook#setactivesheet)
- [setActiveSheetIndex](GC.Spread.Sheets.Workbook#setactivesheetindex)
- [setActiveSheetTab](GC.Spread.Sheets.Workbook#setactivesheettab)
- [setSheetCount](GC.Spread.Sheets.Workbook#setsheetcount)
- [startSheetIndex](GC.Spread.Sheets.Workbook#startsheetindex)
- [suspendCalcService](GC.Spread.Sheets.Workbook#suspendcalcservice)
- [suspendEvent](GC.Spread.Sheets.Workbook#suspendevent)
- [suspendPaint](GC.Spread.Sheets.Workbook#suspendpaint)
- [toJSON](GC.Spread.Sheets.Workbook#tojson)
- [unbind](GC.Spread.Sheets.Workbook#unbind)
- [unbindAll](GC.Spread.Sheets.Workbook#unbindall)
- [undoManager](GC.Spread.Sheets.Workbook#undomanager)
- [updateExternalReference](GC.Spread.Sheets.Workbook#updateexternalreference)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new Workbook**(`host?`, `options?`)

Represents a spreadsheet with the specified hosted DOM element or DOM id and options setting.

**`example`**
```
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount:3, font:"12pt Arial"});
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount:3, newTabVisible:false});
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 3, tabEditable: false });
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount:3, tabStripVisible:false});
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount:3, allowUserResize:false});
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 3, allowUserZoom: false});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `host?` | `string` \| `HTMLElement` | The host DOM element or id. |
| `options?` | [`IWorkBookDefaultOptions`](../interfaces/GC.Spread.Sheets.IWorkBookDefaultOptions) | - |

## Properties

### <a id="contextmenu" name="contextmenu"></a> contextMenu

• **contextMenu**: [`ContextMenu`](GC.Spread.Sheets.ContextMenu.ContextMenu)

ContextMenu for the spread.

**`example`**
```
//This example shows how to get contextMenu's menuData.
var menuData = spread.contextMenu.menuData;
```

___

### <a id="name" name="name"></a> name

• **name**: `string`

Represents the name of the Spread control.

**`example`**
```
spread.name = "Spread1";
```

___

### <a id="options" name="options"></a> options

• **options**: [`IWorkbookOptions`](../interfaces/GC.Spread.Sheets.IWorkbookOptions)

Represents the options of the Spread control.

**`property`** {boolean} allowUserDragMerge - Whether to allow the user to drag merge cells.

**`property`** {boolean} allowUserDragDrop - Whether to allow the user to drag and drop range data.

**`property`** {boolean} allowUserDragFill - Whether to allow the user to drag fill a range.

**`property`** {boolean} allowUserZoom - Whether to zoom the display by scrolling the mouse wheel while pressing the Ctrl key.

**`property`** {boolean} allowUserResize - Whether to allow the user to resize columns and rows.

**`property`** {boolean} allowUndo - Whether to allow the user to undo edits.

**`property`** {boolean} allowSheetReorder - Whether the user can reorder the sheets in the Spread component.

**`property`** {boolean} allowContextMenu - Whether to allow the user to open the built-in context menu.

**`property`** {boolean} allowUserDeselect -  Whether to allow the user to can use deselect in selection.

**`property`** {GC.Spread.Sheets.Fill.AutoFillType} defaultDragFillType - The default fill type.

**`property`** {boolean} showDragFillSmartTag - Whether to display the drag fill dialog.

**`property`** {boolean} showHorizontalScrollbar - Whether to display the horizontal scroll bar.

**`property`** {boolean} showVerticalScrollbar - Whether to display the vertical scroll bar.

**`property`** {boolean} scrollbarShowMax - Whether the displayed scroll bars are based on the entire number of columns and rows in the sheet.

**`property`** {boolean} scrollbarMaxAlign - Whether the scroll bar aligns with the last row and column of the active sheet.

**`property`** {boolean} tabStripVisible - Whether to display the sheet tab strip.

**`property`** {number} tabStripRatio - The width of the tab strip expressed as a percentage of the overall horizontal scroll bar width.

**`property`** {number} tabStripWidth - The width of the tab strip when it is at the left or right position. The default and minimum is 80.

**`property`** {boolean} tabEditable - Whether to allow the user to edit the sheet tab strip.

**`property`** {GC.Spread.Sheets.TabStripPosition} tabStripPosition - The position of tab strip. The default is bottom.

**`property`** {boolean} newTabVisible - Whether the spreadsheet displays the special tab to let users insert new sheets.

**`property`** {GC.Spread.Sheets.AllSheetsListVisibility} allSheetsListVisible - Whether the spreadsheet shows a special tab to allow the user to open the dialog to display all sheets.

**`property`** {boolean} tabNavigationVisible - Whether to display the sheet tab navigation.

**`property`** {boolean} cutCopyIndicatorVisible - Whether to display an indicator when copying or cutting the selected item.

**`property`** {string} cutCopyIndicatorBorderColor - The border color for the indicator displayed when the user cuts or copies the selection.

**`property`** {string} backColor - A color string used to represent the background color of the Spread component, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on.

**`property`** {string} backgroundImage - The background image of the Spread component.

**`property`** {GC.Spread.Sheets.ImageLayout} backgroundImageLayout - The background image layout for the Spread component.

**`property`** {string} grayAreaBackColor - A color string used to represent the background color of the gray area , such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on.

**`property`** {GC.Spread.Sheets.ShowResizeTip} showResizeTip - How to display the resize tip.

**`property`** {boolean} showDragDropTip -Whether to display the drag-drop tip.

**`property`** {boolean} showDragFillTip - Whether to display the drag-fill tip.

**`property`** {GC.Spread.Sheets.ShowScrollTip} showScrollTip - How to display the scroll tip.

**`property`** {boolean} scrollIgnoreHidden - Whether the scroll bar ignores hidden rows or columns.

**`property`** {boolean} highlightInvalidData - Whether to highlight invalid data.

**`property`** {boolean} useTouchLayout - Whether to use touch layout to present the Spread component.

**`property`** {boolean} hideSelection - Whether to display the selection highlighting when the Spread component does not have focus.

**`property`** {GC.Spread.Sheets.ResizeZeroIndicator} resizeZeroIndicator - The drawing policy when the row or column is resized to zero.

**`property`** {boolean} allowUserEditFormula - Whether the user can edit formulas in a cell in the spreadsheet.

**`property`** {boolean} enableFormulaTextbox - Whether to enable the formula text box in the spreadsheet.

**`property`** {GC.Spread.Sheets.AutoFitType} autoFitType - Whether content will be formatted to fit in cells or in cells and headers.

**`property`** {GC.Spread.Sheets.ReferenceStyle} referenceStyle - the style for cell and range references in cell formulas on this sheet.

**`property`** {boolean} allowDynamicArray - Whether to enable dynamic array.

**`property`** {boolean} iterativeCalculation - Whether to enable the iterative calculation.

**`property`** {number} iterativeCalculationMaximumIterations - The Maximum Iterations when iterative calculation.

**`property`** {number} iterativeCalculationMaximumChange - The Maximum Change when iterative calculation.

**`property`** {boolean} calcOnDemand - Whether to calculate formulas only when they are demanded.

**`property`** {boolean} dynamicReferences - Whether to calculate functions with dynamic reference.

**`property`** {boolean} allowCopyPasteExcelStyle - Whether the user can copy style from Spread Sheets then paste to Excel, or copy style from Excel then paste to Spread Sheets.

**`property`** {boolean} allowExtendPasteRange - Whether extend paste range if the paste range is not enough for pasting.

**`property`** {GC.Spread.Sheets.CopyPasteHeaderOptions} copyPasteHeaderOptions - Which headers are included when data is copied to or pasted.

**`property`** {GC.Spread.Sheets.CalculationMode} calculationMode - Which headers are included when data is copied to or pasted.

**`property`** {boolean} scrollByPixel - Whether to enable the precision scrolling by pixel.

**`property`** {number} scrollPixel - Decides scrolling by that number of pixels at a time when scrollByPixel is true. The final scrolling pixels are the result of scrolling delta multiply scrollPixel. For example, the scrolling delta is 3, and the scrollPixel is 5, the final scrolling pixels are 15.

**`property`** {boolean} enableAccessibility - Whether to enable the accessibility support in the spreadsheet.

**`property`** {boolean} allowAutoCreateHyperlink - Whether to enable auto creating hyperlink in the spreadsheet.

**`property`** {GC.Spread.Sheets.ResizeMode} columnResizeMode - Specifies the way to resize column.

**`property`** {GC.Spread.Sheets.ResizeMode} rowResizeMode - Specifies the way to resize row.

**`property`** {Array} customList - The list for user to customize drag fill, prioritize matching this list in each fill. Each array item is type of string array.

**`property`** {GC.Spread.Sheets.ScrollbarAppearance} scrollbarAppearance - The scrollbar appearance, contains skin and mobile two enums. Default is skin.

**`property`** {boolean} pasteSkipInvisibleRange - Whether paste skip invisible range. Default is false.

**`property`** {boolean} allowAutoExtendFilterRange - Whether allow auto extend filter range like excel. Default is false.

**`property`** {boolean} allowInvalidFormula - Whether allow input invalid formula string. Default is false.

**`property`** {boolean} formulaFormatHint - Whether automatically generate the format when formula inputs. Default is true.

**`property`** {GC.Spread.Pivot.PivotAreaReference} pivotAreaReference  - Whether automatically generate the getPivotData formula or cell reference when choose pivot table data area. Default is getPivotData.

**`property`** {GC.Spread.Sheets.SheetTabStyles} defaultSheetTabStyles - All default state styles for sheet tabs.

**`example`**
```
// var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:5,showHorizontalScrollbar:false});
var workbook = new GC.Spread.Sheets.Workbook("ss",{sheetCount:5,showHorizontalScrollbar:false});
workbook.options.allowUserDragDrop = false;
workbook.options.allowUserZoom = false;
```

___

### <a id="sheettabstyles" name="sheettabstyles"></a> sheetTabStyles

• **sheetTabStyles**: [`SheetTabStyleManager`](GC.Spread.Sheets.SheetTabStyleManager)

A state style manager representing worksheet tabs.

___

### <a id="sheets" name="sheets"></a> sheets

• **sheets**: [`Worksheet`](GC.Spread.Sheets.Worksheet)[]

Represents the sheet collection.

___

### <a id="touchtoolstrip" name="touchtoolstrip"></a> touchToolStrip

• **touchToolStrip**: [`TouchToolStrip`](GC.Spread.Sheets.Touch.TouchToolStrip)

Represents the touch toolstrip.

## Methods

### <a id="addcustomfunction" name="addcustomfunction"></a> addCustomFunction

▸ **addCustomFunction**(`fn`): `void`

Adds a custom function.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `fn` | [`Function`](GC.Spread.CalcEngine.Functions.Function) | The function to add. |

#### Returns

`void`

___

### <a id="addcustomname" name="addcustomname"></a> addCustomName

▸ **addCustomName**(`name`, `formula`, `baseRow`, `baseCol`, `comment?`, `isReadOnly?`): `void`

Adds a custom name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The custom name. |
| `formula` | `string` | The formula. |
| `baseRow` | `number` | The row index. |
| `baseCol` | `number` | The column index. |
| `comment?` | `string` | - |
| `isReadOnly?` | `boolean` | - |

#### Returns

`void`

___

### <a id="addnamedstyle" name="addnamedstyle"></a> addNamedStyle

▸ **addNamedStyle**(`style`): `void`

Adds a style to the Workbook named styles collection.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `style` | [`Style`](GC.Spread.Sheets.Style) | The style to be added. |

#### Returns

`void`

___

### <a id="addsheet" name="addsheet"></a> addSheet

▸ **addSheet**(`index`, `sheet?`): `void`

Inserts a sheet at the specific index.

**`example`**
```
//This example adds a sheet to the spreadsheet.
spread.addSheet(0,new GC.Spread.Sheets.Worksheet("custom"));
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index at which to add a sheet. |
| `sheet?` | [`Worksheet`](GC.Spread.Sheets.Worksheet) | The sheet to be added. |

#### Returns

`void`

___

### <a id="addsheettab" name="addsheettab"></a> addSheetTab

▸ **addSheetTab**(`index`, `name`, `type`): `any`

Inserts a sheet tab at the specific index.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index at which to add a sheet tab. |
| `name` | `string` | The name of sheet tab to be added. |
| `type` | [`SheetType`](../enums/GC.Spread.Sheets.SheetType) | The type of sheet tab to be added. |

#### Returns

`any`

The added sheet tab.

___

### <a id="addsparklineex" name="addsparklineex"></a> addSparklineEx

▸ **addSparklineEx**(`sparklineEx`): `void`

Adds a SparklineEx to the SparklineEx collection.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sparklineEx` | [`SparklineEx`](GC.Spread.Sheets.Sparklines.SparklineEx) | The SparklineEx to be added. window.MySparklineEx = function(color) {     GC.Spread.Sheets.Sparklines.SparklineEx.apply(this, arguments);     this.typeName = 'MySparklineEx';     this.color = color; } MySparklineEx.prototype = new GC.Spread.Sheets.Sparklines.SparklineEx(); MySparklineEx.prototype.createFunction = function () {     var func = new GC.Spread.CalcEngine.Functions.Function('CIRCLE', 0, 0);     func.evaluate = function (args) {           return {};     };     return func;  }; MySparklineEx.prototype.paint = function (context, value, x, y, width, height) {      context.beginPath();      context.arc(x + width / 2, y + height / 2, (Math.min(width, height) - 6) / 2, 0, Math.PI * 2);      context.strokeStyle = this.color;      context.stroke(); }; spread.addSparklineEx(new MySparklineEx('green')); |

#### Returns

`void`

___

### <a id="bind" name="bind"></a> bind

▸ **bind**(`type`, `data?`, `fn?`): `void`

Binds an event to the Workbook.

**`example`**
```
//This example binds events to functions.
sheet.setActiveCell(5,5);
alert(sheet.getActiveColumnIndex());
alert(sheet.getActiveRowIndex());
spread.bind(GC.Spread.Sheets.Events.EnterCell, function (event, data) {
    alert(data.col);
    alert(data.row);
  });
spread.bind(GC.Spread.Sheets.Events.LeaveCell, function (event, data) {
    alert(data.col);
    alert(data.row);
  });
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `type` | `string` | The event type. |
| `data?` | `any` | Specifies additional data to pass along to the function. |
| `fn?` | `Function` | Specifies the function to run when the event occurs. |

#### Returns

`void`

___

### <a id="calculate" name="calculate"></a> calculate

▸ **calculate**(`type?`, `address?`): `void`

Rebuild, mark dirty, broadcast dirty and recalculate the formulas.
First rebuild and mark dirty in the address by the calculation type.
Then broadcast dirty will recursively set the dependents of dirty cells to dirty in the workbook.
In automatic mode, all the dirty cells will be calculated.
In the manual mode, only the cells in the address are calculated, other cells keep the dirty state.
If the CalcService is suspended, the recalculate will be skipped.

**`example`**
```
spread.sheets[0].setFormula(0,0,"RAND()");
spread.sheets[0].setFormula(1,0,"=Sheet2!A1");
spread.sheets[0].setFormula(2,0,"=1+2");
spread.sheets[1].setFormula(0,0,"RAND()");
spread.sheets[1].setFormula(1,0,"=Sheet1!A1");

// All the cell is recalculated.
spread.calculate();
spread.calculate(GC.Spread.Sheets.CalculationType.regular);

// Sheet1!A1 Sheet2!A2 are evaluated to new number, and Sheet1!A2 Sheet1!A3 are evaluated.
spread.calculate(GC.Spread.Sheets.CalculationType.all, "Sheet1");

// Sheet1!A1 Sheet2!A2 are evaluated to new number.
spread.calculate(GC.Spread.Sheets.CalculationType.regular, "Sheet1!A1");

// No cells are evaluated.
spread.calculate(GC.Spread.Sheets.CalculationType.regular, "Sheet1!A2");

spread.options.calculationMode = GC.Spread.Sheets.CalculationMode.manual; // Switch to manual mode

// Sheet1!A1 is evaluated to new number, Sheet1!A2 Sheet1!A3 are evaluated but don't changed, Sheet2!A2 keeps dirty in manual mode.
spread.calculate(GC.Spread.Sheets.CalculationType.all, "Sheet1");

// Sheet1!A1 is evaluated to new number, Sheet2!A2 keeps dirty in manual mode.
spread.calculate(GC.Spread.Sheets.CalculationType.regular, "Sheet1");

// Sheet2!A2 is evaluated because it is dirty.
spread.calculate(GC.Spread.Sheets.CalculationType.minimal);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `type?` | [`CalculationType`](../enums/GC.Spread.Sheets.CalculationType) | Specifies the rebuild and mark dirty types of calculation. |
| `address?` | `string` | Specifies the sheet or range to mark dirty and calculate. It will be the workbook if it's omitted. Notice that dirty dependencies out of the range will be calculated in automatic mode. |

#### Returns

`void`

___

### <a id="changesheetindex" name="changesheetindex"></a> changeSheetIndex

▸ **changeSheetIndex**(`sheetName`, `targetIndex`): `boolean`

Change sheet index and reorder sheets.

**`example`**
```
//This example show how to change sheet index.
var spread = GC.Spread.Sheets.findControl(ss);
spread.setSheetCount(5); // The sheets sequence should be "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5".
spread.changeSheetIndex("Sheet1", 3); // The sheets sequence should be "Sheet2", "Sheet3", "Sheet4", "Sheet1", "Sheet5".
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sheetName` | `string` | The sheet name. |
| `targetIndex` | `number` | The target index. |

#### Returns

`boolean`

___

### <a id="changesheetposition" name="changesheetposition"></a> changeSheetPosition

▸ **changeSheetPosition**(`sheetName`, `targetPosition`): `boolean`

Change sheet position and reorder sheets.

**`example`**
```
//This example show how to change sheet position.
var spread = GC.Spread.Sheets.findControl(ss);
spread.setSheetCount(5);
spread.addSheetTab(0, "tableSheet1", GC.Spread.Sheets.SheetType.tableSheet); // The sheets sequence should be "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5", "tableSheet1".
spread.changeSheetPosition("tableSheet1", 3); // The sheets sequence should be "Sheet1", "Sheet2", "Sheet3", "tableSheet1", "Sheet4", "Sheet5".
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sheetName` | `string` | The sheet name. |
| `targetPosition` | `number` | The target position. |

#### Returns

`boolean`

___

### <a id="clearcustomfunctions" name="clearcustomfunctions"></a> clearCustomFunctions

▸ **clearCustomFunctions**(): `void`

Clears all custom functions.

#### Returns

`void`

___

### <a id="clearcustomnames" name="clearcustomnames"></a> clearCustomNames

▸ **clearCustomNames**(): `void`

Clears custom names.

#### Returns

`void`

___

### <a id="clearsheettabs" name="clearsheettabs"></a> clearSheetTabs

▸ **clearSheetTabs**(): `void`

Clears all sheet tabs in the control.

#### Returns

`void`

___

### <a id="clearsheets" name="clearsheets"></a> clearSheets

▸ **clearSheets**(): `void`

Clears all sheets in the control.

**`example`**
```
//This example uses the clearSheets method.
spread.clearSheets();
```

#### Returns

`void`

___

### <a id="commandmanager" name="commandmanager"></a> commandManager

▸ **commandManager**(): [`CommandManager`](GC.Spread.Commands.CommandManager)

Gets the command manager.

**`example`**
```
//This example executes a command that performs a specified action.
spread.options.allowUndo = true;
spread.commandManager().execute({cmd: "outlineRow", sheetName: "Sheet1", index: 3, count: 5});
```

#### Returns

[`CommandManager`](GC.Spread.Commands.CommandManager)

The command manager.

___

### <a id="datamanager" name="datamanager"></a> dataManager

▸ **dataManager**(): [`DataManager`](GC.Data.DataManager)

Gets the data manager.

#### Returns

[`DataManager`](GC.Data.DataManager)

Returns the data manager.

___

### <a id="destroy" name="destroy"></a> destroy

▸ **destroy**(): `void`

Destroys the workbook and all sheets it contains.

**`example`**
```
//This example destroys the workbook instance.
spread.destroy();
```

#### Returns

`void`

___

### <a id="export" name="export"></a> export

▸ **export**(`successCallBack?`, `errorCallBack?`, `exportOptions?`): `void`

Exports the object state to excel or ssjson file or csv file.

**`example`**
```
spread.export(function (blob) {
   // save blob to a file
   saveAs(blob, fileName);
}, function (e) {
   console.log(e);
}, {
   fileType: GC.Spread.Sheets.FileType.excel,
   includeBindingSource: true
});
```

#### Parameters

| Name | Type |
| :------ | :------ |
| `successCallBack?` | `Function` |
| `errorCallBack?` | `Function` |
| `exportOptions?` | [`ExportOptions`](../modules/GC.Spread.Sheets#exportoptions) |

#### Returns

`void`

___

### <a id="focus" name="focus"></a> focus

▸ **focus**(`focusIn?`): `void`

Makes the Workbook component get focus or lose focus.

**`example`**
```
//This example sets focus to the Spread control.
$("#button1").click(function () {
spread.focus(true);
   });
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `focusIn?` | `boolean` | `false` makes the Workbook component lose the focus; otherwise, get focus. |

#### Returns

`void`

___

### <a id="fromjson" name="fromjson"></a> fromJSON

▸ **fromJSON**(`workbookData`, `deserializationOptions?`): `Promise`<`any`\>

Loads the object state from the specified JSON string.

**`example`**
```
//This example uses the fromJSON method.
activeSheet.getCell(0,0).value(123);
var jsonStr = null;
//export
jsonStr = JSON.stringify(spread.toJSON());
//import
var fromJSONPromise = spread.fromJSON(JSON.parse(jsonStr));
fromJSONPromise.then(() => {
     alert(jsonStr);
});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `workbookData` | `Object` | The spreadsheet data from deserialization. |
| `deserializationOptions?` | `Object` | - |

#### Returns

`Promise`<`any`\>

- The fromJSON promise.

___

### <a id="getactivesheet" name="getactivesheet"></a> getActiveSheet

▸ **getActiveSheet**(): [`Worksheet`](GC.Spread.Sheets.Worksheet)

Gets the active sheet.

#### Returns

[`Worksheet`](GC.Spread.Sheets.Worksheet)

The active sheet instance.

___

### <a id="getactivesheetindex" name="getactivesheetindex"></a> getActiveSheetIndex

▸ **getActiveSheetIndex**(): `number`

Gets the active sheet index of the control.

**`example`**
```
//This example uses the getActiveSheetIndex method.
var index = spread.getActiveSheetIndex();
alert(index);
```

#### Returns

`number`

The active sheet index.

___

### <a id="getactivesheettab" name="getactivesheettab"></a> getActiveSheetTab

▸ **getActiveSheetTab**(): `any`

Gets the active sheet tab.

#### Returns

`any`

The active sheet tab instance.

___

### <a id="getactivesheettabindex" name="getactivesheettabindex"></a> getActiveSheetTabIndex

▸ **getActiveSheetTabIndex**(): `number`

Gets the active sheet tab index of the control.

#### Returns

`number`

The active sheet tab index.

___

### <a id="getcircularreference" name="getcircularreference"></a> getCircularReference

▸ **getCircularReference**(): [`ICellsInfo`](../interfaces/GC.Spread.Sheets.ICellsInfo)[]

 Gets the all the Circular Reference cell information in the workbook.

**`example`**
```
spread.getCircularReference();
```

#### Returns

[`ICellsInfo`](../interfaces/GC.Spread.Sheets.ICellsInfo)[]

Returns circular reference cell information object array
cellsInfo.row {number} Indicates the cellRange row index.
cellsInfo.col {number} Indicates the cellRange col index.
cellsInfo.rowCount {number} Indicates the cellRange row count.
cellsInfo.colCount {number} Indicates the cellRange col count.
cellsInfo.sheetName {string} Indicates the workSheet name.

___

### <a id="getcustomfunction" name="getcustomfunction"></a> getCustomFunction

▸ **getCustomFunction**(`name`): `void`

Gets a custom function.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The custom function name. |

#### Returns

`void`

The custom function.

___

### <a id="getcustomname" name="getcustomname"></a> getCustomName

▸ **getCustomName**(`name`): [`NameInfo`](GC.Spread.Sheets.NameInfo)

Gets the specified custom name information.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The custom name. |

#### Returns

[`NameInfo`](GC.Spread.Sheets.NameInfo)

The information for the specified custom name.

___

### <a id="getcustomnames" name="getcustomnames"></a> getCustomNames

▸ **getCustomNames**(): [`NameInfo`](GC.Spread.Sheets.NameInfo)[]

Gets all custom name information.

#### Returns

[`NameInfo`](GC.Spread.Sheets.NameInfo)[]

The type GC.Spread.Sheets.NameInfo stored in an array.

___

### <a id="getexternalreferences" name="getexternalreferences"></a> getExternalReferences

▸ **getExternalReferences**(`includeItemDetail?`): [`IExternalReference`](../interfaces/GC.Spread.Sheets.IExternalReference)[]

Get the cross workbook reference list of current workbook.

**`example`**
```
//This example gets and update the used data source.
spread.getActiveSheet().setFormula(0, 0, "='[Jackson.xlsx]Sheet1'!B6+SUM('[Petrosky.xlsx]Sheet2'!B7:B8)");
spread.getExternalReferences().forEach(item=>{
     spread.updateExternalReference(item.name, spreadList[item.name], item.filePath);
})
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `includeItemDetail?` | `boolean` | Specifies whether to include the target cell and the source ranges. Default value is false. |

#### Returns

[`IExternalReference`](../interfaces/GC.Spread.Sheets.IExternalReference)[]

The externalReference array.<br/>
externalReference.name {string} The file name of cross workbook reference.<br/>
externalReference.filePath {string} The file path of cross workbook reference.

___

### <a id="gethost" name="gethost"></a> getHost

▸ **getHost**(): `HTMLElement`

Gets the host element of the current Workbook instance.

#### Returns

`HTMLElement`

host The host element of the current Workbook instance.

___

### <a id="getnamedstyle" name="getnamedstyle"></a> getNamedStyle

▸ **getNamedStyle**(`name`): [`Style`](GC.Spread.Sheets.Style)

Gets a style from the Workbook named styles collection which has the specified name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the style to return. |

#### Returns

[`Style`](GC.Spread.Sheets.Style)

Returns the specified named style.

___

### <a id="getnamedstyles" name="getnamedstyles"></a> getNamedStyles

▸ **getNamedStyles**(): [`Style`](GC.Spread.Sheets.Style)[]

Gets named styles from the Workbook.

#### Returns

[`Style`](GC.Spread.Sheets.Style)[]

The GC.Spread.Sheets.Style array of named styles.

___

### <a id="getsheet" name="getsheet"></a> getSheet

▸ **getSheet**(`index`): [`Worksheet`](GC.Spread.Sheets.Worksheet)

Gets the specified sheet.

**`example`**
```
//This example gets the sheet and sets the cell forecolor.
var sheet1 = spread.getSheet(1);
sheet1.getCell(0,0).value("A1").foreColor("red");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index of the sheet to return. |

#### Returns

[`Worksheet`](GC.Spread.Sheets.Worksheet)

The specified sheet.

___

### <a id="getsheetcount" name="getsheetcount"></a> getSheetCount

▸ **getSheetCount**(): `number`

Gets the number of sheets.

**`example`**
```
//This example uses the getSheetCount method.
var index = spread.getSheetCount();
alert(index);
```

#### Returns

`number`

The number of sheets.

___

### <a id="getsheetfromname" name="getsheetfromname"></a> getSheetFromName

▸ **getSheetFromName**(`name`): [`Worksheet`](GC.Spread.Sheets.Worksheet)

Gets the sheet with the specified name.

**`example`**
```
//This example gets the sheet and sets the cell forecolor.
var sheet1 = spread.getSheetFromName("Sheet2");
sheet1.getCell(0,0).value("A1").foreColor("red");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The sheet name. |

#### Returns

[`Worksheet`](GC.Spread.Sheets.Worksheet)

The sheet with the specified name.

___

### <a id="getsheetindex" name="getsheetindex"></a> getSheetIndex

▸ **getSheetIndex**(`name`): `number`

Gets the sheet index with the specified name.

**`example`**
```
//This example uses the getSheetIndex method.
spread.setSheetCount(5);
var index = spread.getSheetIndex("Sheet2");
alert(index); // 1
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The sheet name. |

#### Returns

`number`

The sheet index, based on the Worksheet collection.

___

### <a id="getsheetposition" name="getsheetposition"></a> getSheetPosition

▸ **getSheetPosition**(`name`): `number`

Gets the sheet tab position with the specified name.

**`example`**
```
//This example uses the getSheetPosition method.
spread.setSheetCount(5);
spread.addSheetTab(0, "tableSheet1", GC.Spread.Sheets.SheetType.tableSheet);
var position = spread.getSheetPosition("tableSheet1");
alert(position); // 5
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The sheet tab name. |

#### Returns

`number`

The sheet tab position, based on the Worksheet and TableSheet collection.

___

### <a id="getsheettab" name="getsheettab"></a> getSheetTab

▸ **getSheetTab**(`indexOrName`): `any`

Gets the specified sheet tab by index or name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `indexOrName` | `string` \| `number` | The index or name of the sheet tab to return. |

#### Returns

`any`

The specified sheet tab.

___

### <a id="getsheettabcount" name="getsheettabcount"></a> getSheetTabCount

▸ **getSheetTabCount**(): `number`

Gets the number of sheet tabs.

#### Returns

`number`

The number of sheet tabs.

___

### <a id="getsheettabindex" name="getsheettabindex"></a> getSheetTabIndex

▸ **getSheetTabIndex**(`name`): `number`

Gets the sheet tab index with the specified name.

**`example`**
```
//This example uses the getSheetTabIndex method.
spread.setSheetCount(5);
spread.addSheetTab(0, "tableSheet1", GC.Spread.Sheets.SheetType.tableSheet);
var index = spread.getSheetTabIndex("tableSheet1");
alert(index); // 0
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The sheet tab name. |

#### Returns

`number`

The sheet tab index, based on the TabSheet collection.

___

### <a id="hittest" name="hittest"></a> hitTest

▸ **hitTest**(`x`, `y`): [`IWorkbookHitTestInformation`](../interfaces/GC.Spread.Sheets.IWorkbookHitTestInformation)

Performs a hit test.

**`example`**
```
//This example uses the hitTest method.
      window.onload = function(){
          var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
          var activeSheet = spread.getActiveSheet();
          $("#ss").click(function (e) {
              //Acquire cell index from mouse-clicked point of regular cells which are neither fixed rows/columns nor row/column headers.
              var offset = $("#ss").offset();
              var x = e.pageX - offset.left;
              var y = e.pageY - offset.top;
              var target = spread.hitTest(x, y);
              if(target.worksheetHitInfo) {
                  if(target.worksheetHitInfo.hitTestType === 0) {
                      str = 'corner';
                  } else if (target.worksheetHitInfo.hitTestType === 1) {
                      str = 'colHeader';
                  } else if (target.worksheetHitInfo.hitTestType === 2) {
                      str = 'rowHeader';
                  } else {
                      str = 'viewport';
                  }
              } else if(target.tabStripHitInfo) {
                  if(target.tabStripHitInfo.navButton){
                      str = target.tabStripHitInfo.navButton;
                  } else if(target.tabStripHitInfo.sheetTab) {
                      str = target.tabStripHitInfo.sheetTab.sheetName;
                  } else if(target.tabStripHitInfo.resize === true) {
                      str = "resize";
                  } else {
                      str = "blank";
                  }
              } else if(target.horizontalScrollBarHitInfo) {
                  str = target.horizontalScrollBarHitInfo.element;
              } else if(target.verticalScrollBarHitInfo) {
                  str = target.verticalScrollBarHitInfo.element;
              } else if(target.footerCornerHitInfo) {
                  str = target.footerCornerHitInfo.element;
              }
        alert(str);
});
}
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `x` | `number` | The <i>x</i>-coordinate, x relative to spread horizontal axis. |
| `y` | `number` | The <i>y</i>-coordinate, y relative to spread vertical axis. |

#### Returns

[`IWorkbookHitTestInformation`](../interfaces/GC.Spread.Sheets.IWorkbookHitTestInformation)

The hit test information. If selecting the worksheet, the worksheet information is returned. The information contains x, y, and worksheetHitInfo;
If selecting the sheetsTabStrip, the sheetsTabStrip information is returned. This information contains x, y, and tabStripHitInfo;
If selecting the horizontalScrollbar, the horizontalScrollbar information is returned. This information contains x, y, and horizontalScrollBarHitInfo;
If selecting the verticalScrollbar, the verticalScrollbar information is returned. This information contains x, y, and verticalScrollBarHitInfo;
If selecting the footerCorner, the footerCorner information is returned. This information contains x, y, and footerCornerHitInfo.

___

### <a id="import" name="import"></a> import

▸ **import**(`file`, `successCallback?`, `errorCallback?`, `importOptions?`): `void`

Imports the object state from the excel or ssJson or csv file or javascript file.

**`example`**
```
//This example uses the import method.
//Get file blob.
var file = document.getElementById("importFileName").files[0];
// import
spread.import(file, function () {
   // success callback to do something
}, function (e) {
   console.log(e); // error callback
}, {
   fileType: GC.Spread.Sheets.FileType.excel
});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `file` | `File` | The ssJson or csv or Excel file or javascript file for import. |
| `successCallback?` | `Function` | - |
| `errorCallback?` | `Function` | - |
| `importOptions?` | [`ImportOptions`](../modules/GC.Spread.Sheets#importoptions) | - |

#### Returns

`void`

___

### <a id="invalidatelayout" name="invalidatelayout"></a> invalidateLayout

▸ **invalidateLayout**(): `void`

Updates the control layout information.

**`example`**
```
//This example updates the layout.
spread.invalidateLayout();
spread.repaint();
```

#### Returns

`void`

___

### <a id="ispaintsuspended" name="ispaintsuspended"></a> isPaintSuspended

▸ **isPaintSuspended**(): `boolean`

Get if spread paint is suspended.

#### Returns

`boolean`

___

### <a id="nextcontrol" name="nextcontrol"></a> nextControl

▸ **nextControl**(`value?`): `any`

Gets or sets the next control used by GC.Spread.Sheets.Actions.selectNextControl and GC.Spread.Sheets.Actions.moveToNextCellThenControl.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `HTMLElement` | The next control. The control must have a focus method. |

#### Returns

`any`

If no value is set, returns the next control; otherwise, returns the spreadsheet.

___

### <a id="open" name="open"></a> open

▸ **open**(`file`, `successCallback?`, `errorCallback?`, `openOptions?`): `void`

Loads the object state from the sjs zipped file.

**`example`**
```
//This example uses the open method.
//Get file blob.
var file = document.getElementById("importFileName").files[0];
// import
spread.open(file, function () {
   // success callback to do something
}, function (e) {
 console.log(e); // error callback
}, { openMode: GC.Spread.Sheets.OpenMode.lazy });
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `file` | `File` | The zipped spreadsheet data file. |
| `successCallback?` | `Function` | - |
| `errorCallback?` | `Function` | - |
| `openOptions?` | [`OpenOptions`](../modules/GC.Spread.Sheets#openoptions) | - |

#### Returns

`void`

___

### <a id="pageinfo" name="pageinfo"></a> pageInfo

▸ **pageInfo**(`sheetIndex?`): `any`

Get a page info for a sheet

**`example`**
```
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
spread.suspendPaint();
var sheet = spread.getActiveSheet();
for(var i=0;i<20;i++){
   for(var j=0;j<20;j++){
       sheet.setValue(i,j,"Row"+i+"_Column"+j);
   }
}
var pageInfos =  spread.pageInfo(0);
console.table(pageInfos.pages);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sheetIndex?` | `number` | The sheet index. |

#### Returns

`any`

return a page info for a sheet, If the sheet index is ignored return all sheet's page info in an array

___

### <a id="previouscontrol" name="previouscontrol"></a> previousControl

▸ **previousControl**(`value?`): `any`

Gets or sets the previous control used by GC.Spread.Sheets.Actions.selectPreviousControl and GC.Spread.Sheets.Actions.moveToPreviousCellThenControl.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `HTMLElement` | The previous control. The control must have a focus method. |

#### Returns

`any`

If no value is set, returns the previous control; otherwise, returns the spreadsheet.

___

### <a id="print" name="print"></a> print

▸ **print**(`sheetIndex?`): `void`

Prints the specified sheet.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sheetIndex?` | `number` | The sheet index. If the sheet index is ignored, prints all visible sheets. |

#### Returns

`void`

___

### <a id="refresh" name="refresh"></a> refresh

▸ **refresh**(): `void`

Manually refreshes the layout and rendering of the Workbook object.

**`example`**
```
//This example uses the refresh method.
spread.refresh();
```

#### Returns

`void`

___

### <a id="removecustomfunction" name="removecustomfunction"></a> removeCustomFunction

▸ **removeCustomFunction**(`name`): `void`

Removes a custom function.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The custom function name. |

#### Returns

`void`

___

### <a id="removecustomname" name="removecustomname"></a> removeCustomName

▸ **removeCustomName**(`name`): `void`

Removes the specified custom name.

**`example`**
```
//This example uses the removeCustomName method.
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 3);
spread.addCustomName("customName1","=12", 0, 0);
activeSheet.setFormula(1, 0, "customName1");
//spread.removeCustomName("customName1");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The custom name. |

#### Returns

`void`

___

### <a id="removenamedstyle" name="removenamedstyle"></a> removeNamedStyle

▸ **removeNamedStyle**(`name`): `void`

Removes a style from the Workbook named styles collection which has the specified name.

**`example`**
```
var namedStyle = new GC.Spread.Sheets.Style();
namedStyle.name = "style1";
namedStyle.backColor = "green";
spread.addNamedStyle(namedStyle);
activeSheet.setStyleName(1, 1, "style1"); // cell(1,1)'s backColor is  green.
activeSheet.setStyleName(2, 1, "style1");
var style = spread.getNamedStyle("style1");
style.foreColor = "red";    // the namedStyle's foreColor is red.
activeSheet.repaint(); // the foreColor of the cell(1,1) and cell(2,1) is red.
activeSheet.getCell(1,1).value("test");
$("#button1").click(function () {
     spread.removeNamedStyle("style1");
});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the style to remove. |

#### Returns

`void`

___

### <a id="removesheet" name="removesheet"></a> removeSheet

▸ **removeSheet**(`index`): `void`

Removes the specified sheet.

**`example`**
```
//This example removes a sheet from the spreadsheet.
spread.setSheetCount(5);
spread.removeSheet(0);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index of the sheet to remove. |

#### Returns

`void`

___

### <a id="removesheettab" name="removesheettab"></a> removeSheetTab

▸ **removeSheetTab**(`indexOrName`): `void`

Removes the specified sheet tab by index or name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `indexOrName` | `string` \| `number` | The index or name of the sheet tab to remove. |

#### Returns

`void`

___

### <a id="removesparklineex" name="removesparklineex"></a> removeSparklineEx

▸ **removeSparklineEx**(`name`): `void`

Removes a SparklineEx from the SparklineEx collection.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the SparklineEx to remove. |

#### Returns

`void`

___

### <a id="repaint" name="repaint"></a> repaint

▸ **repaint**(): `void`

Repaints the Workbook control.

**`example`**
```
//This example updates the layout.
spread.invalidateLayout();
spread.repaint();
```

#### Returns

`void`

___

### <a id="resumecalcservice" name="resumecalcservice"></a> resumeCalcService

▸ **resumeCalcService**(`recalcAll?`): `void`

Resumes the calculation service.

**`example`**
```
//This example uses the resumeCalcService method.
spread.suspendCalcService(false);
activeSheet.setValue(0,0,1);
activeSheet.setValue(0,1,2);
activeSheet.setValue(0,2,10);
activeSheet.getCell(1,1).formula("=SUM(A1:C1)");
spread.resumeCalcService(true);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `recalcAll?` | `boolean` | Specifies whether to recalculate all formulas. |

#### Returns

`void`

___

### <a id="resumeevent" name="resumeevent"></a> resumeEvent

▸ **resumeEvent**(): `void`

Resumes the event.

**`example`**
```
//This example suspends and resumes the event.
 activeSheet.bind(GC.Spread.Sheets.Events.CellChanged, function (sender, args) {
    if (args.propertyName === "value") {
        alert(activeSheet.getValue(args.row, args.col));
    }
});
spread.suspendEvent();
activeSheet.setValue(0, 0, "111");
spread.resumeEvent();
activeSheet.setValue(1, 1, "222");
```

#### Returns

`void`

___

### <a id="resumepaint" name="resumepaint"></a> resumePaint

▸ **resumePaint**(): `void`

Resumes the paint of active sheet and tab strip.

#### Returns

`void`

___

### <a id="save" name="save"></a> save

▸ **save**(`successCallBack?`, `errorCallBack?`, `saveOptions?`): `void`

Saves the spreadJS state to a sjs file.

**`example`**
```
spread.save(function (blob) {
   // save blob to a file
   saveAs(blob, fileName);
}, function (e) {
   console.log(e);
}, { includeUnusedNames: false });
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `successCallBack?` | `Function` | The success callback when save spreadJS state complete, accept Blob as argument. |
| `errorCallBack?` | `Function` | The error callback when save spreadJS state got error. |
| `saveOptions?` | [`SaveOptions`](../modules/GC.Spread.Sheets#saveoptions) | The save options. |

#### Returns

`void`

___

### <a id="savepdf" name="savepdf"></a> savePDF

▸ **savePDF**(`successCallback`, `errorCallback`, `options?`, `sheetIndex?`): `void`

Exports the specified sheet to PDF.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `successCallback` | `Function` | Call this function after successfully export. function (blob) {}. |
| `errorCallback` | `Function` | Call this function if an error occurs. The exception parameter object structure { errorCode: GC.Spread.Sheets.PDF.ErrorCode, errorMessage: string}. |
| `options?` | `Object` | - |
| `sheetIndex?` | `number` | The sheet index. If the sheet index is ignored, exports all visible sheets. |

#### Returns

`void`

___

### <a id="search" name="search"></a> search

▸ **search**(`searchCondition`): [`SearchResult`](GC.Spread.Sheets.Search.SearchResult)

Searches the text in the cells in the specified sheet for the specified string with the specified criteria.

**`example`**
```
//This example searches the active sheet using the specified search condition.
activeSheet.getCell(2,3).value("testSearch");
var searchCondition = new GC.Spread.Sheets.Search.SearchCondition();
searchCondition.searchString = "testSearch";
searchCondition.startSheetIndex = spread.getActiveSheetIndex();
searchCondition.endSheetIndex = spread.getActiveSheetIndex();
searchCondition.searchOrder = GC.Spread.Sheets.Search.SearchOrder.nOrder;
searchCondition.searchTarget = GC.Spread.Sheets.Search.SearchFoundFlags.cellText;
searchCondition.searchFlags = GC.Spread.Sheets.Search.SearchFlags.ignoreCase| GC.Spread.Sheets.Search.SearchFlags.useWildCards;
var searchresult= spread.search(searchCondition);
var str ="[searchFoundFlag:"+ searchresult.searchFoundFlag+",\r\n foundSheetIndex:"+searchresult.foundSheetIndex+",foundRowIndex:" +
searchresult.foundRowIndex+", foundColumnIndex:"+searchresult.foundColumnIndex+", foundString:"+searchresult.foundSheetIndex+"]";
alert(str);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `searchCondition` | [`SearchCondition`](GC.Spread.Sheets.Search.SearchCondition) | The search conditions. |

#### Returns

[`SearchResult`](GC.Spread.Sheets.Search.SearchResult)

The search result.

___

### <a id="setactivesheet" name="setactivesheet"></a> setActiveSheet

▸ **setActiveSheet**(`name`): `void`

Sets the active sheet by name.

**`example`**
```
//This example sets the active sheet.
spread.setSheetCount(3);
spread.setActiveSheet("Sheet2");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the sheet to make the active sheet. |

#### Returns

`void`

___

### <a id="setactivesheetindex" name="setactivesheetindex"></a> setActiveSheetIndex

▸ **setActiveSheetIndex**(`value`): `void`

Sets the active sheet index for the control.

**`example`**
```
//This example uses the setActiveSheetIndex method.
spread.setActiveSheetIndex(1);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value` | `number` | The active sheet index. |

#### Returns

`void`

___

### <a id="setactivesheettab" name="setactivesheettab"></a> setActiveSheetTab

▸ **setActiveSheetTab**(`indexOrName`): `void`

Sets the active sheet tab by index or name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `indexOrName` | `string` \| `number` | The index or name of the sheet tab to make the active sheet tab. |

#### Returns

`void`

___

### <a id="setsheetcount" name="setsheetcount"></a> setSheetCount

▸ **setSheetCount**(`count`): `void`

Sets the number of sheets.

**`example`**
```
spread.setSheetCount(5);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `count` | `number` | The number of sheets. |

#### Returns

`void`

___

### <a id="startsheetindex" name="startsheetindex"></a> startSheetIndex

▸ **startSheetIndex**(`value?`): `any`

Gets or sets the index of the first sheet to display in the spreadsheet.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The index of the first sheet to display in the spreadsheet. |

#### Returns

`any`

If no value is set, returns the index of the first sheet displayed in the spreadsheet; otherwise, returns the spreadsheet.

___

### <a id="suspendcalcservice" name="suspendcalcservice"></a> suspendCalcService

▸ **suspendCalcService**(`ignoreDirty?`): `void`

Suspends the calculation service.

**`example`**
```
//This example uses the suspendCalcService method.
spread.suspendCalcService(false);
activeSheet.setValue(0,0,1);
activeSheet.setValue(0,1,2);
activeSheet.setValue(0,2,10);
activeSheet.getCell(1,1).formula("=SUM(A1:C1)");
spread.resumeCalcService(true);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `ignoreDirty?` | `boolean` | Specifies whether to invalidate the dependency cells. |

#### Returns

`void`

___

### <a id="suspendevent" name="suspendevent"></a> suspendEvent

▸ **suspendEvent**(): `void`

Suspends the event.

**`example`**
```
//This example suspends and resumes the event.
activeSheet.bind(GC.Spread.Sheets.Events.CellChanged, function (sender, args) {
    if (args.propertyName === "value") {
        alert(activeSheet.getValue(args.row, args.col));
    }
});
spread.suspendEvent();
activeSheet.setValue(0, 0, "111");
spread.resumeEvent();
activeSheet.setValue(1, 1, "222");
```

#### Returns

`void`

___

### <a id="suspendpaint" name="suspendpaint"></a> suspendPaint

▸ **suspendPaint**(): `void`

Suspends the paint of active sheet and tab strip.

#### Returns

`void`

___

### <a id="tojson" name="tojson"></a> toJSON

▸ **toJSON**(`serializationOption?`): `Object`

Saves the object state to a JSON string.

**`example`**
```
activeSheet.getCell(0,0).value(123);
var jsonStr = null;
//export
jsonStr = JSON.stringify(spread.toJSON());
//import
spread.fromJSON(JSON.parse(jsonStr));
alert(jsonStr);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `serializationOption?` | `Object` | The serialization options. |

#### Returns

`Object`

___

### <a id="unbind" name="unbind"></a> unbind

▸ **unbind**(`type`, `fn?`): `void`

Removes the binding of an event to Workbook.

**`example`**
```
//This example removes the event binding.
activeSheet.bind(GC.Spread.Sheets.Events.CellChanged, function (sender, args) {
    if (args.propertyName === "value") {
        alert(activeSheet.getValue(args.row, args.col));
    }
});
activeSheet.setValue(0, 0, "111");
spread.unbind(GC.Spread.Sheets.Events.CellChanged);
//spread.unbindAll(); //cancel monitoring of all events.
activeSheet.setValue(1, 0, "222");
activeSheet.setValue(2, 0, "333");
activeSheet.setValue(3, 0, "444");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `type` | `string` | The event type. |
| `fn?` | `Function` | Specifies the function to run when the event occurs. |

#### Returns

`void`

___

### <a id="unbindall" name="unbindall"></a> unbindAll

▸ **unbindAll**(): `void`

Removes the binding of all events to Workbook.

**`example`**
```
//This example removes the event binding. Uncomment the unbindAll method to remove all event binding.
activeSheet.bind(GC.Spread.Sheets.Events.CellChanged, function (sender, args) {
    if (args.propertyName === "value") {
        alert(activeSheet.getValue(args.row, args.col));
    }
});
activeSheet.setValue(0, 0, "111");
spread.unbind(GC.Spread.Sheets.Events.CellChanged);
//spread.unbindAll(); //cancel monitoring of all events.
activeSheet.setValue(1, 0, "222");
activeSheet.setValue(2, 0, "333");
activeSheet.setValue(3, 0, "444");
```

#### Returns

`void`

___

### <a id="undomanager" name="undomanager"></a> undoManager

▸ **undoManager**(): [`UndoManager`](GC.Spread.Commands.UndoManager)

Gets the undo manager.

#### Returns

[`UndoManager`](GC.Spread.Commands.UndoManager)

The undo manager.

___

### <a id="updateexternalreference" name="updateexternalreference"></a> updateExternalReference

▸ **updateExternalReference**(`linkInfo`, `data?`, `filePath?`): `void`

Sets or update the data of external source with the workbook json or the external values from the successCallback result of GC.Spread.Sheets.IO.getPartialValues.

**`example`**
```
// This example sets the external source with workbook JSON.
spread.getActiveSheet().setFormula(0, 0, "[calc.xlsx]Sheet1!A1");  // spread cell A1 value is #REF!
spread2.getActiveSheet().setFormula(0, 0, "=123+1"); \xa0// spread2 cell A1 value is 124
spread.updateExternalReference("calc.xlsx", spread2.toJSON());  // spread cell A1 value is 124
// Set the data with simple JSON data:
spread.getActiveSheet().setFormula(0, 0, "=SUM([calc.xlsx]Sheet1!A1:B2"); \xa0// spread cell A1 value is #REF!
spread.updateExternalReference("calc.xlsx", {"Sheet1":[[1, 2],[1, 3]]}); \xa0// spread cell A1 value is 7
spread.updateExternalReference("calc.xlsx", {"Sheet1":{0:{0:10, 1:10}, 1:{0:10, 1:10}}}); \xa0// spread cell A1 value is 40
// This example sets the external values with the successCallback result of GC.Spread.Sheets.IO.getPartialValues
let refList = spread.getExternalReferences(true);
GC.Spread.Sheets.IO.getPartialValues(refList, getFile, (externalValues) => {
  // successCallback
  spread.updateExternalReference(externalValues);
}, (errorMsg) => {
  // errorCallback
  console.log(errorMsg);
});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `linkInfo` | `string` \| [`ExternalPartialValues`](../modules/GC.Spread.Sheets#externalpartialvalues) | The string type is the file name of the external source, mostly ends with ".xlsx". Another type should be an array of external partial values get from the callback of GC.Spread.Sheets.IO.getPartialValues. |
| `data?` | `object` | - |
| `filePath?` | `string` | - |

#### Returns

`void`
