RenderReport does not split Worksheets within a workbook

1 Answer 52 Views
Rendering Report Designer (standalone)
Jyothi
Top achievements
Rank 1
Jyothi asked on 23 Aug 2023, 10:55 PM

Hi,

We have a scenario where we need to render the report in multiple worksheets(sheets) within a excel (xlsx) file. We are successful in generating such report when rendered through the desktop client and also in Report Viewer, but when trying to generate the file using  Telerik.Reporting.Processing.ReportProcessor.RenderReport() method, the data is not splitted in to two sheets. Everything is rendered in single sheet.

The way I am rendering the report is simple - 

            var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
            var manager = new ReportConnectionStringManager(connectionString);
            ReportSource reportSource = manager.UpdateReportSource(uriReportSource);

            var result = reportProcessor.RenderReport("XLSX", reportSource, null);

and in the report design, we are using SplitWorksheetOnPageBreak property.

 

Please help us in achieving what we want. Is there any other way to render the report.

 

Thanks,

Jyothi

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Aug 2023, 02:51 PM

Hello Jyothi,

We discussed this case in a support ticket but I would also like to share the solution with the community since you have also created a forum post. Thus, I will copy my answer from the ticket in this thread.

The reason for the observed behavior is that when rendering with the ReportProcessor class, a hashtable of the device settings is sent in the last argument of the RenderReport method, and that overrides the setting that you have set in the report, even when you pass null.

Thus, you need to initialize a new hashtable to which you can add the SplitWorksheetOnPageBreak setting and then pass it to the RenderReport method, for example:

var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();          

var deviceInfo = new System.Collections.Hashtable();
deviceInfo.Add("SplitWorksheetOnPageBreak", true);

Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("XLSX", reportSource, deviceInfo);

I hope this will help, please let me know if you need further assistance.

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/.
Tags
Rendering Report Designer (standalone)
Asked by
Jyothi
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or