-
Notifications
You must be signed in to change notification settings - Fork 1
5. Headers and Footers
Headers and Footers may be added as bands to as many as required.
teeGrid1.Footer.AddText("My Footer");
That will display a simple text footer on the grid with the text "My Footer".
Different Header and Footer types are available:
- Header - Standard Header text
- Columns Text - Set a text to head each column
- Simple Text - text with default grid content format
- Totals - Set total as count, sum, min, max, average
- Totals Header - Applies Totals type to column header
To add a standard Header: Example: Here we set some Brush aspects at the time of adding the Header:
Steema.TeeGrid.Format.Brush brush = teeGrid1.Headers.AddText("Header 1").Format.Brush;
brush.Show();
brush.Gradient.Show();
teeGrid1.Headers[1].Format.Font.Size = 14;
teeGrid1.Headers[1].Format.Font.Style = Steema.TeeGrid.Format.FontStyle.Bold;
If you wish to add column totals you require these usings:
using Steema.TeeGrid.Totals;
using Steema.TeeGrid.Data;
Then first add the header:
TotalsHeader theader = new TotalsHeader(teeGrid1.Headers);
Then add the calculation type:
ColumnCalculation columnCalc = ColumnCalculation.Sum; //or .count or .avg, etc
Then add the total type as a header or footer. As Header:
ColumnTotals cTotals = new ColumnTotals(teeGrid1.Headers); //or teeGrid1.Footer
As Footer:
ColumnTotals cTotals = new ColumnTotals(teeGrid1.Footer);
Then apply the calculation to the required column:
cTotals.Calculation.Add(teeGrid1.Columns[1], columnCalc);