XlsWorksheetBase module

class XlsWorksheetBase.XlsWorksheetBase

Bases: XlsObject, INamedObject, ITabSheet, ICloneParent

Activate()

Activates the worksheet, making it the currently selected sheet in the workbook.

Equivalent to clicking the sheet’s tab in Excel UI.

AddTextEffectShape(effect: PresetTextEffect, text: str, upperLeftRow: int, top: int, upperLeftColumn: int, left: int, height: int, width: int) IShape

Adds a text effect shape to the worksheet.

Parameters:
  • effect – Preset text effect style

  • text – Text content

  • upperLeftRow – Top row index

  • top – Top position in pixels

  • upperLeftColumn – Left column index

  • left – Left position in pixels

  • height – Shape height

  • width – Shape width

Returns:

Created text effect shape

Return type:

IShape

property ArcShapes: IArcShapes

Gets collection of all arc shapes in the worksheet.

Returns:

Collection of arc objects

Return type:

IArcShapes

property ButtonShapes: IButtonShapes

Gets collection of all button controls in the worksheet.

Returns:

Collection of button objects

Return type:

IButtonShapes

property Charts: IChartShapes

Gets collection of all charts in the worksheet.

Returns:

Collection of chart objects

Return type:

IChartShapes

property CheckBoxes: ICheckBoxes

Gets collection of all checkbox controls in the worksheet.

Returns:

Collection of checkbox objects

Return type:

ICheckBoxes

Clone(parent: SpireObject) SpireObject

Creates a clone of the worksheet.

Parameters:

parent – Parent object for cloning

Returns:

Cloned worksheet object

Return type:

SpireObject

property CodeName: str

Name used by macros to access workbook items.

property ComboBoxes: IComboBoxes

Gets collection of all combobox controls in the worksheet.

Returns:

Collection of combobox objects

Return type:

IComboBoxes

property Comments: IComments

Gets collection of all cell comments in the worksheet.

Returns:

Collection of comment objects

Return type:

IComments

static DEF_MIN_COLUMN_INDEX() int

Gets the minimum allowed column index constant for the worksheet.

property DefaultGridlineColor: bool

Indicates whether gridline color has default value.

property FirstColumn: int

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

property FirstDataColumn: int

Gets index of the first data column of the worksheet.

property FirstDataRow: int

Gets index of the first data row of the worksheet.

property FirstRow: int

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

GetGroupShapeCollection() GroupShapeCollection

Gets collection of grouped shapes in the worksheet.

Returns:

Collection of shape groups

Return type:

GroupShapeCollection

GetShapes() IShapes

Gets collection of all shapes in the worksheet.

Returns:

Collection of shapes including charts, pictures and other objects

Return type:

IShapes

property GridLineColor: ExcelColors

Grid line color. Example:

#Create worksheet
workbook = Workbook()
worksheet = workbook.Worksheets[0]
#Set grid lines color
worksheet.GridLineColor = ExcelColors.Red
#Save to file
workbook.SaveToFile("GridLineColor.xlsx")
property GroupBoxes: IGroupBoxes

Gets collection of all groupbox controls in the worksheet.

Returns:

Collection of groupbox objects

Return type:

IGroupBoxes

property HasPictures: bool

Indicates whether the worksheet contains any pictures.

Returns:

True if worksheet has pictures, False otherwise

Return type:

bool

property HasVmlShapes: bool

Indicates whether worksheet has vml shapes. Read-only.

property HeaderFooterShapes: XlsHeaderFooterShapeCollection

Header / footer shapes collection.

property Index: int

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

property IsPasswordProtected: bool

Indicates whether the worksheet is password protected.

Returns:

True if password protection is enabled, False otherwise

Return type:

bool

property IsRightToLeft: bool

Indicates whether worksheet is displayed right to left.

property IsRowColHeadersVisible: bool

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

property IsSelected: bool

Indicates whether the worksheet tab is currently selected.

Returns:

True if the sheet tab is selected, False otherwise

Return type:

bool

property IsTransitionEvaluation: bool
property LabelShapes: ILabelShapes

Gets collection of all label controls in the worksheet.

Returns:

Collection of label objects

Return type:

ILabelShapes

property LastColumn: int

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

property LastDataColumn: int

Gets index of the last data column of the worksheet.

property LastDataRow: int

Gets index of the last data row of the worksheet.

property LastRow: int

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

property LeftVisibleColumn: int

Gets/sets left visible column of the worksheet. Example:

#Create worksheet
workbook = Workbook()
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")
property Lines: ILines

Gets collection of all line shapes in the worksheet.

Returns:

Collection of line objects

Return type:

ILines

property ListBoxes: IListBoxes

Gets collection of all listbox controls in the worksheet.

Returns:

Collection of listbox objects

Return type:

IListBoxes

MoveSheet

Moves sheet into new position, including chartsheet and worksheet.

Parameters:

destIndex – Zero-based destination index to move sheet to

property Name: str

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

property OvalShapes: IOvalShapes

Gets collection of all oval shapes in the worksheet.

Returns:

Collection of oval objects

Return type:

IOvalShapes

property ParentWorkbook: XlsWorkbook

Gets the parent workbook that contains this worksheet.

Returns:

Parent workbook instance

Return type:

