我使用下面的代码将 RDLC 文件从一个应用程序调用到另一个应用程序。下面的代码驻留在一个应用程序中。RDLC 文件位于另一个应用程序中。
Dim RptVwr As New Microsoft.Reporting.WebForms.ReportViewer()
Dim ds As DataSet = OBJ.GetInventoryProductDetails(plannerCode)
Dim RptDtSrc As New Microsoft.Reporting.WebForms.ReportDataSource()
RptDtSrc.Name = "XXXXXX1"
RptDtSrc.Value = ds.Tables(0)
RptVwr.LocalReport.DataSources.Add(RptDtSrc)
Dim RptDtSrc1 As New Microsoft.Reporting.WebForms.ReportDataSource()
RptDtSrc1.Name = "XXXXXX2"
RptDtSrc1.Value = ds.Tables(1)
RptVwr.LocalReport.DataSources.Add(RptDtSrc1)
RptVwr.LocalReport.ReportPath = "http://localhost:58154/RDLC/GLA_InspectionList.rdlc"
RptVwr.LocalReport.EnableHyperlinks = True
Dim excelcontent As Byte() = RptVwr.LocalReport.Render("Excel", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)
Dim FS As FileStream
FS = New FileStream(Save, FileMode.Create)
FS.Write(excelcontent, 0, excelcontent.Length)
FS.Close()
但是上面的代码在生成excel文件时失败了。如何解决上述问题?