Edytuj

Udostępnij za pośrednictwem


Style Interface

Definition

Represents a style description for a range.

public interface class Style
[System.Runtime.InteropServices.Guid("00020852-0000-0000-C000-000000000046")]
[System.Runtime.InteropServices.InterfaceType(2)]
public interface Style
Public Interface Style
Attributes

Remarks

The Style object contains all style attributes (font, number format, alignment, and so on) as properties. There are several built-in styles, including Normal, Currency, and Percent. Using the Style object is a fast and efficient way to change several cell-formatting properties on multiple cells at the same time.

For the Workbook object, the Style object is a member of the Styles collection. The Styles collection contains all the defined styles for the workbook.

Use the Style property to return the Style object used with a Range object.

You can change the appearance of a cell by changing properties of the style applied to that cell. Keep in mind, however, that changing a style property will affect all cells already formatted with that style.

Use Styles(index), where index is the style index number or name, to return a single Style object from the workbook Styles collection.

Styles are sorted alphabetically by style name. The style index number denotes the position of the specified style in the sorted list of style names. Styles(1) is the first style in the alphabetic list, and Styles(Styles.Count) is the last one in the list.

For more information about creating and modifying a style, see the Styles object.

Properties

_Default

Reserved for internal use.

AddIndent

True if text is automatically indented when the text alignment in a cell is set to equal distribution either horizontally or vertically.

Application

Returns an Application object that represents the Microsoft Excel application.

Borders

Returns a Borders collection that represents the borders of a style.

BuiltIn

True if the style is a built-in style.

Creator

Returns a 32-bit integer that indicates the application in which this object was created.

Font

Returns a Font object that represents the font of the specified object.

FormulaHidden

True if the formula will be hidden when the worksheet is protected.

HorizontalAlignment

Returns or sets the horizontal alignment for the specified object.

IncludeAlignment

True if the style includes the AddIndent, HorizontalAlignment, VerticalAlignment, WrapText, and Orientation properties.

IncludeBorder

True if the style includes the Color, ColorIndex, LineStyle, and Weight border properties.

IncludeFont

True if the style includes the Background, Bold, Color, ColorIndex, FontStyle, Italic, Name, OutlineFont, Shadow, Size, Strikethrough, Subscript, Superscript, and Underline font properties.

IncludeNumber

True if the style includes the NumberFormat property.

IncludePatterns

True if the style includes the Color, ColorIndex, InvertIfNegative, Pattern, PatternColor, and PatternColorIndex interior properties.

IncludeProtection

True if the style includes the FormulaHidden and Locked properties.

IndentLevel

Returns or sets the indent level for the style.

Interior

Returns an Interior object that represents the interior of the specified object.

Locked

True if the object is locked; False if the object can be modified when the sheet is protected.

MergeCells

True if the style contains merged cells.

Name

Returns the name of the object.

NameLocal

Returns the name of the object in the language of the user.

NumberFormat

Returns or sets the format code for the object.

NumberFormatLocal

Returns or sets the format code for the object as a string in the language of the user.

Orientation

The text orientation. Can be an integer value from –90 to 90 degrees or one of the XlOrientation constants.

Parent

Returns the parent object for the specified object.

ReadingOrder

Returns or sets the reading order for the specified object.

ShrinkToFit

True if text automatically shrinks to fit in the available column width.

Value

The name of the specified style.

VerticalAlignment

Returns or sets the vertical alignment of the specified object.

WrapText

True if Microsoft Excel wraps the text in the object.

Methods

Delete()

Deletes the object.

Applies to