Spread for ASP.NET 7.0 Product Documentation
NamedStyles Property
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetStyleModel Class : NamedStyles Property


Glossary Item Box

Gets or sets the named styles collection for the model.

Syntax

Visual Basic (Declaration) 
Public Overridable Property NamedStyles As NamedStyleCollection
Visual Basic (Usage)Copy Code
Dim instance As DefaultSheetStyleModel
Dim value As NamedStyleCollection
 
instance.NamedStyles = value
 
value = instance.NamedStyles
C# 
public virtual NamedStyleCollection NamedStyles {get; set;}

Property Value

NamedStyleCollection object containing the collection of named styles

Remarks

When the NamedStyleCollection property is set, any named styles referenced in the model are reset to the named style in the new named styles collection with the same name, or reset to null if there is no named style in the new named styles collection with the same name.

Example

This example creates two NamedStyle object and adds the NamedStyle objects to the NamedStyleCollection. The number of NamedStyle in the collection is returned to a list box. By default, the NamedStyleCollection is shared among the style models.
C#Copy Code
private void Page_Load(object sender,System.EventArgs e)
{
if(this.IsPostBack)return;

FarPoint.Web.Spread.Model.DefaultSheetStyleModel model=(FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel;
FarPoint.Web.Spread.NamedStyle style=new FarPoint.Web.Spread.NamedStyle("Yellow");
style.BackColor=Color.Yellow;
FpSpread1.NamedStyles.Add(style);

FarPoint.Web.Spread.NamedStyle style1=new FarPoint.Web.Spread.NamedStyle("Red");
style1.BackColor=Color.Red;
FpSpread1.NamedStyles.Add(style1);

model.SetDirectName(0,0,"Yellow");
model.SetDirectName(0,2,"Red");

ListBox1.Items.Add(model.NamedStyles.Count.ToString());
}
Visual BasicCopy Code
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If(IsPostBack)Then Return

Dim model As FarPoint.Web.Spread.Model.DefaultSheetStyleModel=FpSpread1.Sheets(0).StyleModel

Dim style As New FarPoint.Web.Spread.NamedStyle("Yellow")
style.BackColor=Color.Yellow
FpSpread1.NamedStyles.Add(style)

Dim style1 As New FarPoint.Web.Spread.NamedStyle("Red")
style1.BackColor=Color.Red
FpSpread1.NamedStyles.Add(style1)

model.SetDirectName(0,0,"Yellow")
model.SetDirectName(0,2,"Red")

ListBox1.Items.Add(model.NamedStyles.Count.ToString())
End Sub

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.