Creating Multiple Headers
Spread WinRT Documentation > Developer's Guide > Managing the User Interface > Creating Multiple Headers

You can display multiple column and row headers and specify whether to show letters, numbers, or nothing in the default header. You can also put custom text in the headers.

Clicking on a header will select that row or column by default. You can also resize a column or row by moving the mouse pointer over the line at the edge of a header. The mouse pointer changes to a double arrow and you can then drag the column or row to the new width or height.

You can use the AutoTextIndex and AutoText properties in code to change the default header text.

Using Code

This example creates multiple headers and cell spans.

CS
Copy Code
gcSpreadSheet1.Sheets[0].RowCount = 10;
gcSpreadSheet1.Sheets[0].ColumnCount = 8;
gcSpreadSheet1.Sheets[0].ColumnHeader.RowCount = 3;
gcSpreadSheet1.Sheets[0].RowHeader.ColumnCount = 2;
gcSpreadSheet1.Sheets[0].RowHeader.AutoTextIndex = 1;
gcSpreadSheet1.Sheets[0].RowHeader.AutoText = GrapeCity.Xaml.SpreadSheet.Data.HeaderAutoText.Letters;
gcSpreadSheet1.Sheets[0].ColumnHeader.AutoTextIndex = 2;
gcSpreadSheet1.Sheets[0].ColumnHeader.AutoText = GrapeCity.Xaml.SpreadSheet.Data.HeaderAutoText.Numbers;
gcSpreadSheet1.Sheets[0].AddSpanCell(0, 0, 2, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader);
gcSpreadSheet1.Sheets[0].SetValue(0, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "State");
gcSpreadSheet1.Sheets[0].AddSpanCell(0, 1, 1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader);
gcSpreadSheet1.Sheets[0].SetValue(0, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Company");
gcSpreadSheet1.Sheets[0].AddSpanCell(0, 3, 1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader);
gcSpreadSheet1.Sheets[0].SetValue(0, 3, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Category");
gcSpreadSheet1.Sheets[0].AddSpanCell(0, 5, 1, 3, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader);
gcSpreadSheet1.Sheets[0].SetValue(0, 5, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Products");
gcSpreadSheet1.Sheets[0].SetValue(1, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "GC");
gcSpreadSheet1.Sheets[0].SetValue(1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "MS");
gcSpreadSheet1.Sheets[0].SetValue(1, 3, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "License");
gcSpreadSheet1.Sheets[0].SetValue(1, 4, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Activate");
gcSpreadSheet1.Sheets[0].SetValue(1, 5, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Win");
gcSpreadSheet1.Sheets[0].SetValue(1, 6, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Web");
gcSpreadSheet1.Sheets[0].SetValue(1, 7, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "XAML");
gcSpreadSheet1.Sheets[0].AddSpanCell(0, 0, 3, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader);
gcSpreadSheet1.Sheets[0].AddSpanCell(3, 0, 3, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader);
gcSpreadSheet1.Sheets[0].AddSpanCell(6, 0, 3, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader);
gcSpreadSheet1.Sheets[0].AddSpanCell(9, 0, 1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader);
gcSpreadSheet1.Sheets[0].SetValue(0, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, ".NET");
gcSpreadSheet1.Sheets[0].SetValue(3, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, "Java");
gcSpreadSheet1.Sheets[0].SetValue(6, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, "HTML");
gcSpreadSheet1.Sheets[0].SetValue(9, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, "Total:");
VB
Copy Code
GcSpreadSheet1.Sheets(0).RowCount = 10
GcSpreadSheet1.Sheets(0).ColumnCount = 8
GcSpreadSheet1.Sheets(0).ColumnHeader.RowCount = 3
GcSpreadSheet1.Sheets(0).RowHeader.ColumnCount = 2
GcSpreadSheet1.Sheets(0).RowHeader.AutoTextIndex = 1
GcSpreadSheet1.Sheets(0).RowHeader.AutoText = GrapeCity.Xaml.SpreadSheet.Data.HeaderAutoText.Letters
GcSpreadSheet1.Sheets(0).ColumnHeader.AutoTextIndex = 2
GcSpreadSheet1.Sheets(0).ColumnHeader.AutoText = GrapeCity.Xaml.SpreadSheet.Data.HeaderAutoText.Numbers
GcSpreadSheet1.Sheets(0).AddSpanCell(0, 0, 2, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader)
GcSpreadSheet1.Sheets(0).SetValue(0, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "State")
GcSpreadSheet1.Sheets(0).AddSpanCell(0, 1, 1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader)
GcSpreadSheet1.Sheets(0).SetValue(0, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Company")
GcSpreadSheet1.Sheets(0).AddSpanCell(0, 3, 1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader)
GcSpreadSheet1.Sheets(0).SetValue(0, 3, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Category")
GcSpreadSheet1.Sheets(0).AddSpanCell(0, 5, 1, 3, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader)
GcSpreadSheet1.Sheets(0).SetValue(0, 5, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Products")
GcSpreadSheet1.Sheets(0).SetValue(1, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "GC")
GcSpreadSheet1.Sheets(0).SetValue(1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "MS")
GcSpreadSheet1.Sheets(0).SetValue(1, 3, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "License")
GcSpreadSheet1.Sheets(0).SetValue(1, 4, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Activate")
GcSpreadSheet1.Sheets(0).SetValue(1, 5, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Win")
GcSpreadSheet1.Sheets(0).SetValue(1, 6, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "Web")
GcSpreadSheet1.Sheets(0).SetValue(1, 7, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.ColumnHeader, "XAML")
GcSpreadSheet1.Sheets(0).AddSpanCell(0, 0, 3, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader)
GcSpreadSheet1.Sheets(0).AddSpanCell(3, 0, 3, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader)
GcSpreadSheet1.Sheets(0).AddSpanCell(6, 0, 3, 1, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader)
GcSpreadSheet1.Sheets(0).AddSpanCell(9, 0, 1, 2, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader)
GcSpreadSheet1.Sheets(0).SetValue(0, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, ".NET")
GcSpreadSheet1.Sheets(0).SetValue(3, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, "Java")
GcSpreadSheet1.Sheets(0).SetValue(6, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, "HTML")
GcSpreadSheet1.Sheets(0).SetValue(9, 0, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.RowHeader, "Total:")
See Also