This is a migrated thread and some comments may be shown as answers.

Report Header with Dynamic Height

8 Answers 2922 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 30 Nov 2015, 08:21 PM

Hello,

1: I read that it is not possible to resize my report header at runtime. Is this true? I have text that sometimes wraps and other times doesn't, and I'd like to change the height of my report's header accordingly. Or is there a way to determine if the text will wrap, so I can reduce the font size until it will no longer wrap?

2 (assuming option 1 isn't possible): I've moved my header to the detail section, but now I would like for it to repeat on each page. My header consists of two textboxes.

Also, moving the header textboxes to the detail section creates another problem: sometimes, a seemingly random page break will be placed immediately after the textboxes. I'm assuming this is because I have placed a subreport immediately after the textboxes, and the subreport won't fit onto a single page. Does anyone know how I can force the subreport to display immediately below the textboxes?

Thanks!

8 Answers, 1 is accepted

Sort by
0
Accepted
Nasko
Telerik team
answered on 03 Dec 2015, 10:00 AM
Hello Ryan,

1. It is not possible to resize the Page Header section at run-time. Other report sections can be resized at run-time, such as the Report Header section. For more information, please refer to the Report Structure help article. Also, there is no option to determine if the text will wrap using the built-in Reporting features.

2. You can place the text boxes inside a static Group Header section and set the section's PrintOnEveryPage property to True.
The SubReport will be kept together on a single page if its KeepTogether property is set to True. To keep the SubReport and the TextBox items together you will need to nest them inside a single Panel item and set the Panel.KeepTogether = True. For more information, please check the Understanding Pagination help article.

Regards,
Nasko
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 09 Dec 2015, 08:27 PM

Thanks, Nasko!

This took me a bit to figure out, so here's instructions for anyone else trying to accomplish this:
1. Right click somewhere on the outside of your report (outside of the header/detail/footer section) and click 'Add New Group' and press OK (don't even press New).

2. You now have a groupHeaderSection and groupFooterSection. Add stuff to your groupHeaderSection, set the PrintOnEveryPage property to true, and set the Visible property of groupFooterSection to false.

0
Franklin
Top achievements
Rank 1
answered on 11 Feb 2016, 07:58 PM

Hi Nasko,

I'm having a hard time setting the size of my ReportHeader (NOT PAGE HEADER) at runtime so it will grow to fit the content. Sometimes the report has more content than others so I'm setting the visibility of items in the report header appropriately. My problem is when I programatically set reportHeaderSection1.Height = Unit.Mm(1) the Report Header is the same size as it would be if the items were visible. I've also tried binding the Height of the ReportHeader to "1px" as stated in the documentation but same results. What am I doing wrong?

 

Thanks,

Franklin

0
Nasko
Telerik team
answered on 16 Feb 2016, 09:50 AM
Hello Franklin,

You can set the height of the report header in the report constructor to:
this.reportHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Pixel(1);

The report header will be resized at run-time to accommodate its items, regardless of their height.

Regards,
Nasko
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Franklin
Top achievements
Rank 1
answered on 16 Feb 2016, 01:24 PM

Nasko,

Thanks for your reply, but I have tried this and still find the report header remains the same height even when its items are set to invisible by bindings. My report header has an image and three lists. Two of the lists which are next to each other horizontally at the bottom of the report header are made to be invisible when certain data items are Null. This is working as expected. I've also set the reportHeaderSection1.Height property as you suggested as well as setting the Height property for both of the lists which may or may not be there. I am still finding the reportHeaderSection1 to be the same size as if the lists were still visible. Not only in the reportHeaderSection1 but in other areas of my report I am finding this same behavior. Please advise where I might be going wrong as this is holding up my project while I try and find a solution.

 Thanks,

 Franklin

0
Franklin
Top achievements
Rank 1
answered on 16 Feb 2016, 01:36 PM

Nasko,

 Please disregard the last post. I found my problem. Even though the lists were not visible my visibility bindings had disappeared for some reason. I'm having better success now.

 Thanks,

Franklin

0
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
answered on 19 Sep 2018, 01:25 PM
[quote]Franklin said:

Hi Nasko,

I'm having a hard time setting the size of my ReportHeader (NOT PAGE HEADER) at runtime so it will grow to fit the content. Sometimes the report has more content than others so I'm setting the visibility of items in the report header appropriately. My problem is when I programatically set reportHeaderSection1.Height = Unit.Mm(1) the Report Header is the same size as it would be if the items were visible. I've also tried binding the Height of the ReportHeader to "1px" as stated in the documentation but same results. What am I doing wrong?

 

Thanks,

Franklin

[/quote]

 

This is not a feature of Telerik Reporting.  We need the same thing for multi column reports.

Please see this enhancement request:  Page Header Band that Grows/Shrink based on controls in it


0
Maxime
Top achievements
Rank 1
answered on 19 Feb 2019, 06:50 PM

Hi my solution:

 

private void pageHeaderSection_ItemDataBound(object sender, EventArgs e)
{
  var company_Logo = (sender as Telerik.Reporting.Processing.ProcessingElement).DataObject["company_Logo"];

  pageHeaderSection.Height = new Unit(company_Logo == null ? 0.75 : 1.7, UnitType.Inch);
}

Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Ryan
Top achievements
Rank 1
Franklin
Top achievements
Rank 1
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Maxime
Top achievements
Rank 1
Share this question
or