## WorksheetCollection class

Encapsulates a collection of [`Worksheet`](../worksheet/) objects.

```csharp
public class WorksheetCollection : CollectionBase
```

## Properties

| Name | Description |
| --- | --- |
| [ActiveSheetIndex](../../aspose.cells.griddesktop/worksheetcollection/activesheetindex/) { get; set; } | Represents the index of active worksheet when the spreadsheet is opened. |
| [DefaultFontName](../../aspose.cells.griddesktop/worksheetcollection/defaultfontname/) { get; set; } | Gets or sets the control's default font name. |
| [Item](../../aspose.cells.griddesktop/worksheetcollection/item/) { get; } | Gets the [`Worksheet`](../worksheet/) element at the specified index. (2 indexers) |
| [Names](../../aspose.cells.griddesktop/worksheetcollection/names/) { get; } | Gets the collection of all the Name objects in the spreadsheet. |

## Methods

| Name | Description |
| --- | --- |
| [Add](../../aspose.cells.griddesktop/worksheetcollection/add/#add_1)() | Adds a worksheet to the collection. |
| [Add](../../aspose.cells.griddesktop/worksheetcollection/add/#add)(string) | Adds a worksheet to the collection. |
| [AddCopy](../../aspose.cells.griddesktop/worksheetcollection/addcopy/#addcopy)(int) | Adds a worksheet to the collection and copies data from an existed worksheet. |
| [AddCopy](../../aspose.cells.griddesktop/worksheetcollection/addcopy/#addcopy_1)(string) | Adds a worksheet to the collection and copies data from an existed worksheet. |
| [CalculateFormula](../../aspose.cells.griddesktop/worksheetcollection/calculateformula/)() | Calculates the result of formulas. |
| [Clear](../../aspose.cells.griddesktop/worksheetcollection/clear/#clear)() | Clear all worksheets. |
| [IndexOf](../../aspose.cells.griddesktop/worksheetcollection/indexof/)(Worksheet) | Searches for the specified sheet and returns the zero-based index of the first occurrence within the entire WorksheetCollection. |
| [Insert](../../aspose.cells.griddesktop/worksheetcollection/insert/#insert_1)(int) | Inserts an worksheet into the WorksheetCollection at the specified index. This worksheet row count is 256,column count is 32. The worksheet name will be generated by Add() method. |
| [Insert](../../aspose.cells.griddesktop/worksheetcollection/insert/#insert)(int, string) | Insert a worksheet. |
| [MoveTo](../../aspose.cells.griddesktop/worksheetcollection/moveto/)(int, int) | moved the sheet to the specified postion. |
| [Remove](../../aspose.cells.griddesktop/worksheetcollection/remove/)(int) | Removes the worksheet at the specified index of the WorksheetCollection. If the specific sheet is the last sheet,after removes sheet,will add a new sheet to the WorksheetCollection. |
| [RemoveAt](../../aspose.cells.griddesktop/worksheetcollection/removeat/#removeat)(int) | Removes the sheet by the index. |
| [RemoveAt](../../aspose.cells.griddesktop/worksheetcollection/removeat/#removeat_2)(string) | Removes the sheet by the name. |
| [SetVisible](../../aspose.cells.griddesktop/worksheetcollection/setvisible/)(string, bool) | Sets the visible for the worksheet. |
| [SwapSheet](../../aspose.cells.griddesktop/worksheetcollection/swapsheet/)(int, int) | Swaps the two sheets. |

### See Also

* namespace [Aspose.Cells.GridDesktop](../../aspose.cells.griddesktop/)
* assembly [Aspose.Cells.GridDesktop](../../)


