## Worksheet class

Encapsulates the object that represents a single worksheet.

```csharp
public class Worksheet : IDisposable
```

## Properties

| Name | Description |
| --- | --- |
| [ActiveCell](../../aspose.cells/worksheet/activecell/) { get; set; } | Gets or sets the active cell in the worksheet. |
| [AllowEditRanges](../../aspose.cells/worksheet/alloweditranges/) { get; } | Gets the allow edit range collection in the worksheet. |
| [AutoFilter](../../aspose.cells/worksheet/autofilter/) { get; } | Represents auto filter for the specified worksheet. |
| [BackgroundImage](../../aspose.cells/worksheet/backgroundimage/) { get; set; } | Gets and sets worksheet background image. |
| [Cells](../../aspose.cells/worksheet/cells/) { get; } | Gets the [`Cells`](../cells/) collection. |
| [CellWatches](../../aspose.cells/worksheet/cellwatches/) { get; } | Gets collection of cells on this worksheet being watched in the 'watch window'. |
| [Charts](../../aspose.cells/worksheet/charts/) { get; } | Gets a [`Chart`](../../aspose.cells.charts/chart/) collection |
| [CheckBoxes](../../aspose.cells/worksheet/checkboxes/) { get; } | Gets a [`CheckBox`](../../aspose.cells.drawing/checkbox/) collection. |
| [CodeName](../../aspose.cells/worksheet/codename/) { get; set; } | Gets worksheet code name. |
| [Comments](../../aspose.cells/worksheet/comments/) { get; } | Gets the [`Comment`](../comment/) collection. |
| [ConditionalFormattings](../../aspose.cells/worksheet/conditionalformattings/) { get; } | Gets the ConditionalFormattings in the worksheet. |
| [CustomProperties](../../aspose.cells/worksheet/customproperties/) { get; } | Gets an object representing the identifier information associated with a worksheet. |
| [DisplayRightToLeft](../../aspose.cells/worksheet/displayrighttoleft/) { get; set; } | Indicates if the specified worksheet is displayed from right to left instead of from left to right. Default is false. |
| [DisplayZeros](../../aspose.cells/worksheet/displayzeros/) { get; set; } | True if zero values are displayed. |
| [ErrorCheckOptions](../../aspose.cells/worksheet/errorcheckoptions/) { get; } | Gets error check setting applied on certain ranges. |
| [FirstVisibleColumn](../../aspose.cells/worksheet/firstvisiblecolumn/) { get; set; } | Represents first visible column index. |
| [FirstVisibleRow](../../aspose.cells/worksheet/firstvisiblerow/) { get; set; } | Represents first visible row index. |
| [GridlineColor](../../aspose.cells/worksheet/gridlinecolor/) { get; set; } | Gets and sets the color of gridline |
| [HasAutofilter](../../aspose.cells/worksheet/hasautofilter/) { get; } | Indicates whether this worksheet has auto filter. |
| [HorizontalPageBreaks](../../aspose.cells/worksheet/horizontalpagebreaks/) { get; } | Gets the [`HorizontalPageBreakCollection`](../horizontalpagebreakcollection/) collection. |
| [Hyperlinks](../../aspose.cells/worksheet/hyperlinks/) { get; } | Gets the [`HyperlinkCollection`](../hyperlinkcollection/) collection. |
| [Index](../../aspose.cells/worksheet/index/) { get; } | Gets the index of sheet in the worksheet collection. |
| [IsGridlinesVisible](../../aspose.cells/worksheet/isgridlinesvisible/) { get; set; } | Gets or sets a value indicating whether the gridlines are visible.Default is true. |
| [IsOutlineShown](../../aspose.cells/worksheet/isoutlineshown/) { get; set; } | Indicates whether to show outline. |
| [IsPageBreakPreview](../../aspose.cells/worksheet/ispagebreakpreview/) { get; set; } | Indicates whether the specified worksheet is shown in normal view or page break preview. |
| [IsProtected](../../aspose.cells/worksheet/isprotected/) { get; } | Indicates if the worksheet is protected. |
| [IsRowColumnHeadersVisible](../../aspose.cells/worksheet/isrowcolumnheadersvisible/) { get; set; } | Gets or sets a value indicating whether the worksheet will display row and column headers. Default is true. |
| [IsRulerVisible](../../aspose.cells/worksheet/isrulervisible/) { get; set; } | Indicates whether the ruler is visible. This property is only applied for page break preview. |
| [IsSelected](../../aspose.cells/worksheet/isselected/) { get; set; } | Indicates whether this worksheet is selected when the workbook is opened. |
| [IsVisible](../../aspose.cells/worksheet/isvisible/) { get; set; } | Represents if the worksheet is visible. |
| [ListObjects](../../aspose.cells/worksheet/listobjects/) { get; } | Gets all ListObjects in this worksheet. |
| [Name](../../aspose.cells/worksheet/name/) { get; set; } | Gets or sets the name of the worksheet. |
| [OleObjects](../../aspose.cells/worksheet/oleobjects/) { get; } | Represents a collection of [`OleObject`](../../aspose.cells.drawing/oleobject/) in a worksheet. |
| [Outline](../../aspose.cells/worksheet/outline/) { get; } | Gets the outline on this worksheet. |
| [PageSetup](../../aspose.cells/worksheet/pagesetup/) { get; } | Represents the page setup description in this sheet. |
| [PaneState](../../aspose.cells/worksheet/panestate/) { get; } | Indicates whether the pane has horizontal or vertical splits, and whether those splits are frozen. |
| [Pictures](../../aspose.cells/worksheet/pictures/) { get; } | Gets a [`Picture`](../../aspose.cells.drawing/picture/) collection. |
| [PivotTables](../../aspose.cells/worksheet/pivottables/) { get; } | Gets all pivot tables in this worksheet. |
| [Protection](../../aspose.cells/worksheet/protection/) { get; } | Represents the various types of protection options available for a worksheet. Supports advanced protection options in ExcelXP and above version. |
| [QueryTables](../../aspose.cells/worksheet/querytables/) { get; } | Gets [`QueryTableCollection`](../querytablecollection/) in the worksheet. |
| [Scenarios](../../aspose.cells/worksheet/scenarios/) { get; } | Gets the collection of [`Scenario`](../scenario/). |
| [Shapes](../../aspose.cells/worksheet/shapes/) { get; } | Returns all drawing shapes in this worksheet. |
| [ShowDataTypeIcons](../../aspose.cells/worksheet/showdatatypeicons/) { get; set; } | Indicates whether to show data type icons. |
| [ShowFormulas](../../aspose.cells/worksheet/showformulas/) { get; set; } | Indicates whether to show formulas or their results. |
| [Slicers](../../aspose.cells/worksheet/slicers/) { get; } | Get the Slicer collection in the worksheet |
| [SmartTagSetting](../../aspose.cells/worksheet/smarttagsetting/) { get; } | Gets all [`SmartTagCollection`](../../aspose.cells.markup/smarttagcollection/) objects of the worksheet. |
| [SparklineGroups](../../aspose.cells/worksheet/sparklinegroups/) { get; } | Gets the sparkline groups in the worksheet. |
| [TabColor](../../aspose.cells/worksheet/tabcolor/) { get; set; } | Represents worksheet tab color. |
| [TabId](../../aspose.cells/worksheet/tabid/) { get; set; } | Specifies the internal identifier for the sheet. |
| [TextBoxes](../../aspose.cells/worksheet/textboxes/) { get; } | Gets a [`TextBox`](../../aspose.cells.drawing/textbox/) collection. |
| [Timelines](../../aspose.cells/worksheet/timelines/) { get; } | Get the Timeline collection in the worksheet |
| [TransitionEntry](../../aspose.cells/worksheet/transitionentry/) { get; set; } | Indicates whether the Transition Formula Entry (Lotus compatibility) option is enabled. |
| [TransitionEvaluation](../../aspose.cells/worksheet/transitionevaluation/) { get; set; } | Indicates whether the Transition Formula Evaluation (Lotus compatibility) option is enabled. |
| [Type](../../aspose.cells/worksheet/type/) { get; set; } | Represents worksheet type. |
| [UniqueId](../../aspose.cells/worksheet/uniqueid/) { get; set; } | Gets and sets the unique id, it is same as {15DB5C3C-A5A1-48AF-8F25-3D86AC232D4F}. |
| [Validations](../../aspose.cells/worksheet/validations/) { get; } | Gets the data validation setting collection in the worksheet. |
| [VerticalPageBreaks](../../aspose.cells/worksheet/verticalpagebreaks/) { get; } | Gets the [`VerticalPageBreakCollection`](../verticalpagebreakcollection/) collection. |
| [ViewType](../../aspose.cells/worksheet/viewtype/) { get; set; } | Gets and sets the view type. |
| [VisibilityType](../../aspose.cells/worksheet/visibilitytype/) { get; set; } | Indicates the visible state for this sheet. |
| [Workbook](../../aspose.cells/worksheet/workbook/) { get; } | Gets the workbook object which contains this sheet. |
| [Zoom](../../aspose.cells/worksheet/zoom/) { get; set; } | Represents the scaling factor in percentage. It should be between 10 and 400. |

