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


Glossary Item Box

Gets or sets the name of the default style for the column header.

Syntax

Visual Basic (Declaration) 
Public Property DefaultStyleName As String
Visual Basic (Usage)Copy Code
Dim instance As ColumnHeader
Dim value As String
 
instance.DefaultStyleName = value
 
value = instance.DefaultStyleName
C# 
public string DefaultStyleName {get; set;}

Property Value

String containing the name of the style for this column header

Exceptions

ExceptionDescription
System.ArgumentExceptionSpecified style (NamedStyle object) could not be found in the collection

Remarks

When defining and applying a custom style to header cells, be sure to set the text alignment. The default renderer (without any style applied) centers the text; if you apply a style, and do not set the alignment, the text is left-aligned not centered.

Example

This example creates a column header and a style for the spreadsheet. The background color in the style is set to yellow, and is then applied to the column header so all the column headers then have a yellow background.

C#Copy Code
FarPoint.Web.Spread.ColumnHeader colhdr;
FarPoint.Web.Spread.NamedStyle mnstyle = New FarPoint.Web.Spread.NamedStyle();
mnstyle.Name = "fpstyle";
mnstyle.BackColor = Color.Yellow;
FpSpread1.NamedStyles.Add(mnstyle);
colhdr = FpSpread1.ActiveSheetView.ColumnHeader;
colhdr.DefaultStyleName = mnstyle.Name;
Visual BasicCopy Code
Dim colhdr As FarPoint.Web.Spread.ColumnHeader
Dim mnstyle As New FarPoint.Web.Spread.NamedStyle()
mnstyle.Name = "fpstyle"
mnstyle.BackColor = Color.Yellow
FpSpread1.NamedStyles.Add(mnstyle)
colhdr = FpSpread1.ActiveSheetView.ColumnHeader
colhdr.DefaultStyleName = mnstyle.Name

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.