Class WorksheetCollection

WorksheetCollection class

Encapsulates a collection of Worksheet objects.

public class WorksheetCollection : CollectionBase

Properties

NameDescription
ActiveSheetIndex { get; set; }Represents the index of active worksheet when the spreadsheet is opened.
DefaultFontName { get; set; }Gets or sets the control’s default font name.
Item { get; }Gets the Worksheet element at the specified index. (2 indexers)
Names { get; }Gets the collection of all the Name objects in the spreadsheet.

Methods

NameDescription
Add()Adds a worksheet to the collection.
Add(string)Adds a worksheet to the collection.
AddCopy(int)Adds a worksheet to the collection and copies data from an existed worksheet.
AddCopy(string)Adds a worksheet to the collection and copies data from an existed worksheet.
CalculateFormula()Calculates the result of formulas.
Clear()Clear all worksheets.
IndexOf(Worksheet)Searches for the specified sheet and returns the zero-based index of the first occurrence within the entire WorksheetCollection.
Insert(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(int, string)Insert a worksheet.
MoveTo(int, int)moved the sheet to the specified postion.
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(int)Removes the element at a specified index.
RemoveAt(string)Removes the element at a specified name.
SetVisible(string, bool)Sets the visible options.
SwapSheet(int, int)Swaps the two sheets.

See Also