XlsWorkbook

property Pictures: IPictures

Gets collection of all pictures in the worksheet.

Returns:

Collection of picture objects

Return type:

IPictures

Protect

Protects worksheet with password.

Parameters:

password – Protection password.

property ProtectContents: bool

Indicates whether worksheet contents are protected.

Returns:

True if cell contents are protected, False otherwise

Return type:

bool

property ProtectDrawingObjects: bool

Indicates whether shapes and other drawing objects are protected.

Returns:

True if drawing objects are protected, False otherwise

Return type:

bool

property ProtectScenarios: bool

Indicates whether worksheet scenarios are protected.

Returns:

True if scenarios are protected, False otherwise

Return type:

bool

property Protection: SheetProtectionType

Gets the sheet protection type specifying which elements are protected.

Returns:

Enum value indicating protected elements

Return type:

SheetProtectionType

property PrstGeomShapes: PrstGeomShapeCollection

Gets collection of preset geometric shapes in the worksheet.

Returns:

Collection of preset geometry objects

Return type:

PrstGeomShapeCollection

property QueryTables: QueryTableCollection

Gets collection of external data query tables in the worksheet.

Returns:

Collection of data query objects

Return type:

QueryTableCollection

property RadioButtons: IRadioButtons

Gets collection of all radio button controls in the worksheet.

Returns:

Collection of radio button objects

Return type:

IRadioButtons

property RealIndex: int
property RectangleShapes: IRectangleShapes

Gets collection of all rectangle shapes in the worksheet.

Returns:

Collection of rectangle objects

Return type:

IRectangleShapes

property ScrollBarShapes: IScrollBarShapes

Gets collection of all scrollbar controls in the worksheet.

Returns:

Collection of scrollbar objects

Return type:

IScrollBarShapes

Select()

Selects the worksheet in the workbook UI.

SelectTab()

Selects the worksheet tab in the workbook UI.

SetChanged()

Marks the worksheet as modified to trigger refresh/resave operations.

property SheetId: int

Gets or sets sheetId for this sheet.

property SpinnerShapes: ISpinnerShapes

Gets collection of all spinner controls in the worksheet.

Returns:

Collection of spinner objects

Return type:

ISpinnerShapes

property TabColor: Color

Gets or sets the color of the worksheet tab.

Returns:

Color object representing the tab color

Return type:

Color

property TabColorObject: OColor

Gets the Office Color object representing the tab color.

Returns:

Office Color object with color properties

Return type:

OColor

property TabIndex: int

Gets the zero-based index position of the worksheet tab in the workbook’s tab bar.

property TabKnownColor: ExcelColors

Gets or sets the predefined Excel color for the worksheet tab.

Returns:

Enum value representing the predefined color

Return type:

ExcelColors

property TextBoxes: ITextBoxes

Gets collection of all textbox controls in the worksheet (read-only).

Returns:

Collection of textbox objects

Return type:

ITextBoxes

property TopVisibleRow: int

Gets/sets top visible row of the worksheet. Example:

#Create worksheet
workbook = Workbook()
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")
property TypedArcs: ArcShapeCollection
property TypedButtons: ButtonShapeCollection

Returns inner buttons collection. Read-only.

property TypedCheckBoxes: CheckBoxCollection

Gets strongly-typed collection of checkbox controls.

Returns:

Typed collection of checkbox objects

Return type:

CheckBoxCollection

property TypedComboBoxes: ComboBoxCollection

Gets strongly-typed collection of combobox controls.

Returns:

Typed collection of combobox objects

Return type:

ComboBoxCollection

property TypedGroupBoxes: GroupBoxCollection

Returns inner gourpboxes collection. Read-only.

property TypedLabels: LabelShapeCollection

Returns inner labels collection. Read-only.

property TypedLines: LineCollection

Returns inner lines collection. Read-only.

property TypedListBoxes: ListBoxCollection

Returns inner listboxes collection. Read-only.

property TypedOvals: OvalShapeCollection

Returns inner ovals collection. Read-only.

property TypedPictures: PicturesCollection

Returns inner pictures collection. Read-only.

property TypedRadioButtons: RadioButtonCollection

Gets strongly-typed collection of radio button controls.

Returns:

Typed collection of radio button objects

Return type:

RadioButtonCollection

property TypedRects: RectangleCollection

Returns inner rects collection. Read-only.

property TypedScollBars: ScrollBarCollection

Returns inner scollbars collection. Read-only.

property TypedSpinners: SpinnerShapeCollection

Returns inner spinners collection. Read-only.

property TypedTextBoxes: TextBoxCollection

Returns inner textboxes collection. Read-only.

property UnknownVmlShapes: bool

Indicates whether worksheet contains some unknown vml shapes.

Unprotect

Unprotects this wokrsheet.

Unselect

Unselects the worksheet in the workbook UI.

Parameters:

Check – Whether to validate selection state

property Visibility: WorksheetVisibility

Controls end user visibility of worksheet.

property VmlShapesCount: int

Gets the total number of VML (Vector Markup Language) shapes in the worksheet.

property Workbook: IWorkbook

Gets the parent workbook containing this worksheet.

Returns:

Parent workbook object

Return type:

IWorkbook

property Zoom: int

Zoom factor of document.