Style Style 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 _Default _Default

Reserved for internal use.

AddIndent AddIndent AddIndent

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

Application Application Application

Returns an Application object that represents the Microsoft Excel application.

Borders Borders Borders

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

BuiltIn BuiltIn BuiltIn

True if the style is a built-in style.

Creator Creator Creator

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

Font Font Font

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

FormulaHidden FormulaHidden FormulaHidden

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

HorizontalAlignment HorizontalAlignment HorizontalAlignment

Returns or sets the horizontal alignment for the specified object.

IncludeAlignment IncludeAlignment IncludeAlignment

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

IncludeBorder IncludeBorder IncludeBorder

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

IncludeFont IncludeFont 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 IncludeNumber IncludeNumber

True if the style includes the NumberFormat property.

IncludePatterns IncludePatterns IncludePatterns

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

IncludeProtection IncludeProtection IncludeProtection

True if the style includes the FormulaHidden and Locked properties.

IndentLevel IndentLevel IndentLevel

Returns or sets the indent level for the style.

Interior Interior Interior

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

Locked Locked Locked

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

MergeCells MergeCells MergeCells

True if the style contains merged cells.

Name Name Name

Returns the name of the object.

NameLocal NameLocal NameLocal

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

NumberFormat NumberFormat NumberFormat

Returns or sets the format code for the object.

NumberFormatLocal NumberFormatLocal NumberFormatLocal

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

Orientation Orientation Orientation

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

Parent Parent Parent

Returns the parent object for the specified object.

ReadingOrder ReadingOrder ReadingOrder

Returns or sets the reading order for the specified object.

ShrinkToFit ShrinkToFit ShrinkToFit

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

Value Value Value

The name of the specified style.

VerticalAlignment VerticalAlignment VerticalAlignment

Returns or sets the vertical alignment of the specified object.

WrapText WrapText WrapText

True if Microsoft Excel wraps the text in the object.

Methods

Delete() Delete() Delete()

Deletes the object.

Applies to