## Methods

| Name | Description |
| --- | --- |
| [AddPageBreaks](../../aspose.cells/worksheet/addpagebreaks/)(string) | Adds page break. |
| [AdvancedFilter](../../aspose.cells/worksheet/advancedfilter/)(bool, string, string, string, bool) | Filters data using complex criteria. |
| [AutoFitColumn](../../aspose.cells/worksheet/autofitcolumn/#autofitcolumn)(int) | Autofits the column width. |
| [AutoFitColumn](../../aspose.cells/worksheet/autofitcolumn/#autofitcolumn_1)(int, int, int) | Autofits the column width. |
| [AutoFitColumns](../../aspose.cells/worksheet/autofitcolumns/#autofitcolumns)() | Autofits all columns in this worksheet. |
| [AutoFitColumns](../../aspose.cells/worksheet/autofitcolumns/#autofitcolumns_1)(AutoFitterOptions) | Autofits all columns in this worksheet. |
| [AutoFitColumns](../../aspose.cells/worksheet/autofitcolumns/#autofitcolumns_2)(int, int) | Autofits the columns width. |
| [AutoFitColumns](../../aspose.cells/worksheet/autofitcolumns/#autofitcolumns_3)(int, int, AutoFitterOptions) | Autofits the columns width. |
| [AutoFitColumns](../../aspose.cells/worksheet/autofitcolumns/#autofitcolumns_4)(int, int, int, int) | Autofits the columns width. |
| [AutoFitColumns](../../aspose.cells/worksheet/autofitcolumns/#autofitcolumns_5)(int, int, int, int, AutoFitterOptions) | Autofits the columns width. |
| [AutoFitRow](../../aspose.cells/worksheet/autofitrow/#autofitrow)(int) | Autofits the row height. |
| [AutoFitRow](../../aspose.cells/worksheet/autofitrow/#autofitrow_1)(int, int, int) | Autofits the row height. |
| [AutoFitRow](../../aspose.cells/worksheet/autofitrow/#autofitrow_2)(int, int, int, AutoFitterOptions) | Autofits the row height. |
| [AutoFitRow](../../aspose.cells/worksheet/autofitrow/#autofitrow_3)(int, int, int, int) | Autofits row height in a rectangle range. |
| [AutoFitRows](../../aspose.cells/worksheet/autofitrows/#autofitrows)() | Autofits all rows in this worksheet. |
| [AutoFitRows](../../aspose.cells/worksheet/autofitrows/#autofitrows_1)(AutoFitterOptions) | Autofits all rows in this worksheet. |
| [AutoFitRows](../../aspose.cells/worksheet/autofitrows/#autofitrows_2)(bool) | Autofits all rows in this worksheet. |
| [AutoFitRows](../../aspose.cells/worksheet/autofitrows/#autofitrows_3)(int, int) | Autofits row height in a range. |
| [AutoFitRows](../../aspose.cells/worksheet/autofitrows/#autofitrows_4)(int, int, AutoFitterOptions) | Autofits row height in a range. |
| [CalculateArrayFormula](../../aspose.cells/worksheet/calculatearrayformula/#calculatearrayformula)(string, CalculationOptions) | Calculates a formula as array formula. |
| [CalculateArrayFormula](../../aspose.cells/worksheet/calculatearrayformula/#calculatearrayformula_1)(string, CalculationOptions, int, int) | Calculates a formula as array formula. |
| [CalculateArrayFormula](../../aspose.cells/worksheet/calculatearrayformula/#calculatearrayformula_2)(string, FormulaParseOptions, CalculationOptions, int, int, int, int, CalculationData) | Calculates a formula as array formula. |
| [CalculateFormula](../../aspose.cells/worksheet/calculateformula/#calculateformula)(string) | Calculates a formula. |
| [CalculateFormula](../../aspose.cells/worksheet/calculateformula/#calculateformula_3)(CalculationOptions, bool) | Calculates all formulas in this worksheet. |
| [CalculateFormula](../../aspose.cells/worksheet/calculateformula/#calculateformula_1)(string, CalculationOptions) | Calculates a formula expression directly. |
| [CalculateFormula](../../aspose.cells/worksheet/calculateformula/#calculateformula_2)(string, FormulaParseOptions, CalculationOptions, int, int, CalculationData) | Calculates a formula expression directly. |
| [ClearComments](../../aspose.cells/worksheet/clearcomments/)() | Clears all comments in designer spreadsheet. |
| [CloseAccessCache](../../aspose.cells/worksheet/closeaccesscache/)(AccessCacheOptions) | Closes the session that uses caches to access the data in this worksheet. |
| [ConvertFormulaReferenceStyle](../../aspose.cells/worksheet/convertformulareferencestyle/)(string, bool, int, int) | Converts the formula reference style. |
| [Copy](../../aspose.cells/worksheet/copy/#copy)(Worksheet) | Copies contents and formats from another worksheet. |
| [Copy](../../aspose.cells/worksheet/copy/#copy_1)(Worksheet, CopyOptions) | Copies contents and formats from another worksheet. |
| [Dispose](../../aspose.cells/worksheet/dispose/)() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| [Filter](../../aspose.cells/worksheet/filter/)(CellArea) | Filters the range. |
| [FreezePanes](../../aspose.cells/worksheet/freezepanes/#freezepanes_1)(string, int, int) | Freezes panes at the specified cell in the worksheet. |
| [FreezePanes](../../aspose.cells/worksheet/freezepanes/#freezepanes)(int, int, int, int) | Freezes panes at the specified cell in the worksheet. |
| [GetAdvancedFilter](../../aspose.cells/worksheet/getadvancedfilter/)() | Gets the settings of advanced filter. |
| [GetAllPictures](../../aspose.cells/worksheet/getallpictures/)() | Gets all pictures includes images are embedded in the cell and over the cells. |
| [GetAreasOfXmlMapQuery](../../aspose.cells/worksheet/getareasofxmlmapquery/)(string, XmlMap) | Query cell areas that mapped/linked to the specific path of xml map. |
| [GetFreezedPanes](../../aspose.cells/worksheet/getfreezedpanes/)(out int, out int, out int, out int) | Gets the freeze panes. |
| [GetPanes](../../aspose.cells/worksheet/getpanes/)() | Gets the window panes. |
| [GetPrintingPageBreaks](../../aspose.cells/worksheet/getprintingpagebreaks/)(ImageOrPrintOptions) | Gets automatic page breaks. |
| [GetSelectedAreas](../../aspose.cells/worksheet/getselectedareas/)() | Gets selected ranges of cells in the designer spreadsheet. |
| [GetSelectedRanges](../../aspose.cells/worksheet/getselectedranges/)() | (**Obsolete.**) Gets selected ranges of cells in the designer spreadsheet. |
| [MoveTo](../../aspose.cells/worksheet/moveto/)(int) | Moves the sheet to another location in the spreadsheet. |
| [Protect](../../aspose.cells/worksheet/protect/#protect)(ProtectionType) | Protects worksheet. |
| [Protect](../../aspose.cells/worksheet/protect/#protect_1)(ProtectionType, string, string) | Protects worksheet. |
| [RefreshPivotTables](../../aspose.cells/worksheet/refreshpivottables/#refreshpivottables_1)() | Refreshes all the PivotTables in this Worksheet. |
| [RefreshPivotTables](../../aspose.cells/worksheet/refreshpivottables/#refreshpivottables)(PivotTableRefreshOption) | Refreshes all the PivotTables in this Worksheet. |
| [RemoveAllDrawingObjects](../../aspose.cells/worksheet/removealldrawingobjects/)() | Removes all drawing objects in this worksheet. |
| [RemoveAutoFilter](../../aspose.cells/worksheet/removeautofilter/)() | Removes the auto filter of the worksheet. |
| [RemoveSplit](../../aspose.cells/worksheet/removesplit/)() | Removes split window. |
| [Replace](../../aspose.cells/worksheet/replace/)(string, string) | Replaces all cells' text with a new string. |
| [SelectRange](../../aspose.cells/worksheet/selectrange/)(int, int, int, int, bool) | Selects a range. |
| [SetVisible](../../aspose.cells/worksheet/setvisible/)(bool, bool) | Sets the visible options. |
| [Split](../../aspose.cells/worksheet/split/)() | Splits window. |
| [StartAccessCache](../../aspose.cells/worksheet/startaccesscache/)(AccessCacheOptions) | Starts the session that uses caches to access the data in this worksheet. |
| override [ToString](../../aspose.cells/worksheet/tostring/)() | Returns a string represents the current Worksheet object. |
| [UnFreezePanes](../../aspose.cells/worksheet/unfreezepanes/)() | Unfreezes panes in the worksheet. |
| [Unprotect](../../aspose.cells/worksheet/unprotect/#unprotect)() | Unprotects worksheet. |
| [Unprotect](../../aspose.cells/worksheet/unprotect/#unprotect_1)(string) | Unprotects worksheet. |
| [XmlMapQuery](../../aspose.cells/worksheet/xmlmapquery/)(string, XmlMap) | (**Obsolete.**) Query cell areas that mapped/linked to the specific path of xml map. |

### Examples

```csharp
namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class WorksheetDemo
    {
        public static void WorksheetExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();

            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Set worksheet properties
            worksheet.Name = "DemoSheet";
            worksheet.IsGridlinesVisible = true;
            worksheet.IsRowColumnHeadersVisible = true;
            worksheet.DisplayZeros = true;
            worksheet.DisplayRightToLeft = false;
            worksheet.IsOutlineShown = true;
            worksheet.IsSelected = true;
            worksheet.FirstVisibleRow = 0;
            worksheet.FirstVisibleColumn = 0;
            worksheet.Zoom = 100;
            worksheet.ViewType = ViewType.PageLayoutView;
            worksheet.IsPageBreakPreview = false;
            worksheet.IsRulerVisible = true;
            worksheet.TabColor = System.Drawing.Color.Blue;
            worksheet.CodeName = "Sheet1";
            worksheet.ActiveCell = "A1";

            // Add a hyperlink in Cell A1
            worksheet.Hyperlinks.Add("A1", 1, 1, "http://www.aspose.com");

            // Freeze panes at "C3" with 3 row and 3 column
            worksheet.FreezePanes("C3", 3, 3);

            // Add a conditional formatting rule
            int index = worksheet.ConditionalFormattings.Add();
            FormatConditionCollection fcs = worksheet.ConditionalFormattings[index];
            CellArea ca = new CellArea { StartRow = 0, EndRow = 10, StartColumn = 0, EndColumn = 10 };
            fcs.AddArea(ca);

            int conditionIndex = fcs.AddCondition(FormatConditionType.AboveAverage);
            FormatCondition fc = fcs[conditionIndex];
            fc.Style.BackgroundColor = System.Drawing.Color.Yellow;

            // Setting properties for AboveAverage rule
            fc.AboveAverage.IsAboveAverage = true;
            fc.AboveAverage.IsEqualAverage = false;
            fc.AboveAverage.StdDev = 2;

            // Save the workbook
            workbook.Save("WorksheetExample.xlsx");

            return;
        }
    }
}
```

### See Also

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


