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 stylesWhen 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.
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 |
---|---|
privatevoidPage_Load(objectsender,System.EventArgse) { if(this.IsPostBack)return; FarPoint.Web.Spread.Model.DefaultSheetStyleModelmodel=(FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel; FarPoint.Web.Spread.NamedStylestyle=newFarPoint.Web.Spread.NamedStyle("Yellow"); style.BackColor=Color.Yellow; FpSpread1.NamedStyles.Add(style); FarPoint.Web.Spread.NamedStylestyle1=newFarPoint.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 Basic | Copy Code |
---|---|
PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load If(IsPostBack)ThenReturn DimmodelAsFarPoint.Web.Spread.Model.DefaultSheetStyleModel=FpSpread1.Sheets(0).StyleModel DimstyleAsNewFarPoint.Web.Spread.NamedStyle("Yellow") style.BackColor=Color.Yellow FpSpread1.NamedStyles.Add(style) Dimstyle1AsNewFarPoint.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()) EndSub |
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family