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

Telerik report vs spreadsheet streaming

5 Answers 212 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
herb
Top achievements
Rank 1
Veteran
Iron
herb asked on 10 Mar 2021, 06:46 PM

Current project uses the Telerik Report library.

I've been working with the Documents.SpreadsheetStream and Documents.Spreadsheet methods to by-pass the report templates. Finding my design plan has run into a design issue when exporting directly to excel. In the Templates can create a much richer view for the end-user.

However the customer wants to export directly to Excel with out having to view the report then click on the export button. (See the attach jpg file for screen shot of the current interface). I think I will add both options for the end user to select view or export,  just incase they rather not have the file. Or if another customer prefers the view...

My question, Can I run the process to run the Telerik report template I created and pass all parameter that will cause the export to Excel directly?

 

5 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 15 Mar 2021, 09:42 AM

Hi Herb,

You may export the report programmatically with the ReportProcessor class. Check the article Embedded Report Engine for more details and sample code. For example, you may trigger the rendering logic on a button click. You need to use the rendering extension 'XLSX' - see the Rendering Extensions article.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
herb
Top achievements
Rank 1
Veteran
Iron
answered on 15 Mar 2021, 02:16 PM

Thank you Todor,

This will take me awhile to study your response.

0
herb
Top achievements
Rank 1
Veteran
Iron
answered on 15 Mar 2021, 04:12 PM

Completed a test. The sample was not as clear as I expected. Not sure what

var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); // set any deviceInfo settings if necessaryvar deviceInfo = new System.Collections.Hashtable();

 

Was trying say being that I am already setting up the report details and expecting to got directly to print. With that said I completed my code changes and it appears to work. However

01.// set any deviceInfo settings if necessary
02.                            var deviceInfo = new System.Collections.Hashtable();
03. 
04.                            var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
05. 
06.                            ////                  -3-
07.                            //// ***Instance of the report definition***
08.                            var reportSource = _vmLocator.ReportViewerVM.CurrentReport;
09. 
10.                            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("XLS", reportSource, deviceInfo);
11. 
12.                            string fileName = result.DocumentName + "." + result.Extension;
13.                            string path = System.IO.Path.GetTempPath();
14.                            string filePath = System.IO.Path.Combine(path, fileName);
15. 
16.                            using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
17.                            {
18.                                fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
19.                            }

at line 10, "reportProcessor.RenderReport" errors not accepting "XLSX" as a possible format. I'm running Telerik.Reporting version 15.0.21.224. I want to use the XLSX format if at all possible.

 

0
Accepted
Todor
Telerik team
answered on 18 Mar 2021, 08:03 AM

Hello Herb,

The XLSX format is an OpenXML format and requires additional assembly references. Check the article section Deploying Open XML for more details.

Regards,
Todor
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
herb
Top achievements
Rank 1
Veteran
Iron
answered on 18 Mar 2021, 02:37 PM
Thank you Todor, made note in the Third-Party Dependencies article to be linked with the Rendering Extensions article to be more complete.
Tags
General Discussions
Asked by
herb
Top achievements
Rank 1
Veteran
Iron
Answers by
Todor
Telerik team
herb
Top achievements
Rank 1
Veteran
Iron
Share this question
or