[ad_1]
你好,
我想在 .chtml 页面中使用报告查看器制作水晶报告,可以使用 pdf 但
不适用于报表查看器。
如果您有任何想法,请建议我。
我从事 razor 视图引擎、mvc 4、c# 、.net
解决方案3
希望本教程对您有所帮助。
[^]
http://www.fdfriends.com/crystal-reporting-with-mvc4-mvc5-razor-view-step-by-step-tutorial/
解决方案1
我从未在 MVC 中使用过 Crystal reports,但我发现了这个细节,请查看
在 MVC3 框架的 Razor 视图中使用 Reportviewer 控件[^]
解决方案2
解决方案4
@page @using System.Data.SqlClient; @using System.Diagnostics; @model QT2Docs.Pages.JobCostingAPIModel @{ string JobNumber = Request.Query["JobNumber"]; Random rnd = new Random(); int FileInt = rnd.Next(1, 100); string FileNum = FileInt.ToString(); DateTime today = DateTime.Today; string CryConnect = System.Configuration.ConfigurationManager.AppSettings["CReportCon"]; string FileName = " -F \"C:\\Reports\\JobCostDetailByJob.RPT\""; string RptOptions = " -A @JobNumber:" + JobNumber + " -A @StartDate:01/01/1900 -A @EndDate:" + (today.ToString("MM/dd/yyyy")) + " -A @GangRunJobs:0 -A @JobStatus:All -A @GroupBy:0 -A @DateTypeFilter:-1 -A @EstimateData:0 -A @PlantID:All "; string TheOutput = " -EPDF -O \"C:\\inetpub\\wwwroot\\QT2Docs\\wwwroot\\JobCostDetailByJob" + FileNum + ".pdf\""; string RptPareamiters = CryConnect + FileName + RptOptions + TheOutput; var process = Process.Start(@"c:\reports\crexport.exe", RptPareamiters); process.WaitForExit(); //crexport.exe -S server -U sa -P password -D "database" /// server connection // -F "C:\Reports\InvoiceCreditNotes.rpt" /// report file // -A @DocumentType:INVOICE -A @StartNum:%%A -A @EndNum:%%A -A @Batch:1 /// RTP paramiters format -A Paramiter:Value the @ symbol is for SP value, do not use @ when just passing data // -EPDF -O "C:\Reports\InvoiceCreditNotes.pdf" /// FIle format and outputfile // crexport.exe was recompiled to .net 4.8 and code is from https://github.com/rainforestnet/CrystalReportsNinja // Also *Note The application pool will need to use an identity that has rights to run and store report Response.Redirect("/QT2Docs/JobCostDetailByJob" + FileNum + ".pdf");
This is the contents of JobCostingAPI.cshtml for my razor project called QT2Docs. when this page is feed the job number though http://somewebserver/QT2Docs/JobCostingAPI?Jobnumber=654321 it builds the report parameters and connection then deposits the pdf where i can link it. The FileNum (random)value is to help keep from more than one report over weighting a second concurrent run. Thank the people at rainforestnet for an old app that still kicks butt
[ad_2]
コメント