Table of Contents

Class XlsWorksheetBase

Namespace
Spire.Xls.Core.Spreadsheet
Assembly
Spire.XLS.dll
public abstract class XlsWorksheetBase : XlsObject, IDisposable, INamedObject, ITabSheet, IExcelApplication, ICloneParent
Inheritance
XlsWorksheetBase
Implements
Derived
Inherited Members

Fields

DEF_MIN_COLUMN_INDEX

public const int DEF_MIN_COLUMN_INDEX = 2147483647

Field Value

int

m_book

protected XlsWorkbook m_book

Field Value

XlsWorkbook

m_iFirstColumn

[CLSCompliant(false)]
protected int m_iFirstColumn

Field Value

int

m_iFirstRow

protected int m_iFirstRow

Field Value

int

m_iLastColumn

[CLSCompliant(false)]
protected int m_iLastColumn

Field Value

int

m_iLastRow

protected int m_iLastRow

Field Value

int

Properties

ArcShapes

public IArcShapes ArcShapes { get; }

Property Value

IArcShapes

ButtonShapes

public IButtonShapes ButtonShapes { get; }

Property Value

IButtonShapes

CellImages

public ExcelPicture[] CellImages { get; }

Property Value

ExcelPicture[]

Charts

public IChartShapes Charts { get; }

Property Value

IChartShapes

CheckBoxes

public ICheckBoxes CheckBoxes { get; }

Property Value

ICheckBoxes

CodeName

Name used by macros to access workbook items.

public string CodeName { get; set; }

Property Value

string

ComboBoxes

public IComboBoxes ComboBoxes { get; }

Property Value

IComboBoxes

Comments

public IComments Comments { get; }

Property Value

IComments

DefaultGridlineColor

Indicates whether gridline color has default value.

public bool DefaultGridlineColor { get; }

Property Value

bool

FirstColumn

Gets or sets index of the first column of the worksheet.

[CLSCompliant(false)]
public virtual int FirstColumn { get; set; }

Property Value

int

FirstDataColumn

Gets index of the first data column of the worksheet.

public int FirstDataColumn { get; }

Property Value

int

FirstDataRow

Gets index of the first data row of the worksheet.

public int FirstDataRow { get; }

Property Value

int

FirstRow

Gets / sets index of the first row of the worksheet.

public virtual int FirstRow { get; set; }

Property Value

int

GridLineColor

Grid line color. The following code illustrates how to set the grid line color:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set grid lines color
worksheet.GridLineColor = ExcelColors.Red;

//Save to file
workbook.SaveToFile("GridLineColor.xlsx");
public ExcelColors GridLineColor { get; set; }

Property Value

ExcelColors

GroupBoxes

public IGroupBoxes GroupBoxes { get; }

Property Value

IGroupBoxes

GroupShapeCollection

Get group shapes in worksheet.

public GroupShapeCollection GroupShapeCollection { get; }

Property Value

GroupShapeCollection

HasPictures

public bool HasPictures { get; }

Property Value

bool

HasVmlShapes

Indicates whether worksheet has vml shapes. Read-only.

public bool HasVmlShapes { get; }

Property Value

bool

HeaderFooterShapes

Header / footer shapes collection.

public XlsHeaderFooterShapeCollection HeaderFooterShapes { get; }

Property Value

XlsHeaderFooterShapeCollection

Index

Returns the index number of the object within the collection of objects.

public int Index { get; set; }

Property Value

int

IsPasswordProtected

public bool IsPasswordProtected { get; }

Property Value

bool

IsRightToLeft

Indicates whether worksheet is displayed right to left.

public bool IsRightToLeft { get; set; }

Property Value

bool

IsRowColHeadersVisible

Gets or sets whether the worksheet will display row and column headers. Default is true.

public bool IsRowColHeadersVisible { get; set; }

Property Value

bool

IsSelected

Indicates whether tab of this sheet is selected. Read-only.

public bool IsSelected { get; }

Property Value

bool

IsTransitionEvaluation

public bool IsTransitionEvaluation { get; set; }

Property Value

bool

LabelShapes

public ILabelShapes LabelShapes { get; }

Property Value

ILabelShapes

LastColumn

