How can I display headers in crosstab?
4 Answers, 1 is accepted
0
Hi Teemee,
As explained in Understanding the CrossTab/Table/List report items help article - a row is either static or dynamic. A static row is not associated to a group. When the report runs, a static row renders once. Table headers and footers are static rows. Static rows display labels and totals. Thus to create a new header go through the following steps:
Regards,
Steve
the Telerik team
As explained in Understanding the CrossTab/Table/List report items help article - a row is either static or dynamic. A static row is not associated to a group. When the report runs, a static row renders once. Table headers and footers are static rows. Static rows display labels and totals. Thus to create a new header go through the following steps:
- Select the table's header
- From the context menu to insert a row above
- Merge the cell from the new header row
- Set the desired value/text
Regards,
Steve
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Andrew
Top achievements
Rank 1
answered on 08 Jul 2011, 03:05 PM
I have this same problem, unfortunately the solution doesn't appear to work.
I used the cross tab wizard.
I set up the datasource
I drag four columns into the "Detail values" box, two of these are DateTimes - let's call them dt1 and dt2
I drag dt1.date into the "row groups" box.
I finish the wizard.
I set the RowHeadersPrintOnEveryPage property on the crosstab to true.
I preview.
Headers only appear on the first page.
Here is the designer generated class part: - the code formatter hasn't done a good job though
I used the cross tab wizard.
I set up the datasource
I drag four columns into the "Detail values" box, two of these are DateTimes - let's call them dt1 and dt2
I drag dt1.date into the "row groups" box.
I finish the wizard.
I set the RowHeadersPrintOnEveryPage property on the crosstab to true.
I preview.
Headers only appear on the first page.
Here is the designer generated class part: - the code formatter hasn't done a good job though
partial
class
Report3
{
#region Component Designer generated code<br>
/// <summary><br>
/// Required method for telerik Reporting designer support - do not modify<br>
/// the contents of this method with the code editor.<br>
/// </summary><br>
private void InitializeComponent()<br>
{<br>
Telerik.Reporting.TableGroup tableGroup1 = new Telerik.Reporting.TableGroup();<br>
Telerik.Reporting.TableGroup tableGroup2 = new Telerik.Reporting.TableGroup();<br>
Telerik.Reporting.TableGroup tableGroup3 = new Telerik.Reporting.TableGroup();<br>
Telerik.Reporting.TableGroup tableGroup4 = new Telerik.Reporting.TableGroup();<br>
Telerik.Reporting.TableGroup tableGroup5 = new Telerik.Reporting.TableGroup();<br>
Telerik.Reporting.TableGroup tableGroup6 = new Telerik.Reporting.TableGroup();<br>
Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();<br> Telerik.Reporting.Drawing.StyleRule styleRule2 = new Telerik.Reporting.Drawing.StyleRule();<br> Telerik.Reporting.Drawing.DescendantSelector descendantSelector1 = new Telerik.Reporting.Drawing.DescendantSelector();<br> Telerik.Reporting.Drawing.StyleRule styleRule3 = new Telerik.Reporting.Drawing.StyleRule();<br> Telerik.Reporting.Drawing.DescendantSelector descendantSelector2 = new Telerik.Reporting.Drawing.DescendantSelector();<br> Telerik.Reporting.Drawing.StyleRule styleRule4 = new Telerik.Reporting.Drawing.StyleRule();<br> Telerik.Reporting.Drawing.DescendantSelector descendantSelector3 = new Telerik.Reporting.Drawing.DescendantSelector();<br> this.pageHeaderSection1 = new Telerik.Reporting.PageHeaderSection();<br> this.detail = new Telerik.Reporting.DetailSection();<br> this.sqlDataSource1 = new Telerik.Reporting.SqlDataSource();<br> this.pageFooterSection1 = new Telerik.Reporting.PageFooterSection();<br> this.textBox4 = new Telerik.Reporting.TextBox();<br> this.textBox3 = new Telerik.Reporting.TextBox();<br> this.textBox2 = new Telerik.Reporting.TextBox();<br> this.textBox1 = new Telerik.Reporting.TextBox();<br> this.textBox5 = new Telerik.Reporting.TextBox();<br> this.textBox6 = new Telerik.Reporting.TextBox();<br> this.textBox10 = new Telerik.Reporting.TextBox();<br> this.textBox9 = new Telerik.Reporting.TextBox();<br> this.textBox8 = new Telerik.Reporting.TextBox();<br> this.textBox7 = new Telerik.Reporting.TextBox();<br> this.crosstab1 = new Telerik.Reporting.Crosstab();<br> ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();<br> // <br> // pageHeaderSection1<br> // <br> this.pageHeaderSection1.Height = new Telerik.Reporting.Drawing.Unit(3D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.pageHeaderSection1.Name = "pageHeaderSection1";<br> // <br> // detail<br> // <br> this.detail.Height = new Telerik.Reporting.Drawing.Unit(5.264683723449707D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {<br> this.crosstab1});<br> this.detail.Name = "detail";<br> // <br> // sqlDataSource1<br> // <br> this.sqlDataSource1.ConnectionString = "ita.dlm.rpt.Properties.Settings.DELCIMDataDev";<br> this.sqlDataSource1.Name = "sqlDataSource1";<br> this.sqlDataSource1.Parameters.AddRange(new Telerik.Reporting.SqlDataSourceParameter[] {<br> new Telerik.Reporting.SqlDataSourceParameter("@eventid", System.Data.DbType.Int32, "1")});<br> this.sqlDataSource1.SelectCommand = "dbo.appSessionDetailsList";<br> this.sqlDataSource1.SelectCommandType = Telerik.Reporting.SqlDataSourceCommandType.StoredProcedure;<br> // <br> // pageFooterSection1<br> // <br> this.pageFooterSection1.Height = new Telerik.Reporting.Drawing.Unit(3D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.pageFooterSection1.Name = "pageFooterSection1";<br> // <br> // textBox4<br> // <br> this.textBox4.Name = "textBox4";<br> this.textBox4.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox4.StyleName = "Normal.TableHeader";<br> this.textBox4.Value = "roomname";<br> // <br> // textBox3<br> // <br> this.textBox3.Name = "textBox3";<br> this.textBox3.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox3.StyleName = "Normal.TableHeader";<br> this.textBox3.Value = "sessiontitle";<br> // <br> // textBox2<br> // <br> this.textBox2.Name = "textBox2";<br> this.textBox2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox2.StyleName = "Normal.TableHeader";<br> this.textBox2.Value = "endtime";<br> // <br> // textBox1<br> // <br> this.textBox1.Name = "textBox1";<br> this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox1.StyleName = "Normal.TableHeader";<br> this.textBox1.Value = "starttime";<br> // <br> // textBox5<br> // <br> this.textBox5.Name = "textBox5";<br> this.textBox5.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox5.StyleName = "Normal.TableGroup";<br> this.textBox5.Value = "=Fields.starttime.Date";<br> // <br> // textBox6<br> // <br> this.textBox6.Name = "textBox6";<br> this.textBox6.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox6.StyleName = "Normal.TableHeader";<br> this.textBox6.Value = "starttime Date";<br> // <br> // textBox10<br> // <br> this.textBox10.Name = "textBox10";<br> this.textBox10.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox10.StyleName = "Normal.TableBody";<br> this.textBox10.Value = "=Fields.roomname";<br> // <br> // textBox9<br> // <br> this.textBox9.Name = "textBox9";<br> this.textBox9.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox9.StyleName = "Normal.TableBody";<br> this.textBox9.Value = "=Fields.sessiontitle";<br> // <br> // textBox8<br> // <br> this.textBox8.Name = "textBox8";<br> this.textBox8.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox8.StyleName = "Normal.TableBody";<br> this.textBox8.Value = "=Fields.endtime";<br> // <br> // textBox7<br> // <br> this.textBox7.Name = "textBox7";<br> this.textBox7.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.textBox7.StyleName = "Normal.TableBody";<br> this.textBox7.Value = "=Fields.starttime";<br> // <br> // crosstab1<br> // <br> this.crosstab1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm)));<br> this.crosstab1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm)));<br> this.crosstab1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm)));<br> this.crosstab1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(4D, Telerik.Reporting.Drawing.UnitType.Cm)));<br> this.crosstab1.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)));<br> this.crosstab1.Body.SetCellContent(0, 0, this.textBox7);<br> this.crosstab1.Body.SetCellContent(0, 1, this.textBox8);<br> this.crosstab1.Body.SetCellContent(0, 2, this.textBox9);<br> this.crosstab1.Body.SetCellContent(0, 3, this.textBox10);<br> tableGroup1.ReportItem = this.textBox1;<br> tableGroup2.ReportItem = this.textBox2;<br> tableGroup3.ReportItem = this.textBox3;<br> tableGroup4.ReportItem = this.textBox4;<br> this.crosstab1.ColumnGroups.Add(tableGroup1);<br> this.crosstab1.ColumnGroups.Add(tableGroup2);<br> this.crosstab1.ColumnGroups.Add(tableGroup3);<br> this.crosstab1.ColumnGroups.Add(tableGroup4);<br> this.crosstab1.Corner.SetCellContent(0, 0, this.textBox6);<br> this.crosstab1.DataSource = this.sqlDataSource1;<br> this.crosstab1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {<br> this.textBox7,<br> this.textBox8,<br> this.textBox9,<br> this.textBox10,<br> this.textBox6,<br> this.textBox5,<br> this.textBox1,<br> this.textBox2,<br> this.textBox3,<br> this.textBox4});<br> this.crosstab1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.00010012308484874666D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.4000000953674316D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.crosstab1.Name = "crosstab1";<br> tableGroup6.Groupings.AddRange(new Telerik.Reporting.Data.Grouping[] {<br> new Telerik.Reporting.Data.Grouping("")});<br> tableGroup6.Name = "Detail";<br> tableGroup5.ChildGroups.Add(tableGroup6);<br> tableGroup5.Groupings.AddRange(new Telerik.Reporting.Data.Grouping[] {<br> new Telerik.Reporting.Data.Grouping("=Fields.starttime.Date")});<br> tableGroup5.Name = "starttime.Date";<br> tableGroup5.ReportItem = this.textBox5;<br> tableGroup5.Sortings.AddRange(new Telerik.Reporting.Data.Sorting[] {<br> new Telerik.Reporting.Data.Sorting("=Fields.starttime.Date", Telerik.Reporting.Data.SortDirection.Asc)});<br> this.crosstab1.RowGroups.Add(tableGroup5);<br> this.crosstab1.RowHeadersPrintOnEveryPage = true;<br> this.crosstab1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(20D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm));<br> this.crosstab1.StyleName = "Normal.TableNormal";<br> // <br> // Report3<br> // <br> this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {<br> this.pageHeaderSection1,<br> this.detail,<br> this.pageFooterSection1});<br> this.PageSettings.Landscape = false;<br> this.PageSettings.Margins.Bottom = new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.PageSettings.Margins.Left = new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.PageSettings.Margins.Right = new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.PageSettings.Margins.Top = new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;<br> this.Style.BackgroundColor = System.Drawing.Color.White;<br> styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> new Telerik.Reporting.Drawing.StyleSelector(typeof(Telerik.Reporting.Table), "Normal.TableNormal")});<br> styleRule1.Style.BackgroundColor = System.Drawing.Color.White;<br> styleRule1.Style.BorderColor.Default = System.Drawing.Color.Black;<br> styleRule1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;<br> styleRule1.Style.BorderWidth.Default = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Pixel);<br> styleRule1.Style.Color = System.Drawing.Color.Black;<br> styleRule1.Style.Font.Name = "Tahoma";<br> styleRule1.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point);<br> descendantSelector1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.Table)),<br> new Telerik.Reporting.Drawing.StyleSelector(typeof(Telerik.Reporting.ReportItem), "Normal.TableHeader")});<br> styleRule2.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> descendantSelector1});<br> styleRule2.Style.BorderColor.Default = System.Drawing.Color.Black;<br> styleRule2.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;<br> styleRule2.Style.BorderWidth.Default = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Pixel);<br> styleRule2.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;<br> descendantSelector2.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.Table)),<br> new Telerik.Reporting.Drawing.StyleSelector(typeof(Telerik.Reporting.ReportItem), "Normal.TableGroup")});<br> styleRule3.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> descendantSelector2});<br> styleRule3.Style.BorderColor.Default = System.Drawing.Color.Black;<br> styleRule3.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;<br> styleRule3.Style.BorderWidth.Default = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Pixel);<br> descendantSelector3.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.Table)),<br> new Telerik.Reporting.Drawing.StyleSelector(typeof(Telerik.Reporting.ReportItem), "Normal.TableBody")});<br> styleRule4.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {<br> descendantSelector3});<br> styleRule4.Style.BorderColor.Default = System.Drawing.Color.Black;<br> styleRule4.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;<br> styleRule4.Style.BorderWidth.Default = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Pixel);<br> styleRule4.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(14D, Telerik.Reporting.Drawing.UnitType.Point);<br> this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {<br> styleRule1,<br> styleRule2,<br> styleRule3,<br> styleRule4});<br> this.Width = new Telerik.Reporting.Drawing.Unit(20D, Telerik.Reporting.Drawing.UnitType.Cm);<br> this.Name = "Report3";<br> ((System.ComponentModel.ISupportInitialize)(this)).EndInit();<br><br> }<br> #endregion<br><br> private Telerik.Reporting.PageHeaderSection pageHeaderSection1;<br> private Telerik.Reporting.DetailSection detail;<br> private Telerik.Reporting.PageFooterSection pageFooterSection1;<br> private Telerik.Reporting.SqlDataSource sqlDataSource1;<br> private Telerik.Reporting.Crosstab crosstab1;<br> private Telerik.Reporting.TextBox textBox7;<br> private Telerik.Reporting.TextBox textBox8;<br> private Telerik.Reporting.TextBox textBox9;<br> private Telerik.Reporting.TextBox textBox10;<br> private Telerik.Reporting.TextBox textBox1;<br> private Telerik.Reporting.TextBox textBox2;<br> private Telerik.Reporting.TextBox textBox3;<br> private Telerik.Reporting.TextBox textBox4;<br> private Telerik.Reporting.TextBox textBox6;<br> private Telerik.Reporting.TextBox textBox5;<br> }
0
Hi Andrew,
We used the CrossTab demo report by extending it on several pages and the row header is displayed correctly as well. Did you intend to show the column headers by any chance (ColumnHeadersPrintOnEveryPage)? The CrossTab wizard template would generate headers for both row and column groups correctly, so the problem is not there. However in order for row headers to repeat, this would mean that the CrossTab is carried over horizontally i.e. the report width was not enough to fit on a single page and the rest of the columns were carried to the next page. Is that what is happening on your end?
Kind regards,
Steve
the Telerik team
We used the CrossTab demo report by extending it on several pages and the row header is displayed correctly as well. Did you intend to show the column headers by any chance (ColumnHeadersPrintOnEveryPage)? The CrossTab wizard template would generate headers for both row and column groups correctly, so the problem is not there. However in order for row headers to repeat, this would mean that the CrossTab is carried over horizontally i.e. the report width was not enough to fit on a single page and the rest of the columns were carried to the next page. Is that what is happening on your end?
Kind regards,
Steve
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
Andrew
Top achievements
Rank 1
answered on 12 Jul 2011, 12:21 PM
Hi Steve,
Thanks for your response.
ColumnHeadersPrintOnEveryPage is what i should have been using, thanks.
Obviously RowHeaders refers to the row headers where as column headers refers to the columns ... it was a long day
Andrew
Thanks for your response.
ColumnHeadersPrintOnEveryPage is what i should have been using, thanks.
Obviously RowHeaders refers to the row headers where as column headers refers to the columns ... it was a long day
Andrew