Click or drag to resize

Worksheet Properties

The Worksheet type exposes the following members.

Properties
Name Description
Public property ActivePane
Gets or sets index of the active pane.
(Inherited from XlsWorksheet .)
Public property ActiveSelectionRange
Get active selection range.
(Inherited from XlsWorksheet .)
Public property AllocatedRange
Returns a Range object that represents the used range on the specified worksheet. Read-only.
Public property AllocatedRangeIncludesFormatting
There are two different algorithms to create UsedRange object: 1) Default. This property = true. The cell is included into UsedRange when it has some record created for it even if data is empty (maybe some formatting changed, maybe not - cell was accessed and record was created). 2) This property = false. In this case XlsIO tries to remove empty rows and columns from all sides to make UsedRange smaller.
(Inherited from XlsWorksheet .)
Public property ArcShapes
Gets the collection of arc shapes in the worksheet.
(Inherited from XlsWorksheetBase .)
Public property AutoFilters
Returns autofilterscollection of worksheet. Read-only.
Public property ButtonShapes
Gets the collection of button shapes in the worksheet.
(Inherited from XlsWorksheetBase .)
Public property CellImages
Cell image array. Read-only.
Public property CellList
Returns all used cells in the worksheet. Read-only.
(Inherited from XlsWorksheet .)
Public property Cells
Returns all used cells in the worksheet. Read-only.
Public property Charts
Returns charts collection. Read-only.
Public property CheckBoxes
Returns inner checkboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property CodeName
Name used by macros to access workbook items.
(Inherited from XlsWorksheetBase .)
Public property Columns
Rrepresents all used columns on the specified worksheet. Read-only Range object.
Public property ComboBoxes
Returns collection with all comboboxes inside this worksheet. Read-only.
(Inherited from XlsWorksheetBase .)
Public property Code example Comments
Returns comments collection for this worksheet. Read-only.
Examples
The following code illustrates how to access the comments collection in the worksheet:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Adding comments to a cell.</para><para>ICommentShape comment1 = worksheet.Range["A1"].AddComment();</para><para>ICommentShape comment2 = worksheet.Range["B1"].AddComment();</para><para>//Set comment text</para><para>comment1.Text = "Comment1";</para><para>comment2.Text = "Comment2";</para><para>//Check count</para><para>Console.Write(worksheet.Comments.Count);</para><para>//Save to file</para><para>workbook.SaveToFile("Comments.xlsx");</para>
Public property ConditionalFormats
Returns collection with all conditional formats in the worksheet. Read-only.
(Inherited from XlsWorksheet .)
Public property Copying
Gets or sets a value indicating whether a copy operation is currently in progress.
(Inherited from XlsWorksheet .)
Public property CustomProperties
Returns collection with all custom properties in the worksheet. Read-only.
(Inherited from XlsWorksheet .)
Public property Code example DefaultColumnWidth
Returns or sets the defaultwidth of all the columns in the worksheet. Read/write Double.
Examples
The following code illustrates how to get the default column width:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get column width</para><para>Console.Write(worksheet.DefaultColumnWidth);</para><para>//Set default width</para><para>worksheet.DefaultColumnWidth = 40;</para><para>//Save to file</para><para>workbook.SaveToFile("DefaultColumnWidth.xlsx");</para>
(Inherited from XlsWorksheet .)
Public property DefaultGridlineColor
Indicates whether gridline color has default value.
(Inherited from XlsWorksheetBase .)
Public property DefaultPrintRowHeight
Return default row height.
(Inherited from XlsWorksheet .)
Public property Code example DefaultRowHeight
Gets or sets default height of all the rows in the worksheet, in points.Read/write Double.
Examples
The following code illustrates how to get the default row height:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get row height</para><para>Console.Write(worksheet.DefaultRowHeight);</para><para>//Set default height</para><para>worksheet.DefaultRowHeight = 40;</para><para>//Save to file</para><para>workbook.SaveToFile("DefaultRowHeight.xlsx");</para>
(Inherited from XlsWorksheet .)
Public property DisplayPageBreaks
True if page breaks (both automatic and manual) on the specified worksheet are displayed.
(Inherited from XlsWorksheet .)
Public property DVTable
Gets the data validation table associated with the current instance.
(Inherited from XlsWorksheet .)
Public property FirstColumn
Gets or sets index of the first column of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property FirstDataColumn
Gets index of the first data column of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property FirstDataRow
Gets index of the first data row of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property FirstRow
Gets / sets index of the first row of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property FirstVisibleColumn
Gets or sets the index of the first visible column in a worksheet.The value is 1-based.
(Inherited from XlsWorksheet .)
Public property FirstVisibleRow
Gets or sets the index of the first visible row in the worksheet. The value is 1-based.
(Inherited from XlsWorksheet .)
Public property FormulasVisible
Gets or sets a value indicating whether the formulas are visible in the worksheet.
(Inherited from XlsWorksheet .)
Public property Code example GridLineColor
Grid line color.
Examples
The following code illustrates how to set the grid line color:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set grid lines color</para><para>worksheet.GridLineColor = ExcelColors.Red;</para><para>//Save to file</para><para>workbook.SaveToFile("GridLineColor.xlsx");</para>
(Inherited from XlsWorksheetBase .)
Public property Code example GridLinesVisible
True if gridlines are visible; False otherwise.
Examples
The following code illustrates how to set visibility for grid lines:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set grid line visibility</para><para>worksheet.GridLinesVisible = false;</para><para>//Save to file</para><para>workbook.SaveToFile("GridLinesVisible.xlsx");</para>
(Inherited from XlsWorksheet .)
Public property GroupBoxes
Gets the group boxes in the worksheet.
(Inherited from XlsWorksheetBase .)
Public property GroupShapeCollection
Get group shapes in worksheet.
(Inherited from XlsWorksheetBase .)
Public property HasMergedCells
Indicates whether worksheet has merged cells.
(Inherited from XlsWorksheet .)
Public property Code example HasOleObjects
Indicats whether there is OLE object.
Examples
The following code illustrates how to access the IListObjects collection in the worksheet to add a new IOleObject and check Ole Object:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create image stream</para><para>System.Drawing.Image image = System.Drawing.Image.FromFile("image.png");</para><para>//Add ole object</para><para>IOleObject oleObject = worksheet.OleObjects.Add("Shapes.xlsx", image, OleLinkType.Embed);</para><para>//Check HasOleObject.Output will be true.</para>
 Console.Write(worksheet.HasOleObjects);

 <para>//Save to file</para><para>workbook.SaveToFile("HasOleObjects.xlsx");</para>
