共用方式為


NamedRange Interface

A NamedRange control is a range that has a unique name, exposes events, and can be bound to data.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
<GuidAttribute("6b87f7cb-0689-4e7e-8dcb-3c0e654629bb")> _
Public Interface NamedRange _
    Inherits IBindableComponent, IComponent, IDisposable, ISupportInitialize
[GuidAttribute("6b87f7cb-0689-4e7e-8dcb-3c0e654629bb")]
public interface NamedRange : IBindableComponent, 
    IComponent, IDisposable, ISupportInitialize

The NamedRange type exposes the following members.

Properties

  Name Description
Public property AddIndent Gets or sets a value that determines whether text is automatically indented when the text alignment in the NamedRange control is set to equal distribution either horizontally or vertically.
Public property Address Gets the range reference for the NamedRange control.
Public property AddressLocal Gets the range reference for the NamedRange control in the language of the user.
Public property AllowEdit Gets a value that indicates whether the NamedRange control can be edited on a protected worksheet.
Public property Application Gets a Microsoft.Office.Interop.Excel.Application that represents the creator of the NamedRange control.
Public property Areas Gets an Areas collection that represents all the ranges in a multiple-area selection.
Public property BindingContext Gets or sets the collection of currency managers for the IBindableComponent. (Inherited from IBindableComponent.)
Public property Borders Gets a Borders collection that represents the borders of the NamedRange control.
Public property Cells Gets a Microsoft.Office.Interop.Excel.Range that represents the cells in the NamedRange control.
Public property Characters Gets a Microsoft.Office.Interop.Excel.Characters object that represents a range of characters within the text of the NamedRange control.
Public property Column Gets the number of the first column in the first area of the NamedRange control.
Public property Columns Gets a Microsoft.Office.Interop.Excel.Range that represents the one or more columns in the NamedRange control.
Public property ColumnWidth Gets or sets the width of all columns in the NamedRange control.
Public property Comment Gets a Comment that represents the comment associated with the cell in the upper left corner of the NamedRange control.
Public property Container Infrastructure.
Public property Count Gets the number of cells in the NamedRange control.
Public property CountLarge Gets the number of occurrences of the largest value in a range of values.
Public property Creator Gets a 32-bit integer that indicates the application in which the NamedRange control was created.
Public property CurrentArray If the NamedRange control is part of an array, gets a Microsoft.Office.Interop.Excel.Range that represents the entire array.
Public property CurrentRegion Gets a Microsoft.Office.Interop.Excel.Range that represents the current region.
Public property DataBindings Gets the collection of data-binding objects for this IBindableComponent. (Inherited from IBindableComponent.)
Public property DefaultDataSourceUpdateMode Gets or sets the default DataSourceUpdateMode.
Public property Dependents Gets a Microsoft.Office.Interop.Excel.Range that represents the range containing all the dependents of the NamedRange control.
Public property DirectDependents Gets a Microsoft.Office.Interop.Excel.Range that represents the range containing all the direct dependents of the NamedRange control.
Public property DirectPrecedents Gets a Microsoft.Office.Interop.Excel.Range that represents the range containing all the direct precedents of the NamedRange control.
Public property DisplayFormat Gets an object that represents the display settings for the specified range.
Public property End Gets a Microsoft.Office.Interop.Excel.Range that represents the cell at the end of the region that contains the NamedRange control.
Public property EntireColumn Gets a Microsoft.Office.Interop.Excel.Range that represents the entire column (or columns) that contains the NamedRange control.
Public property EntireRow Gets a Microsoft.Office.Interop.Excel.Range that represents the entire row (or rows) that contains the NamedRange control.
Public property Errors Gets an Errors object that enables you to access error checking options.
Public property Font Gets a Font that represents the font of the NamedRange control.
Public property FormatConditions Gets a FormatConditions collection that represents all the conditional formats for the NamedRange control.
Public property Formula Gets or sets the NamedRange control's formula in A1-style notation.
Public property FormulaArray Gets or sets the array formula of the NamedRange control.
Public property FormulaHidden Gets or sets a value that indicates whether the formula in the NamedRange control will be hidden when the worksheet is protected.
Public property FormulaLabel Gets or sets the formula label type for the NamedRange control.
Public property FormulaLocal Gets or sets the formula for the NamedRange control, using A1-style references in the language of the user.
Public property FormulaR1C1 Gets or sets the formula for the object, using R1C1-style notation.
Public property FormulaR1C1Local Gets or sets the formula for the NamedRange control, using R1C1-style notation in the language of the user.
Public property HasArray Gets a value that indicates whether the NamedRange control is part of an array formula.
Public property HasFormula Gets a value that indicates whether all cells in the NamedRange control contain formulas.
Public property Height Gets the height of the NamedRange control.
Public property Hidden Gets or sets an object that indicates whether the rows or columns are hidden.
Public property HorizontalAlignment Gets or sets the horizontal alignment for the NamedRange control.
Public property Hyperlinks Gets a Hyperlinks collection that represents the hyperlinks in the NamedRange control.
Public property ID Gets or sets the identifying label for the NamedRange control when the page is saved as a Web page.
Public property IndentLevel Gets or sets the indent level for the NamedRange control.
Public property InnerObject Gets a Microsoft.Office.Interop.Excel.Range that represents the underlying native object for the Microsoft.Office.Tools.Excel.NamedRange.
Public property Interior Gets an Interior that represents the interior of the NamedRange control.
Public property Item Gets a Microsoft.Office.Interop.Excel.Range that represents a range at an offset to the NamedRange control.
Public property Left Gets the distance from the left edge of column A to the left edge of the NamedRange control.
Public property ListHeaderRows Gets the number of header rows for the NamedRange control.
Public property ListObject Gets a Microsoft.Office.Interop.Excel.ListObject for the NamedRange control.
Public property LocationInTable Gets a constant that describes the part of the PivotTable report that contains the upper-left corner of the NamedRange control.
Public property Locked Gets or sets a value that indicates whether the NamedRange control is locked.
Public property MDX Gets the MDX name for the specified NamedRange object.
Public property MergeArea Gets a Microsoft.Office.Interop.Excel.Range that represents the merged range containing the NamedRange control.
Public property MergeCells Gets or sets a value that indicates whether the NamedRange control contains merged cells.
Public property Name Gets or sets a Name object for the NamedRange control.
Public property Next Gets a Microsoft.Office.Interop.Excel.Range that represents the next cell.
Public property NumberFormat Gets or sets the format code for the NamedRange control.
Public property NumberFormatLocal Gets or sets the format code for the NamedRange control in the language of the user.
Public property Offset Gets a Microsoft.Office.Interop.Excel.Range that is offset from the NamedRange control.
Public property Orientation Gets or sets the text orientation.
Public property OutlineLevel Gets or sets the current outline level of the NamedRange control.
Public property PageBreak Gets or sets the location of a page break.
Public property Parent Gets the parent object of the NamedRange control.
Public property Phonetic Gets the Phonetic object, which contains information about a specific phonetic text string in the NamedRange control.
Public property Phonetics Gets the Phonetics collection of the NamedRange control.
Public property PivotCell Gets a PivotCell that represents a cell in a PivotTable report.
Public property PivotField Gets a PivotField that represents the PivotTable field containing the upper left corner of the NamedRange control.
Public property PivotItem Gets a PivotItem that represents the PivotTable item containing the upper left corner of the NamedRange control.
Public property PivotTable Gets a PivotTable that represents the PivotTable report containing the upper left corner of the NamedRange control, or the PivotTable report associated with the PivotChart report.
Public property Precedents Gets a Microsoft.Office.Interop.Excel.Range that represents all the precedents of the NamedRange control.
Public property PrefixCharacter Gets the prefix character for the NamedRange control.
Public property Previous Gets a Microsoft.Office.Interop.Excel.Range that represents the previous cell.
Public property QueryTable Gets a QueryTable that represents the query table that intersects the NamedRange control.
Public property ReadingOrder Gets or sets the reading order for the NamedRange control.
Public property RefersTo Gets or sets the formula that the NamedRange control is defined to refer to, using A1-style notation.
Public property RefersToLocal Gets or sets the formula that the NamedRange control is defined to refer to, using A1-style notation in the language of the user.
Public property RefersToR1C1 Gets or sets the formula that the NamedRange control is defined to refer to, using R1C1-style notation.
Public property RefersToR1C1Local Gets or sets the formula that the NamedRange control is defined to refer to, using R1C1-style notation in the language of the user.
Public property RefersToRange Gets the Microsoft.Office.Interop.Excel.Range referred to by a NamedRange control.
Public property Resize Gets a resized Microsoft.Office.Interop.Excel.Range based on the NamedRange control.
Public property Row Gets the number of the first row of the first area in the NamedRange control.
Public property RowHeight Gets or sets the height of all the rows in the NamedRange control, measured in points.
Public property Rows Gets a Microsoft.Office.Interop.Excel.Range that represents one or more rows in the NamedRange control.
Public property ServerActions Gets the actions that can be performed on the Microsoft Office SharePoint server for a NamedRange object.
Public property ShowDetail Gets or sets an object that indicates whether the outline is expanded for the NamedRange control (so that the detail of the column or row is visible).
Public property ShrinkToFit Gets or sets a value that indicates whether text automatically shrinks to fit in the available column width.
Public property Site Gets or sets the ISite associated with the IComponent. (Inherited from IComponent.)
Public property SmartTags Gets a SmartTags object that represents the identifier for the NamedRange control. This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.
.
Public property SoundNote Infrastructure.
Public property SparklineGroups Gets an object that represents an existing group of sparklines from the specified range.
Public property Style Gets or sets a Style that represents the style of the NamedRange control.
Public property Summary Gets a value that indicates whether the range is an outlining summary row or column.
Public property Tag Gets or sets the object that contains data about the Tag control.
Public property Text Gets the text for the NamedRange control.
Public property Top Gets the distance, in points, from the top edge of row 1 (one) to the top edge of the NamedRange control.
Public property UseStandardHeight Gets or sets a value that indicates whether the row height of the NamedRange control equals the standard height of the sheet.
Public property UseStandardWidth Gets or sets a value that indicates whether the column width of the NamedRange control equals the standard width of the sheet.
Public property Validation Gets a Validation object that represents data validation for the NamedRange control.
Public property Value Gets or sets the value of the NamedRange control.
Public property Value2 Gets or sets the value of the NamedRange control.
Public property VerticalAlignment Gets or sets the vertical alignment of the NamedRange control.
Public property Width Gets the width of the NamedRange control in points.
Public property Worksheet Gets a Microsoft.Office.Interop.Excel.Worksheet that represents the worksheet that contains the NamedRange control.
Public property WrapText Gets or sets a value that indicates whether Microsoft Office Excel wraps the text in the NamedRange control.
Public property XPath Gets an XPath that represents the Xpath of the element mapped to the NamedRange control.

