Style Property
TOC
Collapse the table of content
Expand the table of content

NamedRange.Style Property

 

Gets or sets a T:Microsoft.Office.Interop.Excel.Style that represents the style of the NamedRange control.

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

object Style { get; set; }

Property Value

Type: System.Object

A T:Microsoft.Office.Interop.Excel.Style that represents the style of the NamedRange control.

The following code example creates a new custom style that displays text vertically and then sets a NamedRange to use this style.

This example is for a document-level customization.

private void CreateStyle()
{
    Excel.Style verticalStyle = Globals.ThisWorkbook.Styles.Add(
        "Vertical Text");
    verticalStyle.Orientation = Excel.XlOrientation.xlVertical;

    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1"],
        "namedRange1");
    namedRange1.Style = verticalStyle;
    namedRange1.Value2 = "This text is vertical";
}
Return to top
Show:
© 2016 Microsoft