(Inherited from XlsWorksheet .)
Public property HasPictures
Indicates whether tabsheet contains any picture. Read-only.
(Inherited from XlsWorksheetBase .)
Public property HasVmlShapes
Indicates whether worksheet has vml shapes. Read-only.
(Inherited from XlsWorksheetBase .)
Public property HeaderFooterShapes
Header / footer shapes collection.
(Inherited from XlsWorksheetBase .)
Public property HorizontalSplit
Gets or sets the number of rows from the top of the worksheet that are frozen in a horizontal split.
(Inherited from XlsWorksheet .)
Public property HPageBreaks
Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet.
Public property HyperLinks
Collection of all worksheet's hyperlinks.
Public property Index
Returns the index number of the object within the collection of objects.
(Inherited from XlsWorksheetBase .)
Protected property InnerHyperLinks
Collection of all hyperlinks in the current worksheet.
(Inherited from XlsWorksheet .)
Public property IsDisplayZeros
Indicates whether zero values to be displayed
(Inherited from XlsWorksheet .)
Public property IsEmpty
Indicates whether worksheet is empty. Read-only.
(Inherited from XlsWorksheet .)
Public property IsFreezePanes
Indicates whether freezed panes are applied.
(Inherited from XlsWorksheet .)
Public property IsPasswordProtected
True if the worksheet has been protected with password.
(Inherited from XlsWorksheetBase .)
Public property IsRightToLeft
Indicates whether worksheet is displayed right to left.
(Inherited from XlsWorksheetBase .)
Public property IsRowColHeadersVisible
Gets or sets whether the worksheet will display row and column headers. Default is true.
(Inherited from XlsWorksheetBase .)
Public property IsSelected
Indicates whether tab of this sheet is selected. Read-only.
(Inherited from XlsWorksheetBase .)
Public property IsStringsPreserved
Indicates if all values in the workbook are preserved as strings.
(Inherited from XlsWorksheet .)
Public property IsTransitionEvaluation
Gets or sets a value indicating whether transition evaluation is enabled.
(Inherited from XlsWorksheetBase .)
Public property Item String
Get cell range.
Public property Item Int32, Int32
Get cell range.
Public property Item Int32, Int32, Int32, Int32
Get cell range.
Public property LabelShapes
Gets the collection of label shapes in the worksheet.
(Inherited from XlsWorksheetBase .)
Public property LastColumn
Gets or sets index of the last column of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property LastDataColumn
Gets index of the last data column of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property LastDataRow
Gets index of the last data row of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property LastRow
Gets or sets one-based index of the last row of the worksheet.
(Inherited from XlsWorksheetBase .)
Public property Code example LeftVisibleColumn
Gets/sets left visible column of the worksheet.
Examples
The following code illustrates how to set the left visible column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set left visible column</para><para>worksheet.LeftVisibleColumn = 3;</para><para>//Get left visible column</para><para>Console.Write(worksheet.LeftVisibleColumn);</para><para>//Save to file</para><para>workbook.SaveToFile("LeftVisibleColumn.xlsx");</para>
(Inherited from XlsWorksheetBase .)
Public property Lines
Gets the lines of the chart.
(Inherited from XlsWorksheetBase .)
Public property ListBoxes
Gets the list of list boxes in the workbook.
(Inherited from XlsWorksheetBase .)
Public property ListObjects
Returns all list objects in the worksheet.
(Inherited from XlsWorksheet .)
Public property MaxDisplayRange
Read-only. Returns a Range object that represents Maximum Display Range
(Inherited from XlsWorksheet .)
Public property Code example MergedCells
Returns all merged ranges. Read-only.
Examples
The following code illustrates how to get the merged ranges:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Merge cells</para><para>worksheet["C2:D2"].Merge();</para><para>worksheet["F3:G3"].Merge();</para><para>//Get merged ranges</para><para>IXLSRange[] mergedRanges = worksheet.MergedCells;</para><para>//Get merged range count . Output will be 2</para><para>Console.Write(mergedRanges.Length);</para><para>//Save to file</para><para>workbook.SaveToFile("MergedCells.xlsx");</para>
Public property Name
Returns or sets the name of the object. Read / write String.
(Inherited from XlsWorksheetBase .)
Public property Names
Name range used by macros to access to workbook items.
(Inherited from XlsWorksheet .)
Public property Code example OleObjects
Gets the OLE objects.
Examples
The following code illustrates how to access the IListObjects collection in the worksheet to add a new IOleObject:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create image stream</para><para>System.Drawing.Image image = System.Drawing.Image.FromFile("image.png");</para><para>//Add ole object</para><para>IOleObject oleObject = worksheet.OleObjects.Add("Shapes.xlsx", image, OleLinkType.Embed);</para><para>//Save to file</para><para>workbook.SaveToFile("OLEObjects.xlsx");</para>
(Inherited from XlsWorksheet .)
Public property OvalShapes
Gets the oval shapes in the worksheet.
(Inherited from XlsWorksheetBase .)
Public property PageSetup
Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.
Public property Parent
Reference to Parent object. Read-only.
(Inherited from XlsObject .)
Public property ParentWorkbook
Gets the parent workbook of the current worksheet,this method equals Workbook.
Public property Pictures
Pictures collection. Read-only.
Public property PivotTables
Returns charts collection. Read-only.
(Inherited from XlsWorksheet .)
Public property PrintRange
Print area of worksheet.
Public property ProtectContents
Indicates whether current sheet is protected.
(Inherited from XlsWorksheet .)
Public property ProtectDrawingObjects
True if objects are protected. Read only.
(Inherited from XlsWorksheetBase .)
Public property Protection
Gets protected options. Read-only. For sets protection options use "Protect" method.
(Inherited from XlsWorksheetBase .)
Public property ProtectScenarios
True if the scenarios of the current sheet are protected. Read only.
(Inherited from XlsWorksheetBase .)
Public property PrstGeomShapes
Gets the collection of preset geometric shapes.
(Inherited from XlsWorksheetBase .)
Public property QueryTables
Gets the collection of query tables associated with the worksheet.
Public property QuotedName
Returns quoted name of the worksheet.
(Inherited from XlsWorksheet .)
Public property RadioButtons
Returns inner radiobutton collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property Code example Range
Returns a Range object that represents the used range on the specified worksheet. Read-only.
Examples
The following code illustrates how to get used range on the specified worksheet:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["B2"].Text = "Text";</para><para>//Set Color</para><para>worksheet["J3"].Style.Color = Color.Red;</para><para>//Get used range . Output will be B2:J3</para><para>Console.Write(worksheet.Range.RangeAddressLocal);</para><para>//Save to file</para><para>workbook.SaveToFile("UsedRange.xlsx");</para>
Public property RealIndex
Index of the worksheet in the workbook (not necessary in Worksheets collection)
(Inherited from XlsWorksheetBase .)
Public property RectangleShapes
Gets the rectangle shapes in the worksheet.
(Inherited from XlsWorksheetBase .)
Protected property ReferenceCount
Get quantity of instance references.
(Inherited from XlsObject .)
Public property RowColumnHeadersVisible
True if row and column headers are visible. False otherwise.
(Inherited from XlsWorksheet .)
Public property Rows
Represents all the rows on the specified worksheet. Read-only Range object.
Public property ScrollBarShapes
Gets the scroll bar shapes associated with the worksheet.
(Inherited from XlsWorksheetBase .)
Public property SelectionCount
Gets array with selection count. Read-only.
(Inherited from XlsWorksheet .)
Public property Shapes
Shapes collection.
(Inherited from XlsWorksheetBase .)
Public property SheetId
Gets or sets sheetId for this sheet.
(Inherited from XlsWorksheetBase .)
Public property Slicers
Returns slicer collection. Read-only.
(Inherited from XlsWorksheet .)
Public property SparklineGroups
Gets the sparkline groups.
(Inherited from XlsWorksheet .)
Public property SpinnerShapes
Gets the spinner shapes in the worksheet.
(Inherited from XlsWorksheetBase .)
Public property StandardHeightFlag
Gets or sets the standard (default) height option flag, which defines that standard (default) row height and book default font height do not match. Bool.
(Inherited from XlsWorksheet .)
Public property TabColor
Tab color.
(Inherited from XlsWorksheetBase .)
Public property TabColorObject
Tab color.
(Inherited from XlsWorksheetBase .)
Public property TabKnownColor
Tab excel color.
(Inherited from XlsWorksheetBase .)
Public property TextBoxes
Returns inner textboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TopLeftCell
Gets top left cell of the worksheet.
(Inherited from XlsWorksheet .)
Public property Code example TopVisibleRow
Gets/sets top visible row of the worksheet.
Examples
The following code illustrates how to set the top visible row:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set top visible row</para><para>worksheet.TopVisibleRow = 5;</para><para>//Get top visible row</para><para>Console.Write(worksheet.TopVisibleRow);</para><para>//Save to file</para><para>workbook.SaveToFile("TopVisibleRow.xlsx");</para>
(Inherited from XlsWorksheetBase .)
Public property Type
Returns or sets the worksheet type.
(Inherited from XlsWorksheet .)
Public property TypedArcs
Returns inner Arcs collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedButtons
Returns inner buttons collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedCheckBoxes
Returns inner checkboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedComboBoxes
Returns inner comboboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedGroupBoxes
Returns inner gourpboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedLabels
Returns inner labels collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedLines
Returns inner lines collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedListBoxes
Returns inner listboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedOvals
Returns inner ovals collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedPictures
Returns inner pictures collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedRadioButtons
Returns inner radiobutton collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedRects
Returns inner rects collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedScollBars
Returns inner scollbars collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedSpinners
Returns inner spinners collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property TypedTextBoxes
Returns inner textboxes collection. Read-only.
(Inherited from XlsWorksheetBase .)
Public property UnknownVmlShapes
Indicates whether worksheet contains some unknown vml shapes.
(Inherited from XlsWorksheetBase .)
Public property UseRangesCache
Indicates whether all created range objects should be cached. Default value is true.
(Inherited from XlsWorksheet .)
Public property Version
Gets or sets excel file version.
(Inherited from XlsWorksheet .)
Public property VerticalSplit
Gets or sets the number of columns to freeze for vertical splitting in the worksheet.
(Inherited from XlsWorksheet .)
Public property ViewMode
Gets or sets the view mode of the sheet.
(Inherited from XlsWorksheet .)
Public property Visibility
Controls end user visibility of worksheet.
(Inherited from XlsWorksheetBase .)
Public property VmlShapesCount
Returns number of known vml shapes. Read-only.
(Inherited from XlsWorksheetBase .)
Public property VPageBreaks
Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.
Public property Workbook
Gets the workbook associated with the current object, retrieving it from the parent workbook's inner workbook property,this method equals ParentWorkbook.
Public property Code example Zoom
Zoom factor of document.
Examples
The following code illustrates how to set zoom level of the sheet:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set zoom</para><para>worksheet.Zoom = 200;</para><para>//Save to file</para><para>workbook.SaveToFile("Zoom.xlsx");</para>
(Inherited from XlsWorksheet .)
Public property ZoomScaleNormal
Gets or sets the zoom scale of normal view of the sheet.
(Inherited from XlsWorksheet .)
Public property ZoomScalePageBreakView
Gets or sets the zoom scale of page break preview of the sheet.
(Inherited from XlsWorksheet .)
Public property ZoomScalePageLayoutView
Gets or sets the zoom scale of page layout view of the sheet.
(Inherited from XlsWorksheet .)
Top
See Also