ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Export Crystal Report to PDF Without opening Report file in ASP.Net MVC<p>Hi&nbsp;<a class="username" rel="varun.p">varun.p,</a></p> <p>Refer below article for exporting crystal report to PDF.</p> <h1 class="header"><a title="ASP.Net MVC: Export Crystal Report to Word Excel PDF and CSV'a" href="https://www.aspsnippets.com/Articles/ASPNet-MVC-Export-Crystal-Report-to-Word-Excel-PDF-and-CSV.aspx">ASP.Net MVC: Export Crystal Report to Word Excel PDF and CSV</a></h1> <p>As you don't want to&nbsp;open the report file, you don't need to set the&nbsp;CrystalReportViewer&nbsp;ReportSource property.</p> <p>You need to initalize the Crystalreport and&nbsp;set the&nbsp;DataSource using SetDataSource properties with Entity Framework.</p> <p>Then set ExportFormatType to&nbsp;PortableDocFormat and&nbsp;exported it using the ExportToHttpResponse method.</p> <p>The Crystal Report exported will be exported to PDF and downloaded as Attachment in Browser.</p> <p><strong><span style="text-decoration: underline;">Database</span></strong></p> <p>For this example I have used of Northwind database that you can download using the link given below.</p> <p><a href="https://www.aspsnippets.com/Articles/Install-Microsoft-Northwind-and-Pubs-Sample-databases-in-SQL-Server-Management-Studio.aspx" target="_blank">Download Northwind Database</a></p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;asp:Button ID=&#34;btnExport&#34; runat=&#34;server&#34; Text=&#34;Export&#34; OnClick=&#34;Export&#34; /&gt;</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <pre class="brush: csharp">protected void Export(object sender, EventArgs e) { CustomerReport crystalReport = new CustomerReport(); NorthwindEntities entities = new NorthwindEntities(); crystalReport.SetDataSource(from customer in entities.Customers.Take(5) select customer); crystalReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Crystal"); Response.End(); }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/138938/Export-Crystal-Report-to-PDF-Without-opening-Report-file-in-ASPNet-MVC/https://www.aspforums.net:443/Threads/138938/Export-Crystal-Report-to-PDF-Without-opening-Report-file-in-ASPNet-MVC/Fri, 02 Aug 2019 05:39:31 GMT