GrapeCity.Xaml.SpreadSheet.Data
NamedStyles Property (Worksheet)
Example 


GrapeCity.Xaml.SpreadSheet.Data Namespace > Worksheet Class : NamedStyles Property
Gets or sets a collection of StyleInfo objects for this sheet.
Syntax
'Declaration
 
<DefaultValueAttribute()>
Public Property NamedStyles As StyleInfoCollection
'Usage
 
Dim instance As Worksheet
Dim value As StyleInfoCollection
 
instance.NamedStyles = value
 
value = instance.NamedStyles
[DefaultValue()]
public StyleInfoCollection NamedStyles {get; set;}

Property Value

The collection of StyleInfo objects for this sheet.
Example
This example uses the NamedStyles property.
gcSpreadSheet1.Sheets[0].NamedStyles.Add(new GrapeCity.Xaml.SpreadSheet.Data.StyleInfo() { Background = new SolidColorBrush(Windows.UI.Colors.Red), Name = "aaa", VerticalAlignment = GrapeCity.Xaml.SpreadSheet.Data.CellVerticalAlignment.Center } );
var style = new GrapeCity.Xaml.SpreadSheet.Data.StyleInfo();
gcSpreadSheet1.Sheets[0].Cells[0, 0].StyleName = "aaa";
gcSpreadSheet1.Sheets[0].Rows[7].StyleName = "aaa";
style.Background = new SolidColorBrush(Windows.UI.Colors.Blue);
style.BorderLeft = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
style.BorderTop = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
style.BorderRight = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
style.BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);    
//Style applied to a rule
var rule = GrapeCity.Xaml.SpreadSheet.Data.AverageRule.Create(GrapeCity.Xaml.SpreadSheet.Data.AverageConditionType.Above, style);
rule.Ranges = new GrapeCity.Xaml.SpreadSheet.Data.CellRange[] { new GrapeCity.Xaml.SpreadSheet.Data.CellRange(1, 0, 5, 1) };
gcSpreadSheet1.Sheets[0].ConditionalFormats.AddRule(rule);
gcSpreadSheet1.Sheets[0].Cells[2, 0].Value = 25;
gcSpreadSheet1.Sheets[0].Cells[1, 0].Value = 2;

private void button1_Click(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.Sheets[0].Cells[0, 0].ResetStyleName();            
        }
GcSpreadSheet1.Sheets(0).NamedStyles.Add(New GrapeCity.Xaml.SpreadSheet.Data.StyleInfo() With {.Background = New SolidColorBrush(Windows.UI.Colors.Red), .Name = "aaa", .VerticalAlignment = GrapeCity.Xaml.SpreadSheet.Data.CellVerticalAlignment.Center})
GcSpreadSheet1.Sheets(0).Cells(0, 0).StyleName = "aaa"
GcSpreadSheet1.Sheets(0).Rows(7).StyleName = "aaa"
Dim style As New GrapeCity.Xaml.SpreadSheet.Data.StyleInfo()
style.Background = New SolidColorBrush(Windows.UI.Colors.Blue)
style.BorderLeft = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
style.BorderTop = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
style.BorderRight = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
style.BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
'Style applied to a rule
Dim rule = GrapeCity.Xaml.SpreadSheet.Data.AverageRule.Create(GrapeCity.Xaml.SpreadSheet.Data.AverageConditionType.Above, Style)
rule.Ranges = New GrapeCity.Xaml.SpreadSheet.Data.CellRange() {New GrapeCity.Xaml.SpreadSheet.Data.CellRange(1, 0, 5, 1)}
GcSpreadSheet1.Sheets(0).ConditionalFormats.AddRule(rule)
GcSpreadSheet1.Sheets(0).Cells(2, 0).Value = 25
GcSpreadSheet1.Sheets(0).Cells(1, 0).Value = 2

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
GcSpreadSheet1.Sheets(0).Cells(0, 0).ResetStyleName()
End Sub
See Also

Reference

Worksheet Class
Worksheet Members