Gets or sets index of the last column of the worksheet.

[CLSCompliant(false)]
public int LastColumn { get; set; }

Property Value

int

LastDataColumn

Gets index of the last data column of the worksheet.

public int LastDataColumn { get; }

Property Value

int

LastDataRow

Gets index of the last data row of the worksheet.

public int LastDataRow { get; }

Property Value

int

LastRow

Gets or sets one-based index of the last row of the worksheet.

public virtual int LastRow { get; set; }

Property Value

int

LeftVisibleColumn

Gets/sets left visible column of the worksheet. The following code illustrates how to set the left visible column:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set left visible column
worksheet.LeftVisibleColumn = 3;

//Get left visible column
Console.Write(worksheet.LeftVisibleColumn);

//Save to file
workbook.SaveToFile("LeftVisibleColumn.xlsx");
public int LeftVisibleColumn { get; set; }

Property Value

int

Lines

public ILines Lines { get; }

Property Value

ILines

ListBoxes

public IListBoxes ListBoxes { get; }

Property Value

IListBoxes

Name

Returns or sets the name of the object. Read / write String.

public string Name { get; set; }

Property Value

string

OvalShapes

public IOvalShapes OvalShapes { get; }

Property Value

IOvalShapes

ParentWorkbook

public XlsWorkbook ParentWorkbook { get; }

Property Value

XlsWorkbook

Pictures

Pictures collection. Read-only.

public IPictures Pictures { get; }

Property Value

IPictures

ProtectContents

Indicates is current sheet is protected.

public virtual bool ProtectContents { get; }

Property Value

bool

ProtectDrawingObjects

True if objects are protected. Read only.

public virtual bool ProtectDrawingObjects { get; }

Property Value

bool

ProtectScenarios

True if the scenarios of the current sheet are protected. Read only.

public virtual bool ProtectScenarios { get; }

Property Value

bool

Protection

public virtual SheetProtectionType Protection { get; }

Property Value

SheetProtectionType

PrstGeomShapes

public PrstGeomShapeCollection PrstGeomShapes { get; }

Property Value

PrstGeomShapeCollection

QueryTables

public QueryTableCollection QueryTables { get; }

Property Value

QueryTableCollection

RadioButtons

public IRadioButtons RadioButtons { get; }

Property Value

IRadioButtons

RealIndex

public int RealIndex { get; set; }

Property Value

int

RectangleShapes

public IRectangleShapes RectangleShapes { get; }

Property Value

IRectangleShapes

ScrollBarShapes

public IScrollBarShapes ScrollBarShapes { get; }

Property Value

IScrollBarShapes

Shapes

Shapes collection.

public IShapes Shapes { get; }

Property Value

IShapes

SheetId

Gets or sets sheetId for this sheet.

public int SheetId { get; set; }

Property Value

int

SpinnerShapes

public ISpinnerShapes SpinnerShapes { get; }

Property Value

ISpinnerShapes

TabColor

Tab color.

public virtual Color TabColor { get; set; }

Property Value

Color

TabColorObject

public virtual OColor TabColorObject { get; }

Property Value

OColor

TabKnownColor

Tab excel color.

public virtual ExcelColors TabKnownColor { get; set; }

Property Value

ExcelColors

TextBoxes

Returns inner textboxes collection. Read-only.

public ITextBoxes TextBoxes { get; }

Property Value

ITextBoxes

TopVisibleRow

Gets/sets top visible row of the worksheet. The following code illustrates how to set the top visible row:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set top visible row
worksheet.TopVisibleRow = 5;

//Get top visible row
Console.Write(worksheet.TopVisibleRow);

//Save to file
workbook.SaveToFile("TopVisibleRow.xlsx");
public int TopVisibleRow { get; set; }

Property Value

int

TypedArcs

public ArcShapeCollection TypedArcs { get; }

Property Value

ArcShapeCollection

TypedButtons

Returns inner buttons collection. Read-only.

public ButtonShapeCollection TypedButtons { get; }

Property Value

ButtonShapeCollection

TypedCheckBoxes

public CheckBoxCollection TypedCheckBoxes { get; }

Property Value

CheckBoxCollection

TypedComboBoxes

public ComboBoxCollection TypedComboBoxes { get; }

