NamedRange.Style Property (2007 System)
Gets or sets a Style that represents the style of the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public Property Style As Object
'Usage
Dim instance As NamedRange
Dim value As Object
value = instance.Style
instance.Style = value
[BrowsableAttribute(false)]
public Object Style { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ Style {
Object^ get ();
void set (Object^ value);
}
public function get Style () : Object
public function set Style (value : Object)
Property Value
Type: System.Object
A Style that represents the style of the NamedRange control.
Examples
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 Sub CreateStyle()
Dim verticalStyle As Excel.Style = _
Globals.ThisWorkbook.Styles.Add("Vertical Text")
verticalStyle.Orientation = Excel.XlOrientation.xlVertical
Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
= Me.Controls.AddNamedRange(Me.Range("A1"), _
"namedRange1")
namedRange1.Style = verticalStyle
namedRange1.Value2 = "This text is vertical"
End Sub
private void CreateStyle()
{
Excel.Style verticalStyle = Globals.ThisWorkbook.Styles.Add(
"Vertical Text", missing);
verticalStyle.Orientation = Excel.XlOrientation.xlVertical;
Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
this.Controls.AddNamedRange(this.Range["A1", missing],
"namedRange1");
namedRange1.Style = verticalStyle;
namedRange1.Value2 = "This text is vertical";
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.