Click or drag to resize

Worksheet Class

Represents a worksheet. The Worksheet object is a member of the Worksheets collection. The Worksheets collection contains all the Worksheet objects in a workbook.
Inheritance Hierarchy

Namespace: Spire.Xls
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public class Worksheet : XlsWorksheet

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
Methods
Name Description
Protected method AccessColumn
Updates FirstColumn and LastColumn indexes.
(Inherited from XlsWorksheet .)
Protected method AccessRow
Updates FirstRow and LastRow indexes.
(Inherited from XlsWorksheet .)
Public method Activate
Makes the current sheet the active sheet. Equivalent to clicking the sheet's tab in MS Excel.
(Inherited from XlsWorksheetBase .)
Public method AddAllowEditRange(String, CellRange)
AddAllowEditRange : add a range of cells that allow editing
(Inherited from XlsWorksheet .)
Public method AddAllowEditRange(String, CellRange, String)
AddAllowEditRange : add a range of cells that allow editing
(Inherited from XlsWorksheet .)
Protected method AddReference
Increase the quantity of reference. User must use this method when new wrapper on object is created or reference on object stored.
(Inherited from XlsObject .)
Public method AddTextEffectShape
Adds a text effect shape to the worksheet.
(Inherited from XlsWorksheetBase .)
Public method ApplyStyle(CellStyle)
Apply style to whole sheet.
Public method ApplyStyle(CellStyle, Boolean, Boolean)
Apply style to whole sheet.
(Inherited from XlsWorksheet .)
Public method Code example AutoFitColumn(Int32)
Autofit the column width.
Examples
The following code illustrates how to Auto-fit the column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Sample text in cell";</para><para>//Set auto fit</para><para>worksheet.AutoFitColumn(1);</para><para>//Save to file</para><para>workbook.SaveToFile("AutoFitColumn.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method AutoFitColumn(Int32, AutoFitterOptions)
Autofit the column width.
(Inherited from XlsWorksheet .)
Public method AutoFitColumn(Int32, Int32, Int32)
Autofit the column width.
(Inherited from XlsWorksheet .)
Public method AutoFitColumn(Int32, Int32, Int32, AutoFitterOptions)
Autofit the column width.
(Inherited from XlsWorksheet .)
Public method Code example AutoFitRow(Int32)
Autofit the row height.
Examples
The following code illustrates how to Auto-fit the row:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Value = "Sample text";</para><para>//Set Style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>IFont font = style.Font;</para><para>font.Size = 18;</para><para>worksheet["C2"].Style = style;</para><para>//Set auto fit</para><para>worksheet.AutoFitRow(2);</para><para>//Save to file</para><para>workbook.SaveToFile("AutoFitRow.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method AutoFitRow(Int32, Int32, Int32, AutoFitterOptions)
Autofit the row height.
(Inherited from XlsWorksheet .)
Public method AutoFitRow(Int32, Int32, Int32, Boolean)
Autofit the row height.
(Inherited from XlsWorksheet .)
Public method AutoFitRow(Int32, Int32, Int32, Boolean, AutoFitterOptions)
Autofit the row height.
(Inherited from XlsWorksheet .)
Public method CalculateAllValue
Caculate all formula for the specified worksheet
(Inherited from XlsWorksheet .)
Public method CalculateAndGetRowHeight
Calculates and returns the height of a specific row in a worksheet.
Protected method CheckDisposed
Checks whether object was disposed and throws exception if it was.
(Inherited from XlsObject .)
Public method Code example CheckExistence
Indicates whether cell has been initialized.
Examples
The following code illustrates if the cells was initialized or accessed by the user:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet.Range["A1"].Text = "Hello";</para><para>//Check the cell.Output will be true.</para><para>Console.Write(worksheet.CheckExistence(1, 1));</para><para>//Save to file</para><para>workbook.SaveToFile("CheckExistence.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method CheckProtectionPassword
Checks if the provided password matches the protection password of the worksheet.
Public method Clear
Clears data the worksheet.
(Inherited from XlsWorksheet .)
Public method ClearCellImageCache
Clear Cell image array cache,not delete CellImage in cell.
(Inherited from XlsWorksheetBase .)
Public method ClearData
Clears contents of a range.
(Inherited from XlsWorksheet .)
Public method Clone Obsolete.
Creates copy of the current object.
(Inherited from XlsWorksheetBase .)
Public method ColumnWidthToPixels
Converts column width into pixels.
(Inherited from XlsWorksheet .)
Public method Copy(CellRange, CellRange)
Copys data from a source range to a destination range.
Public method Copy(CellRange, CellRange, CopyRangeOptions)
Copys data from a source range to a destination range.
Public method Copy(CellRange, CellRange, Boolean)
Copys data from a source range to a destination range.
Public method Copy(CellRange, Worksheet, Int32, Int32)
Copy data from source range to destination worksheet.
Public method Copy(CellRange, CellRange, Boolean, Boolean, Boolean)
Copys data from a source range to a destination range.
Public method Copy(CellRange, Worksheet, Int32, Int32, Boolean)
Copy data from source range to destination worksheet.
Public method Copy(CellRange, CellRange, Boolean, Boolean, Boolean, Boolean)
Copys data from a source range to a destination range.
Public method Copy(CellRange, Worksheet, Int32, Int32, Boolean, Boolean)
Copy data from source range to destination worksheet.
Public method CopyColumn
Copys data from a source column to a destination column.
Public method CopyFrom(Worksheet)
Copy data from specified worksheet.
Public method CopyFrom(XlsWorksheet, Dictionary String, String , Dictionary String, String , Dictionary Int32, Int32 , WorksheetCopyType, Dictionary Int32, Int32 , Dictionary Int32, Int32 , Dictionary Int32, Int32 ) Obsolete.
Copies all data from another worksheet.
(Inherited from XlsWorksheet .)
Public method CopyRow
Copys data from a source row to a destination row.
Public method CopyToClipboard Obsolete.
Copies worksheet into the clipboard.
(Inherited from XlsWorksheet .)
Public method CreateNamedRanges
Create Named Ranges
(Inherited from XlsWorksheet .)
Public method CreateRanges
Creates a collection of ranges from the specified array of CellRange objects.
(Inherited from XlsWorksheet .)
Public method DeleteColumn(Int32)
Deletes a column.
(Inherited from XlsWorksheet .)
Public method DeleteColumn(Int32, Int32)
Removes specified column.
(Inherited from XlsWorksheet .)
Public method DeleteRange
delete a range in worksheet
(Inherited from XlsWorksheet .)
Public method DeleteRow(Int32)
Delete a row.
(Inherited from XlsWorksheet .)
Public method DeleteRow(Int32, Int32)
Removes specified row.
(Inherited from XlsWorksheet .)
Public method DeleteRows
Removes specified rows.
(Inherited from XlsWorksheet .)
Public method Dispose
Dispose object and free resources.
(Inherited from XlsObject .)
Public method Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object .)
Public method ExportDataTable
Exports worksheet data into a DataTable
(Inherited from XlsWorksheet .)
Public method ExportDataTable(CellRange, ExportTableOptions)
Exports the data from the specified cell range to a DataTable.
Public method ExportDataTable(CellRange, Boolean)
Exports worksheet data into a DataTable.
Public method ExportDataTable(CellRange, Boolean, Boolean)
Exports worksheet data into a DataTable.
Public method ExportDataTable(Int32, Int32, Int32, Int32, ExportTableOptions)
Exports a portion of a DataTable starting from a specified cell and spanning a specified number of rows and columns.
Public method ExportDataTable(Int32, Int32, Int32, Int32, Boolean)
Exports worksheet data into a DataTable
Protected method Finalize
Destructor. Call dispose method of current object.
(Inherited from XlsObject .)
Public method FindAll
Finds the all cells with specified string value.
Public method FindAllBool
Finds the cell with the input bool.
Public method FindAllDateTime
Finds the cell with the input date time.
Public method FindAllNumber
Finds the cell with the input number.
Public method FindAllString(String, Boolean, Boolean)
Finds the cell with the input string.
Public method FindAllString(String, Boolean, Boolean, Boolean)
Finds the cell with the input string.
Public method FindAllTimeSpan
Finds the cell with the input time span.
Public method FindBool
Finds the cell with the input bool.
Public method FindDateTime
Finds the cell with the input date time.
Public method FindNumber
Finds the cell with the input double.
Protected method FindParent(Type)
This method is used to find parent with specific type.
(Inherited from XlsObject .)
Protected method FindParent( Type )
Find parent of object.
(Inherited from XlsObject .)
Protected method FindParent(Type, Boolean)
This method is used to find parent with specific type.
(Inherited from XlsObject .)
Protected method FindParents
Finds parent objects.
(Inherited from XlsObject .)
Public method FindString
Finds the cell with the input string.
Public method FindTimeSpan
Finds the cell with the input time span.
Protected method FreeRange
Clears the specified range of cells in the worksheet.
(Inherited from XlsWorksheet .)
Public method FreezePanes
Freezes panes at the specified cell in the worksheet.
Public method GetBoolean
Gets bool value from cell.
(Inherited from XlsWorksheet .)
Public method GetCaculateValue Obsolete.
Returns the formula string if the cell contains a formula, or the value if the cell cantains anything other than a formula.
(Inherited from XlsWorksheet .)
Public method GetCalculateValue
Returns the formula string if the cell contains a formula, or the value if the cell cantains anything other than a formula.
(Inherited from XlsWorksheet .)
Public method GetCellType
Gets cell type from current column.
(Inherited from XlsWorksheet .)
Public method GetClonedObject
Gets object that is clone of current worksheet in the specified workbook.
(Inherited from XlsWorksheet .)
Public method GetColumnIsAutoFit
Get ColumnIsAutofit By columnIndex
(Inherited from XlsWorksheet .)
Public method GetColumnIsHide
Indicates whether the column is hidden.
(Inherited from XlsWorksheet .)
Public method GetColumnWidth
Gets the width of the specified column
(Inherited from XlsWorksheet .)
Public method Code example GetColumnWidthPixels
Gets the width of the specified column, in units of pixel.
Examples
The following code illustrates how to get the column width for a particular column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Sample text in cell";</para><para>//Set auto fit</para><para>worksheet.AutoFitColumn(1);</para><para>//Get column width</para><para>Console.WriteLine(worksheet.GetColumnWidthPixels(1));</para><para>//Save to file</para><para>workbook.SaveToFile("UsedRange.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example GetDefaultColumnStyle
Returns default column style.
Examples
The following code illustrates how to get default column style:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set Color</para><para>style.Color = Color.Red;</para><para>//Set default style</para><para>worksheet.SetDefaultColumnStyle(2,style);</para><para>//Get default style</para><para>CellStyle defaultStyle = worksheet.GetDefaultColumnStyle(2);</para><para>//Set color</para><para>defaultStyle.Color = Color.Blue;</para><para>worksheet.SetDefaultColumnStyle(3, defaultStyle);</para><para>//Save to file</para><para>workbook.SaveToFile("GetDefaultColumnStyle.xlsx");</para>
Public method Code example GetDefaultRowStyle
Returns default row style.
Examples
The following code illustrates how to get default row style:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set Color</para><para>style.Color = Color.Red;</para><para>//Set default style</para><para>worksheet.SetDefaultRowStyle(2,style);</para><para>//Get default style</para><para>CellStyle defaultStyle = worksheet.GetDefaultRowStyle(2);</para><para>//Set color</para><para>defaultStyle.Color = Color.Blue;</para><para>worksheet.SetDefaultRowStyle(3, defaultStyle);</para><para>//Save to file</para><para>workbook.SaveToFile("GetDefaultColumnStyle.xlsx");</para>
Public method GetError
Gets error value from cell.
(Inherited from XlsWorksheet .)
Public method GetFormula(Int32, Int32, Boolean)
Returns formula corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetFormula(Int32, Int32, Boolean, Boolean)
Returns formula corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetFormulaBoolValue
Gets formula bool value from cell.
(Inherited from XlsWorksheet .)
Public method GetFormulaErrorValue
Gets formula error value from cell.
(Inherited from XlsWorksheet .)
Public method GetFormulaNumberValue
Returns formula number value corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetFormulaStringValue
Returns formula string value corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetFreezePanes
Get Freezes panes cell's index in the worksheet.
Public method GetHashCode
Serves as the default hash function.
(Inherited from Object .)
Public method GetIntersectRanges
Intersects two ranges.
Public method GetNumber
Returns number value corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetRowHeight
Gets the height of a specified row.
(Inherited from XlsWorksheet .)
Public method Code example GetRowHeightPixels
Gets the height of a specified row in unit of pixel.
Examples
The following code illustrates how to get the row height for a particular row:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample text";</para><para>worksheet["C2"].Style.Font.Size = 18;</para><para>//Set auto fit</para><para>worksheet.AutoFitRow(2);</para><para>//Get row height</para><para>Console.WriteLine(worksheet.GetRowHeightPixels(2));</para><para>//Save to file</para><para>workbook.SaveToFile("UsedRange.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method GetRowIsAutoFit
Get GetRowIsAutoFit By rowIndex
(Inherited from XlsWorksheet .)
Public method GetRowIsHide
Indicates whether the row is hidden.
(Inherited from XlsWorksheet .)
Public method GetStringValue(Int64) Obsolete.
Returns string value corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetStringValue(Int32, Int32)
Returns string value corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetText
Returns string value corresponding to the cell.
(Inherited from XlsWorksheet .)
Public method GetTextObject(Int64) Obsolete.
Returns TextWithFormat object corresponding to the specified cell.
(Inherited from XlsWorksheet .)
Public method GetTextObject(Int32, Int32)
Returns TextWithFormat object corresponding to the specified cell.
(Inherited from XlsWorksheet .)
Public method GetType
Gets the Type of the current instance.
(Inherited from Object .)
Public method GroupByColumns
Groups columns.
(Inherited from XlsWorksheet .)
Public method GroupByRows
Groups rows.
(Inherited from XlsWorksheet .)
Public method HasArrayFormula Obsolete.
Indicates whether cell contains array-entered formula.
(Inherited from XlsWorksheet .)
Public method HasArrayFormulaRecord
Indicates is has array formula.
(Inherited from XlsWorksheet .)
Public method HideColumn
Hides a column.
(Inherited from XlsWorksheet .)
Public method HideColumns
Hides columns.
(Inherited from XlsWorksheet .)
Public method HideRow
Hides a row.
(Inherited from XlsWorksheet .)
Public method HideRows
Hides a row.
(Inherited from XlsWorksheet .)
Public method ImportCustomObjects(ICollection, Int32, Int32, ImportObjectOptions)
Imports custom objects into the worksheet.
(Inherited from XlsWorksheet .)
Public method ImportCustomObjects(ICollection, String , Boolean, Int32, Int32, Int32, Boolean, String, Boolean)
Imports custom objects into a worksheet.
(Inherited from XlsWorksheet .)
Protected method InitializeCollections
Initializes various collections and objects used by the spreadsheet.
(Inherited from XlsWorksheet .)
Public method Code example InsertArray( Object , Int32, Int32)
Imports an array of objects into a worksheet.
Examples
The following code illustrates how to Imports a two-dimensional array of Object into a worksheet with the specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Initialize the Object Array</para><para>object[,] arrayTwoDimen = new object[3, 2] { { "AND", "OR" }, { "NAND", "XOR" },{ "NOR", "NOT" } };</para><para>//Insert the Object Array to Sheet</para><para>worksheet.InsertArray(arrayTwoDimen, 1, 1);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertArray.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertArray( DateTime , Int32, Int32, Boolean)
Imports an array of datetimes into worksheet.
Examples
The following code illustrates how to Imports an array of DateTime values into a worksheet with the specified row and colum:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Initialize the DateTime Array</para><para>DateTime[] arrayDate = new DateTime[4] { DateTime.Parse("06:45"), DateTime.Parse("08:30"), DateTime.Parse("09:40"), DateTime.Parse("10:30") };</para><para>//Insert the DateTime Array to Sheet</para><para>worksheet.InsertArray(arrayDate, 1, 1, true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertArray.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertArray( Double , Int32, Int32, Boolean)
Imports an array of doubles into a worksheet.
Examples
The following code illustrates how to Imports an array of Double values into a worksheet with the specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Initialize the double Array</para><para>double[] arrayDouble = new double[4] { 344.0045, 345.0045, 346.0045, 347.0045 };</para><para>//Insert the double Array to Sheet</para><para>worksheet.InsertArray(arrayDouble, 1, 1, true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertArray.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertArray( Int32 , Int32, Int32, Boolean)
Imports an array of integer into a worksheet.
Examples
The following code illustrates how to Imports an array of integer values into a worksheet with the specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Initialize the integer Array</para><para>int[] arrayInt = new int[4] {1000, 2000, 3000, 4000};</para><para>//Insert the integer Array to Sheet</para><para>worksheet.InsertArray(arrayInt, 1, 1, true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertArray.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method InsertArray( Object , Int32, Int32, Boolean)
Imports an array of objects into a worksheet.
(Inherited from XlsWorksheet .)
Public method Code example InsertArray( Object , Int32, Int32, Boolean)
Imports an array of objects into a worksheet.
Examples
The following code illustrates how to Imports an array of Object into a worksheet with specified alignment:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Initialize the Object Array</para><para>object[] array = new object[4] { "Total Income", "Actual Expense", "Expected Expenses", "Profit" };</para><para>//Insert the Object Array to Sheet</para><para>worksheet.InsertArray(array, 1, 1, true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertArray.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertArray( String , Int32, Int32, Boolean)
Imports an array of strings into a worksheet.
Examples
The following code illustrates how to Imports an array of String into a worksheet with specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Initialize the string Array</para><para>string[] arrayString = new string[4] { "Total Income", "Actual Expense", "Expected Expenses", "Profit" };</para><para>//Insert the string Array to Sheet</para><para>worksheet.InsertArray(arrayString, 1, 1, true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertArray.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method InsertArray T ( T , Int32, Int32, Boolean, Boolean)
Inserts an array of objects into a worksheet.
(Inherited from XlsWorksheet .)
Public method InsertArrayList(ArrayList, Int32, Int32, Boolean)
Imports an arraylist of data into a worksheet.
(Inherited from XlsWorksheet .)
Public method InsertArrayList(ArrayList, Int32, Int32, Boolean, Boolean)
Imports an arraylist of data into a worksheet.
(Inherited from XlsWorksheet .)
Public method InsertColumn(Int32)
Inserts a new column into the worksheet.
(Inherited from XlsWorksheet .)
Public method InsertColumn(Int32, Int32)
Inserts specified number column into the worksheet.
(Inherited from XlsWorksheet .)
Public method InsertColumn(Int32, Int32, InsertOptionsType)
Inserts an empty column with default formatting.
(Inherited from XlsWorksheet .)
Public method InsertCutRange
Insert cut range into worksheet at specified position.
(Inherited from XlsWorksheet .)
Public method Code example InsertDataColumn
Imports data column.
Examples
The following code illustrates how to Imports data from a DataColumn into a worksheet with the specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Insert the DataColumn to worksheet</para><para>System.Data.DataColumn column = table.Columns[2];</para><para>worksheet.InsertDataColumn(column, true, 1, 1);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataColumn.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method InsertDataColumns
Imports array of data columns.
(Inherited from XlsWorksheet .)
Public method Code example InsertDataTable(DataTable, Boolean, Int32, Int32)
Imports data from a DataTable into worksheet.
Examples
The following code illustrates how to Imports data from a DataTable into a worksheet with the specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Insert the DataTable to worksheet</para><para>worksheet.InsertDataTable(table, true, 1, 1);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataTable.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertDataTable(DataTable, Boolean, Int32, Int32, Boolean)
Imports data from a DataTable into worksheet.
Examples
The following code illustrates how to Imports data from a DataTable into a worksheet with the specified row and column along with the preserve type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Insert the DataTable to worksheet</para><para>worksheet.InsertDataTable(table, true, 1, 1 , true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataTable.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32)
Imports data from a DataTable into worksheet.
Examples
The following code illustrates how to Imports data from a DataTable into a worksheet with the specified range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Insert the DataTable to worksheet</para><para>worksheet.InsertDataTable(table, true, 1 , 1 , 2 , 2);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataTable.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32, Boolean)
Imports data from a DataTable into worksheet.
Examples
The following code illustrates how to Imports data from a DataTable into a worksheet with specified range along with preserve type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Insert the DataTable to worksheet</para><para>worksheet.InsertDataTable(table, true, 1 , 1 , 2 , 2 , true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataTable.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method InsertDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32, DataColumn , Boolean)
Imports data from a DataTable into worksheet
(Inherited from XlsWorksheet .)
Public method Code example InsertDataView(DataView, Boolean, Int32, Int32)
Imports data from a DataView into worksheet.
Examples
The following code illustrates how to Imports data from a DataView into a worksheet with the specified row and column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Initialize dataview of datatable</para><para>System.Data.DataView view = table.DefaultView;</para><para>//Import data from DataView</para><para>worksheet.InsertDataView(view, true, 1, 1);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataView.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertDataView(DataView, Boolean, Int32, Int32, Boolean)
Imports data from a DataView into worksheet.
Examples
The following code illustrates how to Imports data from a DataView into a worksheet with the specified row and column along with preserve type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Initialize dataview of datatable</para><para>System.Data.DataView view = table.DefaultView;</para><para>//Import data from DataView</para><para>worksheet.InsertDataView(view, true, 1, 1 , true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataView.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertDataView(DataView, Boolean, Int32, Int32, Int32, Int32)
Imports data from a DataView into worksheet.
Examples
The following code illustrates how to Imports data from a DataView into a worksheet with the specified range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Initialize dataview of datatable</para><para>System.Data.DataView view = table.DefaultView;</para><para>//Import data from DataView</para><para>worksheet.InsertDataView(view, true, 1, 1 , 2 , 2);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataView.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example InsertDataView(DataView, Boolean, Int32, Int32, Int32, Int32, Boolean)
Imports data from a DataView into worksheet.
Examples
The following code illustrates how to Imports data from a DataView into a worksheet with the specified range along with preserve type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create a DataTable</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("ID", typeof(int));
 table.Columns.Add("Item", typeof(string));
 table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
 table.Rows.Add(2, "Paste", "Sam");
 table.Rows.Add(3, "Cream", "Christoff");</para><para>//Initialize dataview of datatable</para><para>System.Data.DataView view = table.DefaultView;</para><para>//Import data from DataView</para><para>worksheet.InsertDataView(view, true, 1, 1 , 2 , 2 , true);</para><para>//Save to file</para><para>workbook.SaveToFile(InsertDataView.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method InsertRange
