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

Removing header when export to Excel

5 Answers 1682 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 17 Dec 2009, 11:12 PM
I would like to remove page header, report header, and both footer while exporting to Excel. Is there a way to do this?

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 18 Dec 2009, 06:48 AM
Hi Paul,

You cannot change the layout of a report or conditionally hide sections/items depending on the export format the report is rendered into. The excel export aims for a WYSIWYG representation of the report, and if you need only the report data than you can export to csv, where you can concentrate on the data only as shown in this KB article:Configuring the CSV Rendering Extension.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Manpreet
Top achievements
Rank 1
answered on 16 Oct 2015, 06:48 AM
Can we remove header and footer of the page using code behind file as we need excel format only and not the csv and that too without header and footers. Please help.
0
Nasko
Telerik team
answered on 20 Oct 2015, 02:45 PM
Hello Manpreet,

It is possible to modify the report definition before processing and rendering the report to XLSX. In this scenario you need to create the report object and modify its definition by removing the page header and page footer sections from the report items collection:
var report = new MyReport();
report.Items.RemoveByKey("pageHeaderSection1");
report.Items.RemoveByKey("pageFooterSection1");

Additional information is available in the Programmatic Control of Reports 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
Tommy
Top achievements
Rank 1
Iron
Iron
Iron
answered on 07 May 2021, 03:59 AM

Do we know if there is an easier way to do this now in the report designer?

Todor
Telerik team
commented on 11 May 2021, 11:31 AM | edited

Hello Tommy,

You may use Bindings or Conditional Formatting to hide the sections when the Global Object RenderingFormat is 'XLSX' and/or 'XLS'.
1
Jose
Top achievements
Rank 1
Iron
answered on 13 May 2021, 09:46 AM

Yes, you can do this using conditional formats.

On the page header, create a new Conditional Format.

 

Set the Filter as follows:

Expression: =RenderingFormat.Name

Operator: =

Value: XLSX

 

Then the in Style, untick Layout - Visible

Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Steve
Telerik team
Manpreet
Top achievements
Rank 1
Nasko
Telerik team
Tommy
Top achievements
Rank 1
Iron
Iron
Iron
Jose
Top achievements
Rank 1
Iron
Share this question
or