Monday, September 08, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Appearance » Headers

Previous Customizing the Appearance of Headers Next

You can control the appearance of header cells.

  Back to Top
 Customize the Style of Header Cells
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. You can also customize many of the header appearance properties by setting the properties of the Columns.DefaultColumn class and the Rows.DefaultRow class. You can also set the grid lines around the header cells to change the three-dimensional appearance.

// Defines a style with new colors and applies it to the column header.
FarPoint.Win.Spread.StyleInfo darkStyle = new FarPoint.Win.Spread.StyleInfo();
darkStyle.BackColor = Color.Teal;
darkStyle.ForeColor = Color.Yellow;
// apply new style
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = darkStyle;

' Defines a style with new colors and applies it to the column header.
Dim darkStyle As New FarPoint.Win.Spread.StyleInfo()
darkStyle.BackColor = Color.Teal
darkStyle.ForeColor = Color.Yellow
' apply new style
FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = darkStyle


  Back to Top
 Showing or Hiding Headers
By default, Spread displays column headers and row headers. If you prefer, you can turn them off, and hide from view the row headers or column headers or both. If the sheet has multiple headers, you can hide specific rows or columns within a header,

// Turn off display of column headers
fpSpread1.Sheets[0].ColumnHeader.Visible = false;

' Turn off display of column headers
FpSpread1.Sheets(0).ColumnHeaderVisible = False


  Back to Top
 Customizing the Default Header Labels
By default the control displays sequential letters in the bottom row of the column header and sequentially increasing numbers in the right-most column of the row header. If your sheet displays multiple column header rows or row header columns, you can specify which column or row displays these default labels. You can also display no default labels. You can also set the number (or letter) at which to start the sequential numbering (or lettering) of the labels. You can also choose to display custom text in the headers instead of or in addition to the automatic label text.

// Set the column header to display numbers instead of letters
fpSpread1.Sheets[0].ColumnHeaderAutoText = FarPoint.Win.Spread.HeaderAutoText.Numbers;

' Set the column header to display numbers instead of letters
FpSpread1.Sheets(0).ColumnHeaderAutoText = FarPoint.Win.Spread.HeaderAutoText.Numbers


  Back to Top
 Customizing Header Label Text
By default the control displays letters in the column headers and numbers in the row headers. Besides this automatic text, you can add labels to any or all of the header cells.

// Set custom text for first two column headers
fpSpread1.Sheets[0].ColumnHeader.Columns[0].Label = "North";
fpSpread1.Sheets[0].ColumnHeader.Columns[1].Label = "South";

' Set custom text for first two column headers
FpSpread1.Sheets(0).ColumnHeader.Columns(0).Label = "North"
FpSpread1.Sheets(0).ColumnHeader.Columns(1).Label = "South"


  Back to Top
 Creating a Header with Multiple Rows or Columns
You can provide multiple rows in the column header and multiple columns in the row header. The headers can have different numbers of columns and rows.

// Set the number or rows and columns in the headers
fpSpread1.Sheets[0].ColumnHeaderRowCount = 2;
fpSpread1.Sheets[0].RowHeaderColumnCount = 2;

' Set the number or rows and columns in the headers
FpSpread1.Sheets(0).ColumnHeaderRowCount = 2
FpSpread1.Sheets(0).RowHeaderColumnCount = 2


  Back to Top
 Creating a Span in a Header
You can create cell spans in a header, for example, to make a header for multiple columns or rows, or both.

// Span two column header cells
fpSpread1.Sheets[0].AddColumnHeaderSpanCell(1, 0, 1, 2);
fpSpread1.Sheets[0].AddColumnHeaderSpanCell(0, 0, 1, 8);
fpSpread1.Sheets[0].AddRowHeaderSpanCell(0, 0, 12, 1);

' Span two column header cells
FpSpread1.Sheets(0).AddColumnHeaderSpanCell(1, 0, 1, 2)
FpSpread1.Sheets(0).AddColumnHeaderSpanCell(0, 0, 1, 8)
FpSpread1.Sheets(0).AddRowHeaderSpanCell(0, 0, 12, 1)


Previous Customizing the Appearance of Headers Next


    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
Learn about the new Roadshow now!

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.