Top

Methods

  Name Description
Public method _PasteSpecial Infrastructure.
Public method _PrintOut Infrastructure.
Public method Activate Activates a single-cell NamedRange control.
Public method AddComment Adds a comment to the NamedRange control.
Public method AdvancedFilter Filters or copies data from a list based on a criteria range.
Public method AllocateChanges Performs a writeback operation for all edited cells in a named range based on an OLAP data source.
Public method ApplyNames Applies names to the cells in the NamedRange control.
Public method ApplyOutlineStyles Applies outlining styles to the NamedRange control.
Public method AutoComplete Gets an AutoComplete match from the list.
Public method AutoFill Automatically fills the cells in the NamedRange control.
Public method AutoFilter Filters a list using the AutoFilter.
Public method AutoFit Changes the width of the columns or the height of the rows in the NamedRange control to achieve the best fit.
Public method AutoFormat Automatically formats the NamedRange control, using a predefined format.
Public method AutoOutline Automatically creates an outline for the NamedRange control.
Public method BeginInit Signals the object that initialization is starting. (Inherited from ISupportInitialize.)
Public method BorderAround Adds a border to a NamedRange control and sets the Color, LineStyle, and Weight properties for the new border.
Public method BorderAround2 Adds a border to a NamedRange control and sets the Color, LineStyle, and Weight properties for the new border.
Public method Calculate Calculates the values of cells in a NamedRange control.
Public method CalculateRowMajorOrder Calculates a specific range of cells.
Public method CheckSpelling Checks the spelling of text in the NamedRange control.
Public method Clear Clears the entire NamedRange control.
Public method ClearComments Clears all cell comments from the NamedRange control.
Public method ClearContents Clears the formulas from the NamedRange control.
Public method ClearFormats Clears the formatting of the NamedRange control.
Public method ClearHyperlinks Removes all hyperlinks from the specified range.
Public method ClearNotes Clears notes from all the cells in the NamedRange control.
Public method ClearOutline Clears the outline for the NamedRange control.
Public method ColumnDifferences Gets a Microsoft.Office.Interop.Excel.Range that represents all the cells whose contents are different from the comparison cell in each column.
Public method Consolidate Consolidates data from multiple ranges on multiple worksheets into the NamedRange control.
Public method Copy Copies the contents of the NamedRange control to the specified range or to the Clipboard.
Public method CopyFromRecordset Copies the contents of an ADO or DAO recordset into a worksheet, beginning at the upper-left corner of the NamedRange control.
Public method CopyPicture Copies the NamedRange control to the Clipboard as a picture.
Public method CreateNames Creates names in the NamedRange control, based on text labels in the sheet.
Public method CreatePublisher Infrastructure.
Public method Cut Cuts the contents of the NamedRange control to the Clipboard or pastes it into a specified destination.
Public method DataSeries Creates a data series in the NamedRange control.
Public method Delete Deletes a dynamically created NamedRange control and removes it from the ControlCollection.
Public method DialogBox Displays a dialog box defined by a dialog box definition table on a Microsoft Office Excel 4.0 macro sheet.
Public method Dirty Designates the NamedRange control to be recalculated when the next recalculation occurs.
Public method DiscardChanges Discards all changes in the edited cells of the range.
Public method Dispose Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.)
Public method EditionOptions Infrastructure.
Public method EndInit Signals the object that initialization is complete. (Inherited from ISupportInitialize.)
Public method ExportAsFixedFormat Exports to a file of the specified format.
Public method FillDown Fills down from the top cell or cells in the NamedRange control to the bottom of the NamedRange control.
Public method FillLeft Fills left from the rightmost cell or cells in the NamedRange control.
Public method FillRight Fills right from the leftmost cell or cells in the NamedRange control.
Public method FillUp Fills up from the bottom cell or cells in the NamedRange control to the top of the range.
Public method Find Finds specific information in the NamedRange control, and returns a Microsoft.Office.Interop.Excel.Range object that represents the first cell where that information is found.
Public method FindNext Continues a search that was begun with the Find method.
Public method FindPrevious Continues a search that was begun with the Find method.
Public method FunctionWizard Starts the Function Wizard for the upper-left cell of the NamedRange control.
Public method get_Address Infrastructure. Use the Address property instead of this method.
Public method get_AddressLocal Infrastructure. Use the AddressLocal property instead of this method.
Public method get_Characters Infrastructure. Use the Characters property instead of this method.
Public method get_End Infrastructure. Use the End property instead of this method.
Public method get_Item Infrastructure. Use the Item property instead of this method.
Public method get_Offset Infrastructure. Use the Offset property instead of this method.
Public method get_Range Infrastructure.
Public method get_Resize Infrastructure. Use the Resize property instead of this method.
Public method get_Value Gets the value of the NamedRange control.
Public method GetEnumerator Gets an IEnumerator that can be used to iterate over the cells in the NamedRange control.
Public method GoalSeek Calculates the values necessary to achieve a specific goal.
Public method Group When the NamedRange control represents a single cell in a PivotTable field’s data range, the Group method performs numeric or date-based grouping in that field.
Public method Insert Inserts a cell or a range of cells into the NamedRange control and shifts other cells away to make space.
Public method InsertIndent Adds an indent to the NamedRange control.
Public method Justify Rearranges the text in the NamedRange control so that it fills the range evenly.
Public method ListNames Pastes a list of all displayed names onto the worksheet, beginning with the first cell in the NamedRange control.
Public method Merge Creates a merged cell from the NamedRange control.
Public method NavigateArrow Navigates a tracer arrow for the NamedRange control to the precedent, dependent, or error-causing cell or cells.
Public method NoteText Gets or sets the cell note associated with the cell in the upper-left corner of the NamedRange control.
Public method Parse Parses a range of data and breaks it into multiple cells.
Public method PasteSpecial Pastes the contents of a Microsoft.Office.Interop.Excel.Range object from the Clipboard into the NamedRange control.
Public method PrintOut Prints the NamedRange control.
Public method PrintOutEx Prints the object.
Public method PrintPreview Shows a preview of the NamedRange control as it would look when printed.
Public method RemoveDuplicates Removes duplicate values from a range of values.
Public method RemoveSubtotal Removes subtotals from the NamedRange control.
Public method Replace Replaces the specified characters in the NamedRange control with a new string.
Public method RowDifferences Gets a Microsoft.Office.Interop.Excel.Range object that represents all the cells whose contents are different from those of the comparison cell in each row.
Public method Run Infrastructure.
Public method Select Selects the NamedRange control.
Public method set_Item Infrastructure. Use the Item property instead of this method.
Public method set_Value Sets the value of the NamedRange control.
Public method SetPhonetic Creates Phonetic objects for all the cells in the NamedRange control.
Public method Show Scrolls through the contents of the active window to move the NamedRange control into view.
Public method ShowDependents Draws tracer arrows to the direct dependents of the NamedRange control.
Public method ShowErrors Draws tracer arrows through the precedents tree to the cell that is the source of the error, and returns the Microsoft.Office.Interop.Excel.Range object that contains that cell.
Public method ShowPrecedents Draws tracer arrows to the direct precedents of the NamedRange control.
Public method Sort Sorts the data in a NamedRange control.
Public method SortSpecial Uses East Asian sorting methods to sort the NamedRange control. For example, Japanese sorts in the order of the Kana syllabary. For more information, see the parameters list.
Public method Speak Causes the cells of the NamedRange control to be spoken in row order or column order.
Public method SpecialCells Gets a Microsoft.Office.Interop.Excel.Range object that represents all the cells that match the specified type and value.
Public method SubscribeTo Infrastructure.
Public method Subtotal Creates subtotals for the NamedRange control.
Public method Table Creates a data table based on input values and formulas that you define in a worksheet.
Public method TextToColumns Parses a column of cells that contain text into several columns.
Public method Ungroup Promotes the NamedRange control in an outline (that is, decreases its outline level).
Public method UnMerge Separates a merged area into individual cells.

Top

Events

  Name Description
Public event BeforeDoubleClick Occurs when a NamedRange control is double-clicked, before the default double-click action.
Public event BeforeRightClick Occurs when a NamedRange control is right-clicked, before the default right-click action.
Public event BindingContextChanged Infrastructure.
Public event Change Occurs when something changes in the NamedRange control.
Public event Deselected Occurs when selection moves from the NamedRange control to an area outside of the NamedRange control.
Public event Disposed Represents the method that handles the Disposed event of a component. (Inherited from IComponent.)
Public event Selected Occurs when the NamedRange control is selected.
Public event SelectionChange Occurs when the selection inside the NamedRange control changes.

Top

Remarks

For more information, see NamedRange Control.

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