Worksheet Interface
Represents a worksheet in Excel projects created by using the Office development tools in Visual Studio.
Namespace: Microsoft.Office.Tools.Excel
Assemblies: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
<GuidAttribute("297dc8d9-eabd-45a1-bdef-68ab67e5c3c3")> _
Public Interface Worksheet _
Inherits IBindableComponent, IComponent, IDisposable, ISupportInitialize
[GuidAttribute("297dc8d9-eabd-45a1-bdef-68ab67e5c3c3")]
public interface Worksheet : IBindableComponent,
IComponent, IDisposable, ISupportInitialize
The Worksheet type exposes the following members.
Properties
Name | Description | |
---|---|---|
_CodeName | Infrastructure. | |
_DisplayRightToLeft | Infrastructure. | |
Application | This property gets a Microsoft.Office.Interop.Excel.Application that represents the Microsoft Office Excel application. | |
AutoFilter | Gets a Microsoft.Office.Interop.Excel.AutoFilter that provides information about filtered lists on the worksheet if filtering is enabled. Gets nulla null reference (Nothing in Visual Basic) if filtering is off. | |
AutoFilterMode | Gets or sets a value that indicates whether filtering is currently enabled on the worksheet (that is, whether the filter drop-down arrows are currently displayed). | |
BindingContext | Gets or sets the collection of currency managers for the IBindableComponent. (Inherited from IBindableComponent.) | |
Cells | Gets a Range object that represents all the cells on the worksheet (not just the cells that are currently in use). | |
CircularReference | Gets a Range object that represents the range containing the first circular reference on the sheet, or gets nulla null reference (Nothing in Visual Basic) if there is no circular reference on the sheet. | |
CodeName | Infrastructure. | |
Columns | Gets a Range object that represents one or more columns on the worksheet. | |
Comments | Gets a Microsoft.Office.Interop.Excel.Comments collection that represents all the comments for the worksheet. | |
ConsolidationFunction | Gets the function code used for the current consolidation. | |
ConsolidationOptions | Gets a three-element Array of consolidation options. | |
ConsolidationSources | Gets an Array of strings that name the source sheets and ranges for the worksheet's current consolidation. | |
Controls | Gets the collection of managed controls that are contained on the worksheet. | |
Creator | Gets a value that indicates the application in which the worksheet was created. | |
CustomProperties | Gets a Microsoft.Office.Interop.Excel.CustomProperties object representing the identifier information associated with a worksheet. | |
DataBindings | Gets the collection of data-binding objects for this IBindableComponent. (Inherited from IBindableComponent.) | |
DataHost | Infrastructure. | |
DefaultExtension | Gets the default extension for this Worksheet object. | |
DisplayAutomaticPageBreaks | Infrastructure. | |
DisplayPageBreaks | Gets or sets a value that indicates whether page breaks (both automatic and manual) on the worksheet are displayed. | |
DisplayRightToLeft | Gets or sets a value that indicates whether the worksheet is displayed from right to left instead of from left to right. | |
EnableAutoFilter | Gets or sets a value that indicates whether AutoFilter arrows are enabled when user-interface-only protection is turned on. | |
EnableCalculation | Gets or set a value that indicates whether Microsoft Office Excel automatically recalculates the worksheet when necessary. | |
EnableFormatConditionsCalculation | Gets or sets a value that determines whether conditional formats will occur automatically. | |
EnableOutlining | Gets or sets a value that indicates whether outlining symbols are enabled when user-interface-only protection is turned on. | |
EnablePivotTable | Gets or sets a value that indicates whether PivotTable controls and actions are enabled when user-interface-only protection is turned on. | |
EnableSelection | Gets or sets a value indicating which cells can be selected on the sheet. | |
Extension | Gets a custom extension for this Worksheet object. | |
FilterMode | Gets a value that indicates whether the worksheet is actively filtering data. | |
HostContext | Infrastructure. | |
HPageBreaks | Gets an Microsoft.Office.Interop.Excel.HPageBreaks collection that represents the horizontal page breaks on the sheet. | |
Hyperlinks | Gets a Microsoft.Office.Interop.Excel.Hyperlinks collection that represents the hyperlinks for the range or worksheet. | |
Index | Gets the index number of the worksheet within the collection of worksheets. | |
InnerObject | Gets a Microsoft.Office.Interop.Excel.Worksheet that represents the underlying native object for the Worksheet. | |
ItemProvider | Infrastructure. | |
ListObjects | Gets a collection of Microsoft.Office.Interop.Excel.ListObject objects in the worksheet. | |
MailEnvelope | Gets an e-mail header for the worksheet. | |
Name | Gets or sets the name of the worksheet. | |
Names | Gets a Microsoft.Office.Interop.Excel.Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix). | |
Next | Gets a Microsoft.Office.Interop.Excel.Worksheet that represents the next sheet. | |
OnCalculate | Infrastructure. | |
OnData | Infrastructure. | |
OnDoubleClick | Infrastructure. | |
OnEntry | Infrastructure. | |
OnSheetActivate | Infrastructure. | |
OnSheetDeactivate | Infrastructure. | |
Outline | Gets an Microsoft.Office.Interop.Excel.Outline that represents the outline for the worksheet. | |
PageSetup | Gets a Microsoft.Office.Interop.Excel.PageSetup that contains all the page setup settings for the worksheet. | |
Parent | Gets the parent object for the worksheet. | |
Previous | Gets a Microsoft.Office.Interop.Excel.Worksheet that represents the previous sheet. | |
PrintedCommentPages | Gets the number of comment pages that will be printed for the current worksheet. | |
ProtectContents | Gets a value that indicates whether the contents of the worksheet (the individual cells) are protected. | |
ProtectDrawingObjects | Gets a value that indicates whether shapes are protected. | |
Protection | Gets a Microsoft.Office.Interop.Excel.Protection object that represents the protection options of the worksheet. | |
ProtectionMode | Gets a value that indicates whether user interface-only protection is turned on. | |
ProtectScenarios | Gets a value that indicates whether worksheet scenarios are protected. | |
QueryTables | Gets the Microsoft.Office.Interop.Excel.QueryTables collection that represents all the query tables on the worksheet. | |
Range | Gets a Microsoft.Office.Interop.Excel.Range object that represents a cell or a range of cells. | |
Rows | Gets a Range object that represents one or more rows on the worksheet. | |
Scripts | Gets the Microsoft.Office.Core.Scripts collection, which contains Script objects representing blocks of script or code in the worksheet when it is saved as a Web page. | |
ScrollArea | Gets or sets the range where scrolling is allowed, as an A1-style range reference. | |
Shapes | Gets a Microsoft.Office.Interop.Excel.Shapes object that represents all the shapes on the worksheet. | |
Site | Gets or sets the ISite associated with the IComponent. (Inherited from IComponent.) | |
SmartTags | Gets a Microsoft.Office.Interop.Excel.SmartTags object representing the collection of smart tags for the worksheet. | |
Sort | Gets the sorted values in the current worksheet. | |
StandardHeight | Gets the standard (default) height of all the rows in the worksheet, in points. | |
StandardWidth | Gets or sets the standard (default) width of all the columns in the worksheet. | |
Tab | Gets a Microsoft.Office.Interop.Excel.Tab for the worksheet. | |
Tag | Gets or sets the object that contains data about the worksheet. | |
TransitionExpEval | Gets or sets a value that indicates whether Microsoft Office Excel uses Lotus 1-2-3 expression evaluation rules for the worksheet. | |
TransitionFormEntry | Gets or sets a value that indicates whether Microsoft Office Excel uses Lotus 1-2-3 formula entry rules for the worksheet. | |
Type | Gets the worksheet type. | |
UsedRange | Gets a Microsoft.Office.Interop.Excel.Range object that represents all the cells that have contained a value at any time. | |
Visible | Gets or sets a Microsoft.Office.Interop.Excel.XlSheetVisibility value that determines whether the object is visible. | |
VPageBreaks | Gets a Microsoft.Office.Interop.Excel.VPageBreaks collection that represents the vertical page breaks on the sheet. |
Top
Methods
Name | Description | |
---|---|---|
_CheckSpelling | Infrastructure. | |
_Evaluate | Infrastructure. | |
_PasteSpecial | Infrastructure. | |
_PrintOut | Infrastructure. | |
_Protect | Infrastructure. | |
_SaveAs | Infrastructure. | |
_VtblGap1_1 | Infrastructure. | |
_VtblGap2_1 | Infrastructure. | |
_VtblGap3_1 | Infrastructure. | |
_VtblGap4_1 | Infrastructure. | |
_VtblGap5_1 | Infrastructure. | |
_VtblGap6_1 | Infrastructure. | |
_VtblGap7_1 | Infrastructure. | |
Activate | Makes the current sheet the active sheet. | |
Arcs | Infrastructure. | |
BeginInit | Signals the object that initialization is starting. (Inherited from ISupportInitialize.) | |
Buttons | Infrastructure. | |
CalculateMethod | Calculates the formulas in the worksheet. | |
ChartObjects | Gets an object that represents either a single embedded chart (a Microsoft.Office.Interop.Excel.ChartObject) or a collection of all the embedded charts (a Microsoft.Office.Interop.Excel.ChartObjects) on the worksheet. | |
CheckBoxes | Infrastructure. | |
CheckSpelling | Checks the spelling in a worksheet. | |
CircleInvalid | Circles invalid entries on the worksheet. | |
ClearArrows | Clears the tracer arrows from the worksheet. Tracer arrows are added by using the auditing feature. | |
ClearCircles | Clears circles from invalid entries on the worksheet. | |
Copy | Copies the worksheet to another location in the workbook. | |
Delete | Deletes the underlying Microsoft.Office.Interop.Excel.Worksheet object, but does not delete the host item. It is highly recommended that this method not be used. | |
Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.) | |
DrawingObjects | Infrastructure. | |
Drawings | Infrastructure. | |
DropDowns | Infrastructure. | |
EndInit | Signals the object that initialization is complete. (Inherited from ISupportInitialize.) | |
Evaluate | Converts a Microsoft Office Excel name to an object or a value. | |
ExportAsFixedFormat | Exports to a file of the specified format. | |
get_Range | Gets a Microsoft.Office.Interop.Excel.Range object that represents a cell or a range of cells. Use the Range property instead of this method. | |
GroupBoxes | Infrastructure. | |
GroupObjects | Infrastructure. | |
Labels | Infrastructure. | |
Lines | Infrastructure. | |
ListBoxes | Infrastructure. | |
Move | Moves the worksheet to another location in the workbook. | |
OLEObjects | Gets an object that represents either a single OLE object (an Microsoft.Office.Interop.Excel.OLEObject) or a collection of all OLE objects (an Microsoft.Office.Interop.Excel.OLEObjects collection) on the worksheet. | |
OptionButtons | Infrastructure. | |
Ovals | Infrastructure. | |
Paste | Pastes the contents of the Clipboard onto the worksheet. | |
PasteSpecial | Pastes the contents of the Clipboard onto the worksheet, using a specified format. Use this method to paste data from other applications or to paste data in a specific format. | |
Pictures | Infrastructure. | |
PivotTables | Gets an object that represents either a single PivotTable report (a Microsoft.Office.Interop.Excel.PivotTable object) or a collection of all the PivotTable reports (a Microsoft.Office.Interop.Excel.PivotTables object) on a worksheet. | |
PivotTableWizard | Creates a Microsoft.Office.Interop.Excel.PivotTable object. | |
PrintOut | Prints the worksheet. | |
PrintOutEx | Prints the worksheet. | |
PrintPreview | Shows a preview of the worksheet as it would look when printed. | |
Protect | Protects a worksheet so that it cannot be modified. | |
Rectangles | Infrastructure. | |
ResetAllPageBreaks | Resets all page breaks on the specified worksheet. | |
SaveAs | Saves changes to the worksheet in a different file. | |
Scenarios | Gets an object that represents either a single scenario (a Microsoft.Office.Interop.Excel.Scenario object) or a collection of scenarios (a Microsoft.Office.Interop.Excel.Scenarios object) on the worksheet. | |
ScrollBars | Infrastructure. | |
Select | Selects the worksheet. | |
SetBackgroundPicture | Sets the background graphic for the worksheet. | |
ShowAllData | Makes all rows of the currently filtered list visible. If AutoFilter is in use, this method changes the arrows to "All." | |
ShowDataForm | Displays the data form associated with the worksheet. | |
Spinners | Infrastructure. | |
TextBoxes | Infrastructure. | |
Unprotect | Removes protection from the worksheet. This method has no effect if the worksheet is not protected. | |
XmlDataQuery | Gets a Range object that represents the cells mapped to a particular XPath. Gets nulla null reference (Nothing in Visual Basic) if the specified XPath has not been mapped to the worksheet, or if the mapped range is empty. | |
XmlMapQuery | Gets a Range object that represents the cells mapped to a particular XPath. Gets nulla null reference (Nothing in Visual Basic) if the specified XPath has not been mapped to the worksheet. |
Top
Events
Name | Description | |
---|---|---|
ActivateEvent | Occurs when the worksheet is activated. | |
BeforeDoubleClick | Occurs when the worksheet is double-clicked, before the default double-click action. | |
BeforeRightClick | Occurs when the worksheet is right-clicked, before the default right-click action. | |
BindingContextChanged | Infrastructure. | |
Calculate | Occurs after the worksheet is recalculated. | |
Change | Occurs when something changes in the Worksheet cells. | |
Deactivate | Occurs when the worksheet loses focus. | |
Disposed | Represents the method that handles the Disposed event of a component. (Inherited from IComponent.) | |
FollowHyperlink | Occurs when you click any hyperlink on a worksheet. | |
PivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas). | |
PivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable. | |
PivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable. | |
PivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded. | |
PivotTableChangeSync | Occurs after changes to a PivotTable. | |
PivotTableUpdate | Occurs after a PivotTable report is updated on a worksheet. | |
SelectionChange | Occurs when the selection changes on a worksheet. | |
Shutdown | Occurs when the worksheet host item shuts down. | |
Startup | Occurs after the worksheet is running and all the initialization code in the assembly has been run. |
Top
Remarks
A Microsoft.Office.Tools.Excel.Worksheet object provides the same members as a Microsoft.Office.Interop.Excel.Worksheet object from the Excel primary interop assembly, but it adds the following features:
Controls property. Use this property to add managed controls to an Excel worksheet, or to remove controls, at run time.
InnerObject property. Use this property to get the underlying Microsoft.Office.Interop.Excel.Worksheet object for a Microsoft.Office.Tools.Excel.Worksheet host item.
Worksheet-level events, such as ActivateEvent and Change, that are provided only at the application level in the Excel object model. That is, in the Excel object model, these events are defined in the Microsoft.Office.Interop.Excel.Application class rather than the Microsoft.Office.Interop.Excel.Worksheet interface.
In application-level projects, you can create Microsoft.Office.Tools.Excel.Worksheet objects programmatically by using the GetVstoObject method. For more information, see Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time.
In document-level projects, you typically do not use Microsoft.Office.Tools.Excel.Worksheet object directly. Instead, use the Sheetn classes to programmatically access the worksheets in your project. Each Sheetn class derives most of its members from the Microsoft.Office.Tools.Excel.WorksheetBase class. This class redirects all calls to its members to an internal implementation of the Microsoft.Office.Tools.Excel.Worksheet interface in the Visual Studio Tools for Office runtime. For more information, see Programming Document-Level Customizations.
Note
This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.
Usage
This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 and the .NET Framework 4.5. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: https://go.microsoft.com/fwlink/?LinkId=160658.
See Also
Reference
Microsoft.Office.Tools.Excel Namespace