You can customize the style of header cells if you want to change the default appearance. Set the default style of the header cells by setting the DefaultStyle property in the RowHeader or ColumnHeader class. For more information on what can be set, refer to the StyleInfo object and the RowHeader and ColumnHeader objects in the Assembly Reference.
You can also change some of the properties of the SheetSkin class that customize the appearance of header cells and apply the skin the sheet. These properties include FlatRowHeader and FlatColumnHeader. For more information creating and applying skins, refer to Applying a Skin to a Sheet and Creating a Skin for Sheets.
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.
You can also set the grid lines around the header cells with the Border property.
This example code defines a style with new colors and applies it to the column header.
C# |
Copy Code
|
---|---|
// Define a new style. FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo(); darkstyle.BackColor = Color.Teal; darkstyle.ForeColor = Color.Yellow; darkstyle.Border = new FarPoint.Web.Spread.Border(Color.Crimson); // Apply the new style. FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle; |
VB |
Copy Code
|
---|---|
' Define a new style. Dim darkstyle As New FarPoint.Web.Spread.StyleInfo() darkstyle.BackColor = Color.Teal darkstyle.ForeColor = Color.Yellow darkstyle.Border = New FarPoint.Web.Spread.Border(Color.Crimson) ' Apply the new style. FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle |