Tuesday, June 24, 2014

ASP.NET MVC Generate Crystal report to pdf

See the code sample:

   public ActionResult GenerateReport(CustomerPackageReportViewModel CustomerPackageReportViewModel)  
       List<CustomerPackageDetailsReportViewModel> _customerList = (List<CustomerPackageDetailsReportViewModel>)Session["CustomerPackageInfo"];  
       DataTable tableObj = new DataTable();  
       if (_customerList!=null)  
         tableObj = Converter.ToDataTable(_customerList);  
         tableObj = Converter.ToDataTable(ArchitectureList);  
         ReportDocument reportDoc = new ReportDocument();  
         string rptPath = "";  
         rptPath = Server.MapPath("~/Reports/Billing/Crystal/rptCustomerPackage.rpt");  
         Stream reportStream = this.ConvertReportToPDF(reportDoc);  
         return new FileStreamResult(reportStream, "application/pdf");  
     public Stream ConvertReportToPDF(ReportDocument DocReport)  
       if (DocReport == null)  
         return null;  
       return DocReport.ExportToStream(ExportFormatType.PortableDocFormat);  

Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file

In my Xamarin form application their was dependency Restclient on Microsoft.Bcl.Build Microsoft.Bcl. i just remove all using nuget and ...