HTML5 ReportViewer CSV export

2 Answers 12 Views
Report Viewer - HTML5 Report Viewer - HTML5 WebForms
Todd
Top achievements
Rank 1
Iron
Todd asked on 06 Jan 2025, 10:56 PM | edited on 07 Jan 2025, 11:08 AM

As the default CSV export contains unwanted text, I'm trying to have a cleaner CSV export through HTML5 Report Viewer by using CSV device settings. However, the option NoStaticText won't apply to the CSV export correctly. The Textbox and its data under pageHeaderSection still shows in the CSV as columns

https://docs.telerik.com/reporting/knowledge-base/configuring-the-csv-rendering-extension

How do I prevent those Textbox/label and value from the reportHeaderSection from showing in the CSV export?

Thanks.

2 Answers, 1 is accepted

Sort by
1
Accepted
Dimitar
Telerik team
answered on 07 Jan 2025, 02:49 PM

Hello Todd,

Thank you for the attached screenshots!

We discussed this case in a ticket thread but I would also like to share the response here so that it may be of help to other users as well.

The CSV rendering extension is a little different from the other rendering formats in the way that it tries to output all of the report data. In other formats such as Excel, we could hide the textbox items in the report header section when we render to that format with a binding on the Visible property but for the CSV rendering, even if the item is hidden, its data will still be present in the CSV output.

For more information about the CSV rendering extension, I recommend visiting the CSV Rendering Design Considerations at a glance - Telerik Reporting article.

Considering the above, there are two options that you may choose from to exclude these items from the CSV export:

  • Move the items into the Page Header section of the report instead as this section is ignored in the CSV rendering
  • Create a second report that looks exactly like the current one but remove those items from the report header, and export the second report only when the export format is CSV

The second approach would be harder to implement since you are using a web report viewer and you will need to listen to its export events and substitute the report to be exported to when the format is CSV.

If you choose to give this approach a try, please have a look at the Replace report when exporting from Html5 Viewer - Telerik Reporting KB article as most if not the whole requirement is included in its example.

I hope that the provided information and suggestions will help achieve the desired result. Let me know if I can assist with anything else.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Todd
Top achievements
Rank 1
Iron
commented on 08 Jan 2025, 11:22 AM

Thank you Dimitar for the detail solution. It is helpful to my current issue.

On the side note just in case others may need. Couple things I did to achieve what I need is to Move those textbox to PageHeader, expression for Visibility of some of the textboxes and set NoStaticText within the report trdp file itself to get the report display correctly as well as XLS, CSV export.
0
Todd
Top achievements
Rank 1
Iron
answered on 08 Jan 2025, 11:23 AM
Thank you Dimitar for the detail solution. It is helpful to my current issue.

On the side note just in case others may need. Couple things I did to achieve what I need is to Move those textbox to PageHeader, expression for Visibility of some of the textboxes and set NoStaticText within the report trdp file itself to get the report display correctly as well as XLS, CSV export.
Tags
Report Viewer - HTML5 Report Viewer - HTML5 WebForms
Asked by
Todd
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Todd
Top achievements
Rank 1
Iron
Share this question
or