Property Value

ComboBoxCollection

TypedGroupBoxes

Returns inner gourpboxes collection. Read-only.

public GroupBoxCollection TypedGroupBoxes { get; }

Property Value

GroupBoxCollection

TypedLabels

Returns inner labels collection. Read-only.

public LabelShapeCollection TypedLabels { get; }

Property Value

LabelShapeCollection

TypedLines

Returns inner lines collection. Read-only.

public LineCollection TypedLines { get; }

Property Value

LineCollection

TypedListBoxes

Returns inner listboxes collection. Read-only.

public ListBoxCollection TypedListBoxes { get; }

Property Value

ListBoxCollection

TypedOvals

Returns inner ovals collection. Read-only.

public OvalShapeCollection TypedOvals { get; }

Property Value

OvalShapeCollection

TypedPictures

Returns inner pictures collection. Read-only.

public PicturesCollection TypedPictures { get; }

Property Value

PicturesCollection

TypedRadioButtons

public RadioButtonCollection TypedRadioButtons { get; }

Property Value

RadioButtonCollection

TypedRects

Returns inner rects collection. Read-only.

public RectangleCollection TypedRects { get; }

Property Value

RectangleCollection

TypedScollBars

Returns inner scollbars collection. Read-only.

public ScrollBarCollection TypedScollBars { get; }

Property Value

ScrollBarCollection

TypedSpinners

Returns inner spinners collection. Read-only.

public SpinnerShapeCollection TypedSpinners { get; }

Property Value

SpinnerShapeCollection

TypedTextBoxes

Returns inner textboxes collection. Read-only.

public TextBoxCollection TypedTextBoxes { get; }

Property Value

TextBoxCollection

UnknownVmlShapes

Indicates whether worksheet contains some unknown vml shapes.

public bool UnknownVmlShapes { get; set; }

Property Value

bool

Visibility

Controls end user visibility of worksheet.

public WorksheetVisibility Visibility { get; set; }

Property Value

WorksheetVisibility

VmlShapesCount

public int VmlShapesCount { get; }

Property Value

int

Workbook

public IWorkbook Workbook { get; }

Property Value

IWorkbook

Zoom

Zoom factor of document.

public virtual int Zoom { get; set; }

Property Value

int

Remarks

Value of zoom should be between 10 and 400.

Methods

Activate()

Makes the current sheet the active sheet. Equivalent to clicking the sheet's tab in MS Excel.

public virtual void Activate()

AddTextEffectShape(PresetTextEffect, string, int, int, int, int, int, int)

public IShape AddTextEffectShape(PresetTextEffect effect, string text, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width)

Parameters

effect PresetTextEffect
text string
upperLeftRow int
top int
upperLeftColumn int
left int
height int
width int

Returns

IShape

Clone(object)

[Obsolete("the method is not implemented")]
public virtual object Clone(object parent)

Parameters

parent object

Returns

object

InitializeCollections()

protected virtual void InitializeCollections()

MoveSheet(int)

Moves sheet into new position, including chartsheet and worksheet.

public void MoveSheet(int destIndex)

Parameters

destIndex int

Destination index.

Protect(string)

Protects worksheet with password.protect the sheet except select lock/unlock cells. The following code illustrates how to protect the sheet except select lock/unlock cells:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Protects the first worksheet's content with password
worksheet.Protect("123456");

//Save to file
workbook.SaveToFile("Protect.xlsx");
public void Protect(string password)

Parameters

password string

Protection password.

Remarks

Password should be less than 15 symbols.

Protect(string, SheetProtectionType)

Protects worksheet with password.

public void Protect(string password, SheetProtectionType options)

Parameters

password string

Protection password.

options SheetProtectionType

Remarks

Password should be less than 15 symbols.

Select()

public virtual void Select()

SelectTab()

public void SelectTab()

SetChanged()

public void SetChanged()

Unprotect()

Unprotects this wokrsheet.

public void Unprotect()

Unprotect(string)

Unprotects this worksheet using specified password.

public void Unprotect(string password)

Parameters

password string

Password to unprotect.

Unselect()

public void Unselect()

Unselect(bool)

public void Unselect(bool Check)

Parameters

Check bool