GrapeCity.Xaml.SpreadSheet.Data
StyleName Property (Cell)
Example 


Gets or sets the custom style for the cell.
Syntax
'Declaration
 
<DefaultValueAttribute()>
Public Property StyleName As String
'Usage
 
Dim instance As Cell
Dim value As String
 
instance.StyleName = value
 
value = instance.StyleName
[DefaultValue()]
public string StyleName {get; set;}

Property Value

The custom style for the cell. The default value is an empty string, which means there is no custom style for the cell.
Example
This example uses the StyleName 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
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

Cell Class
Cell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options