Insert a cell range into worksheet
(Inherited from XlsWorksheet .)
Public method InsertRow(Int32)
Inserts a new row into the worksheet.
(Inherited from XlsWorksheet .)
Public method InsertRow(Int32, Int32)
Inserts multiple rows into the worksheet.
(Inherited from XlsWorksheet .)
Public method InsertRow(Int32, Int32, InsertOptionsType)
Inserts an empty row with default formatting.
(Inherited from XlsWorksheet .)
Protected method IntersectRanges
Intersects two ranges and returns the resulting range.
(Inherited from XlsWorksheet .)
Public method IsArrayFormula(Int64) Obsolete.
Indicates whether cell contains array-entered formula.
(Inherited from XlsWorksheet .)
Public method IsArrayFormula(Int32, Int32)
Indicates whether cell contains array-entered formula.
(Inherited from XlsWorksheet .)
Public method IsColumnVisible
Indicates whether column is visible.
(Inherited from XlsWorksheet .)
Public method IsExternalFormula
Indicates is formula in cell is formula to external workbook.
(Inherited from XlsWorksheet .)
Public method IsRowVisible
Indicates whether row is visible.
(Inherited from XlsWorksheet .)
Protected method MemberwiseClone
Creates a shallow copy of the current Object .
(Inherited from Object .)
Public method Merge
Combines a range of cells into a single cell.
Protected method MergeRanges
Merges two ranges if they have the same dimensions and are adjacent.
(Inherited from XlsWorksheet .)
Public method Move(CellRange, CellRange)
Move data from source range to destination range.
Public method Move(CellRange, CellRange, Boolean, Boolean)
Moves a range of cells from a source range to a destination range.
Public method MoveSheet
Moves sheet into new position, including chartsheet and worksheet.
(Inherited from XlsWorksheetBase .)
Public method MoveWorksheet
Moves worksheet into new position.
(Inherited from XlsWorksheet .)
Protected method OnDispose
Releases the unmanaged resources used by the object and optionally releases the managed resources.
(Overrides XlsObject OnDispose .)
Public method PixelsToColumnWidth
Converts pixels count into column width value.
(Inherited from XlsWorksheet .)
Public method Code example Protect(String)
Protects worksheet with password.protect the sheet except select lock/unlock cells.
Examples
The following code illustrates how to protect the sheet except select lock/unlock cells:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Protects the first worksheet's content with password</para><para>worksheet.Protect("123456");</para><para>//Save to file</para><para>workbook.SaveToFile("Protect.xlsx");</para>
(Inherited from XlsWorksheetBase .)
Public method Protect(String, SheetProtectionType)
Protects worksheet with password.
(Inherited from XlsWorksheetBase .)
Protected method ReleaseReference
Decrease quantity of Reference. User must call this method when freeing resources.
(Inherited from XlsObject .)
Public method Remove
Removes worksheet from parernt worksheets collection.
(Inherited from XlsWorksheet .)
Public method RemoveMergedCells(CellRange)
Remove merged cells from specified range.
Public method RemoveMergedCells(IXLSRange)
Removes all merged cells within the specified range.
(Inherited from XlsWorksheet .)
Public method RemovePanes
Removes panes from a worksheet.
(Inherited from XlsWorksheet .)
Public method RemovePicture(Int32)
Remove picture from this worksheet.
Public method RemovePicture(String)
Remove picture from this worksheet.
Public method RemovePicture(IPictureShape)
Remove picture from this worksheet.
Public method RemoveRange(CellRange)
Removes range from list.
Public method RemoveRange(Int32, Int32)
Removes range from list.
Public method ReparseFormula
Reparses all formulas on this sheet.
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, DateTime)
Replaces cells' values with new data.
Examples
The following code illustrates how to replace the string value with datetime:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by dateTime</para><para>string oldValue = "Find";</para><para>DateTime dateTime = DateTime.Now;</para><para>worksheet.Replace(oldValue, dateTime);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, Double)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string with double:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by double</para><para>string oldValue = "Ten";</para><para>worksheet.Replace(oldValue, 10.0);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, String)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string with another string:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by newValue</para><para>string oldValue = "Find";</para><para>string newValue = "NewValue";</para><para>worksheet.Replace(oldValue, newValue);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, DataColumn, Boolean)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string value with data column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by data column</para><para>string oldValue = "Find";</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("Dosage", typeof(int));</para><para>table.Rows.Add(1);</para><para>System.Data.DataColumn dataColumn = table.Columns[0];</para><para>worksheet.Replace(oldValue, dataColumn, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, DataTable, Boolean)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string value with data table:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by data table</para><para>string oldValue = "Find";</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("Dosage", typeof(int));</para><para>table.Rows.Add(1);</para><para>worksheet.Replace(oldValue, table, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, Double , Boolean)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string with array of double values:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by array of double values</para><para>string oldValue = "Find";</para><para>double[] newValues = { 1.0, 2.0 };</para><para>worksheet.Replace(oldValue, newValues, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, Int32 , Boolean)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string with array of int values:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by array of int values</para><para>string oldValue = "Find";</para><para>int[] newValues = { 1, 2 };</para><para>worksheet.Replace(oldValue, newValues, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method Code example Replace(String, String , Boolean)
Replaces cells' values with new data.
Examples
The following code snippet illustrates how to replace the string with array of string values:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Replace the oldValue by array of string values</para><para>string oldValue = "Find";</para><para>string[] newValues = { "X values", "Y values" };</para><para>worksheet.Replace(oldValue, newValues , true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method ReplaceAll(String, String, Boolean)
Replaces all occurrences of a specified value with a new value in the worksheet.
(Inherited from XlsWorksheet .)
Public method ReplaceAll(String, CellStyle, String, CellStyle)
Replaces cells' values with new data and style.
(Inherited from XlsWorksheet .)
Public method SaveAndGetShapesToImage
Save option specify shapes to image, and get option specify shapes together.
(Inherited from XlsWorksheet .)
Public method SaveShapesToImage
Save option specify shapes to image.
(Inherited from XlsWorksheet .)
Public method SaveToEMFImage Obsolete.
Converts range into EMF format image.
(Inherited from XlsWorksheet .)
Public method Code example SaveToFile(String, String)
Save worksheet to file.
Examples
The following code illustrates how to saves the worksheet in a different file with separator:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Save to file</para><para>worksheet.SaveToFile("SaveToFile.csv" , ",");</para>
(Inherited from XlsWorksheet .)
Public method SaveToFile(String, String, Boolean)
Save worksheet to file.
(Inherited from XlsWorksheet .)
Public method SaveToFile(String, String, Encoding)
Save worksheet to file..
(Inherited from XlsWorksheet .)
Public method SaveToFile(String, String, Encoding, Boolean)
Save worksheet to file..
(Inherited from XlsWorksheet .)
Public method Code example SaveToHtml(Stream)
Save to HTML stream.
Examples
The following code snippets illustrates how to save as html as stream:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Creat stream</para><para>Stream stream = new MemoryStream();</para><para>//Save to HTML stream</para><para>worksheet.SaveToHtml(stream);</para>
(Inherited from XlsWorksheet .)
Public method Code example SaveToHtml(String)
Save to HTML file.
Examples
The following code snippets illustrates how to save as html to the specified file name:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Save to HTML file</para><para>worksheet.SaveToHtml("Output.html");</para>
(Inherited from XlsWorksheet .)
Public method Code example SaveToHtml(Stream, HTMLOptions)
Saves work sheet to HTML.
Examples
The following code snippets illustrates how to save as html as stream with Save option:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Creat stream</para><para>Stream stream = new MemoryStream();</para><para>//Save to HTML stream</para><para>worksheet.SaveToHtml(stream, Spire.Xls.Core.Spreadsheet.HTMLOptions.Default);</para>
(Inherited from XlsWorksheet .)
Public method Code example SaveToHtml(String, HTMLOptions)
Saves as HTML.
Examples
The following code snippets illustrates how to save as html to the specified file name and save option:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Save to HTML file</para><para>worksheet.SaveToHtml("Sample.html" , Spire.Xls.Core.Spreadsheet.HTMLOptions.Default);</para>
(Inherited from XlsWorksheet .)
Public method SaveToImage(String)
Save worksheet to image.
(Inherited from XlsWorksheet .)
Public method SaveToImage(String, ImageFormat)
Save worksheet to image.
(Inherited from XlsWorksheet .)
Public method SaveToImage(Int32, Int32, Int32, Int32) Obsolete.
Save worksheet to image.
(Inherited from XlsWorksheet .)
Public method SaveToImage(String, Int32, Int32, Int32, Int32)
Save worksheet to image.
(Inherited from XlsWorksheet .)
Public method Code example SaveToImage(Stream, Int32, Int32, Int32, Int32, ImageType)
Save worksheet into image.
Examples
The following code illustrates how to convert the specified range into image with the specified type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Creat stream</para><para>Stream stream = new MemoryStream();</para><para>//Save to image</para><para>System.Drawing.Image image = worksheet.SaveToImage(stream,1, 1, 10, 20, Spire.Xls.ImageType.Bitmap);</para><para>image.Save("Sample.png", System.Drawing.Imaging.ImageFormat.Png);</para>
(Inherited from XlsWorksheet .)
Public method SaveToImage(Stream, Int32, Int32, Int32, Int32, EmfType) Obsolete.
Converts range into image.
(Inherited from XlsWorksheet .)
Public method SaveToImage(Stream, Int32, Int32, Int32, Int32, ImageType, EmfType) Obsolete.
Converts range into image.
(Inherited from XlsWorksheet .)
Public method SaveToPdf(String)
Save worksheet to pdf.
(Inherited from XlsWorksheet .)
Public method SaveToPdf(String, FileFormat) Obsolete.
Save worksheet to pdf.
(Inherited from XlsWorksheet .)
Public method SaveToPdfStream(Stream)
Save worksheet to pdf Stream.
(Inherited from XlsWorksheet .)
Public method SaveToPdfStream(Stream, FileFormat) Obsolete.
Saves the document to a PDF stream with the specified file format.
(Inherited from XlsWorksheet .)
Public method Code example SaveToStream(Stream, String)
Save worksheet to stream.
Examples
The following code illustrates how to saves the worksheet as stream with separator:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create stream</para><para>Stream stream = new MemoryStream();</para><para>//Save to stream</para><para>worksheet.SaveToStream(stream , ",");</para>
(Inherited from XlsWorksheet .)
Public method SaveToStream(Stream, String, Boolean)
Save worksheet to stream.
(Inherited from XlsWorksheet .)
Public method SaveToStream(Stream, String, Encoding)
Save worksheet to stream.
(Inherited from XlsWorksheet .)
Public method SaveToStream(Stream, String, Encoding, Boolean)
Save worksheet to stream.
(Inherited from XlsWorksheet .)
Public method SaveToXps
Saves specific worksheet to xps.
(Inherited from XlsWorksheet .)
Public method Select
Selects current tab sheet.
(Inherited from XlsWorksheetBase .)
Public method SelectTab
Adds sheet tab to the selected tab.
(Inherited from XlsWorksheetBase .)
Public method SetActiveCell(CellRange)
Sets active cell
Public method SetActiveCell(IXLSRange)
Sets active cell
(Inherited from XlsWorksheet .)
Public method SetActiveCell(IXLSRange, Boolean)
Sets active cell
(Inherited from XlsWorksheet .)
Public method SetBlank
Sets blank in specified cell.
(Inherited from XlsWorksheet .)
Public method SetBoolean
Sets value in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetCaculateValue Obsolete.
Sets the value of a cell.
(Inherited from XlsWorksheet .)
Public method SetCalculateValue
Sets the value of a cell.
(Inherited from XlsWorksheet .)
Public method SetCellValue(Int32, Int32, Boolean)
Sets value in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetCellValue(Int32, Int32, String)
Sets value in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetChanged
This method should be called after any changes in the worksheet. Sets Saved property of the parent workbook to false.
(Inherited from XlsWorksheetBase .)
Public method SetColumnWidth
Set solumn width
(Inherited from XlsWorksheet .)
Public method Code example SetColumnWidthInPixels(Int32, Int32)
Sets column width in pixels.
Examples
The following code illustrates how to set width for a column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set column width</para><para>worksheet.SetColumnWidthInPixels(2, 160);</para><para>//Save to file</para><para>workbook.SaveToFile("SetColumnWidthInPixels.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method SetColumnWidthInPixels(Int32, Int32, Int32)
Sets the width of the specified columns.
(Inherited from XlsWorksheet .)
Public method Code example SetDefaultColumnStyle(Int32, CellStyle)
Sets default style for column.
Examples
The following code illustrates how to set the default style for a column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set Color</para><para>style.Color = Color.Red;</para><para>//Set default style</para><para>worksheet.SetDefaultColumnStyle(2, style);</para><para>//Save to file</para><para>workbook.SaveToFile("SetDefaultColumnStyle.xlsx");</para>
Public method SetDefaultColumnStyle(Int32, IStyle)
Sets default style for column.
(Inherited from XlsWorksheet .)
Public method Code example SetDefaultColumnStyle(Int32, Int32, CellStyle)
Sets default style for column.
Examples
The following code illustrates how to set the default style for columns:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set Color</para><para>style.Color = Color.Red;</para><para>//Set default style</para><para>worksheet.SetDefaultColumnStyle(2, 5, style);</para><para>//Save to file</para><para>workbook.SaveToFile("SetDefaultColumnStyle.xlsx");</para>
Public method SetDefaultColumnStyle(Int32, Int32, IStyle)
Sets by column index default style for column.
(Inherited from XlsWorksheet .)
Public method Code example SetDefaultRowStyle(Int32, CellStyle)
Sets default style for row.
Examples
The following code illustrates how to set the default style for a row:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set Color</para><para>style.Color = Color.Red;</para><para>//Set default style</para><para>worksheet.SetDefaultRowStyle(2, style);</para><para>//Save to file</para><para>workbook.SaveToFile("SetDefaultRowStyle.xlsx");</para>
Public method SetDefaultRowStyle(Int32, IStyle)
Sets bdefault style for row.
(Inherited from XlsWorksheet .)
Public method Code example SetDefaultRowStyle(Int32, Int32, CellStyle)
Sets default style for row.
Examples
The following code illustrates how to set the default style for rows:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set Color</para><para>style.Color = Color.Red;</para><para>//Set default style</para><para>worksheet.SetDefaultRowStyle(2, 5, style);</para><para>//Save to file</para><para>workbook.SaveToFile("SetDefaultRowStyle.xlsx");</para>
Public method SetDefaultRowStyle(Int32, Int32, IStyle)
Sets by column index default style for row.
(Inherited from XlsWorksheet .)
Public method SetError(Int32, Int32, String)
Sets error in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetError(Int32, Int32, String, Boolean)
Sets error in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetFirstColumn
Updates first column indexe.
(Inherited from XlsWorksheet .)
Public method SetFirstRow
Updates first row index.
(Inherited from XlsWorksheet .)
Public method SetFormula(Int32, Int32, String)
Sets formula in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetFormula(Int32, Int32, String, Boolean)
Sets formula in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetFormulaBoolValue
Sets formula bool value.
(Inherited from XlsWorksheet .)
Public method SetFormulaErrorValue
Sets formula error value.
(Inherited from XlsWorksheet .)
Public method SetFormulaNumberValue
Sets formula number value.
(Inherited from XlsWorksheet .)
Public method SetFormulaStringValue
Sets formula string value.
(Inherited from XlsWorksheet .)
Public method SetLastColumn
Updates last column index.
(Inherited from XlsWorksheet .)
Public method SetLastRow
Updates last row index.
(Inherited from XlsWorksheet .)
Public method SetNumber
Sets value in the specified cell.
(Inherited from XlsWorksheet .)
Protected method SetParent
Sets parent of the object.
(Inherited from XlsObject .)
Public method SetRowHeight
Sets the height of the specified row.
(Inherited from XlsWorksheet .)
Public method SetRowHeightInPixels
Set Row height from Start Row index
(Inherited from XlsWorksheet .)
Public method Code example SetRowHeightPixels
Sets the height of the specified row.
Examples
The following code illustrates how to set height for a row:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set row height</para><para>worksheet.SetRowHeightPixels(3, 150);</para><para>//Save to file</para><para>workbook.SaveToFile("SetRowHeightPixels.xlsx");</para>
(Inherited from XlsWorksheet .)
Public method SetText
Sets text in the specified cell.
(Inherited from XlsWorksheet .)
Public method SetValue
Sets the value of a cell in the grid.
(Inherited from XlsWorksheet .)
Public method ShowColumn
Shows a column.
(Inherited from XlsWorksheet .)
Public method ShowRow
Shows a row.
(Inherited from XlsWorksheet .)
Public method Subtotal(IXLSRange, Int32, Int32 , SubtotalTypes)
Creates subtotals for the range.
(Inherited from XlsWorksheet .)
Public method Subtotal(IXLSRange, Int32, Int32 , SubtotalTypes, Boolean, Boolean, Boolean)
Creates subtotals for the range.
(Inherited from XlsWorksheet .)
Public method ToEMFStream(Stream, Int32, Int32, Int32, Int32)
Converts a range of cells in the worksheet to an EMF (Enhanced Metafile) stream.
(Inherited from XlsWorksheet .)
Public method ToEMFStream(Stream, Int32, Int32, Int32, Int32, EmfType)
Converts a range of cells in the worksheet to an EMF (Enhanced Metafile) stream.
(Inherited from XlsWorksheet .)
Public method ToImage
Convert worksheet to Image.
(Inherited from XlsWorksheet .)
Public method ToString
Returns a string that represents the current object.
(Inherited from Object .)
Public method ToSVGStream
Convert CellRange to Svg stream
(Inherited from XlsWorksheet .)
Public method UngroupByColumns
Ungroups columns.
(Inherited from XlsWorksheet .)
Public method UngroupByRows
Ungroups rows.
(Inherited from XlsWorksheet .)
Public method Unprotect
Unprotects this wokrsheet.
(Inherited from XlsWorksheetBase .)
Public method Unprotect(String)
Unprotects this worksheet using specified password.
(Inherited from XlsWorksheetBase .)
Public method Unselect
Unselects current tab sheet if possible.
(Inherited from XlsWorksheetBase .)
Public method Unselect(Boolean)
Unselects current tab sheet if possible.
(Inherited from XlsWorksheetBase .)
Top
Events
Name Description
Public event CellValueChanged
Represents the event handler for the CellValueChanged event of the XlsRange class.
(Inherited from XlsWorksheet .)
Top
Fields
Name Description
Protected field m_bIsDisposed
Flag which indicates if the object was disposed or not.
(Inherited from XlsObject .)
Protected field m_book
Represents the workbook object.
(Inherited from XlsWorksheetBase .)
Protected field m_iFirstColumn
The first column index, initialized to the default minimum column index.
(Inherited from XlsWorksheetBase .)
Protected field m_iFirstRow
One field from Worksheet dimension records.
(Inherited from XlsWorksheetBase .)
Protected field m_iLastColumn
One field from Worksheet dimension records.
(Inherited from XlsWorksheetBase .)
Protected field m_iLastRow
One field from Worksheet dimension records
(Inherited from XlsWorksheetBase .)
Top
See Also