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

Straight to Excel

6 Answers 785 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
kelly moore
Top achievements
Rank 1
kelly moore asked on 18 Nov 2008, 02:37 PM
I am looking for a way to export data to Excel without having to view a report. Is it possible to bypass the report and output straight to Excel?

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 18 Nov 2008, 03:39 PM
Hello Kelly,

You can review this KB article that elaborates on the matter: Exporting a report to PDF programmatically. The first argument of the Telerik.Reporting.Processing.ReportProcessor.Render() method is the rendering extension to be used. In your case it would be XLS instead of PDF.

Regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
kelly moore
Top achievements
Rank 1
answered on 18 Nov 2008, 04:21 PM
Works perfect. Thank you!
0
Patrick
Top achievements
Rank 1
answered on 02 Oct 2012, 09:52 PM
Not for me, all I'm getting is this:

late" type="text/x-jquery-tmpl">

${Title} Delete bookmark

 

0
Steve
Telerik team
answered on 03 Oct 2012, 07:31 AM
Hello Patrick,

This forum post is about 4 years old. The suggested method Render is now obsolete and a quick look at the documentation (Exporting Report Programmatically) and API would show you how to use the new RenderReport method.
If you continue to have problems, please elaborate where do you get this? Have you tried on another report or it's happening on a specific report? Have you tried exporting to the OpenXML format i.e. use XLSX as argument of the RenderReport method.

If you need further help, it would be best to open a support ticket and attach a sample runnable project that exhibits the problem.

Greetings,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Patrick
Top achievements
Rank 1
answered on 03 Oct 2012, 01:38 PM
I've viewed the code in the KB article you mentioned. Do you have an example of using this same methodology to stream the exported .xls file to the user from a web application with the "Open", "Save" dialog?

Thanks,

--Patrick
0
Patrick
Top achievements
Rank 1
answered on 03 Oct 2012, 04:10 PM
Never mind my request for an example. I believe I've got it figured out. Bear in mind that we're using Telerik Report v.5.3.11.1222 (Q3 2011) in this project. I'm posting this in case someone else runs into a similar situation:

using (IReportDocument reportDocument = new BCRDetailReport(budgetCode, cbcCode, cbaCode, bcrStatus))
{
  ReportProcessor reportProcessor = new ReportProcessor();
  RenderingResult result = reportProcessor.RenderReport("XLS", reportDocument, null);
  string outputFile = string.Format("{0}.{1}", result.DocumentName, result.Extension);
  Response.Clear();
  Response.ContentType = result.MimeType;
  Response.Cache.SetCacheability(HttpCacheability.Private);
  Response.Expires = -1;
  Response.Buffer = true;
  Response.AddHeader("Content-Disposition", string.Format("{0};filename=\"{1}\"", "attachment", outputFile));
  Response.BinaryWrite(result.DocumentBytes);
  HttpContext.Current.ApplicationInstance.CompleteRequest();
}



Tags
General Discussions
Asked by
kelly moore
Top achievements
Rank 1
Answers by
Steve
Telerik team
kelly moore
Top achievements
Rank 1
Patrick
Top achievements
Rank 1
Share this question
or