csharp 从代码调用SSRS报告并获取文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 从代码调用SSRS报告并获取文件相关的知识,希望对你有一定的参考价值。
var baqR = WCFServiceSupport.CreateImpl<Ice.Proxy.Rpt.BAQReportImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.BAQReportSvcContract>.UriPath);
var dynamicReport = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicReportImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicReportSvcContract>.UriPath);
var rptMonitor = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.ReportMonitorImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.ReportMonitorSvcContract>.UriPath);
var rptDs = dynamicReport.GetByID("EDI870EXPORT");
var baqRptDS = baqR.GetNewBAQReportParam("EDI870EXPORT");
baqRptDS.BAQReportParam[0].Option01 = guid.ToString();
baqRptDS.BAQReportParam[0].AutoAction="SSRSGenerate";
baqRptDS.BAQReportParam[0].SSRSRenderFormat = "CSV";
baqRptDS.BAQReportParam[0].Character01=guid.ToString();
baqRptDS.BAQReportParam[0].Character02=flag;
baqRptDS.BAQReportParam[0].BAQRptID="EDI870EXPORT";
baqRptDS.BAQReportParam[0].ReportID="EDI870EXPORT";
baqRptDS.BAQReportParam[0].Summary = false;
baqRptDS.BAQReportParam[0].ReportStyleNum = 1002;
baqRptDS.BAQReportParam[0].BAQID="FAM-EDI870-DASHBOARD";
baqRptDS.BAQReportParam[0].ReportTitle = "EDI 870 Export";
baqRptDS.BAQReportParam[0].TaskNote = guid.ToString();
rptDs.BAQRptOptionFld[0].FieldValue = guid.ToString();
rptDs.AcceptChanges();
StringWriter writer = new StringWriter();
rptDs.WriteXml(writer);
baqRptDS.BAQReportParam[0].Filter1 = writer.ToString();
baqR.RunDirect(baqRptDS);
bool morePages;
ReportMonitorDataSet rpds = rptMonitor.GetRowsKeepIdleTime("RptNote='" + guid.ToString()+"'",0,0 , out morePages);
byte[] arr=rptMonitor.GetReportBytes(rpds.SysRptLst[0].SysRowID);
String file = Path.GetTempFileName().Replace(".tmp",".csv");
File.WriteAllBytes(file, arr);
以上是关于csharp 从代码调用SSRS报告并获取文件的主要内容,如果未能解决你的问题,请参考以下文章
使用查询作为输入参数创建动态SSRS报告
SSRS查询获取标量变量错误,而不是在Visual Studio中使用参数
SSRS报告导出为PDF并附加其他文档
如何在运行时更改SSRS报告中的数据库
Dynamics 365 CRM - 从SSRS报告中删除外部联接重复项
如何在SSRS中将报告导出到.CSV?