我正在尝试使用银光同步融合报告查看器将报告导出为 pdf,如果我将报告设置为 ProcessingMode.Local,则报告将与数据一起呈现,但如果我将其切换为 ProcessingMode.Remote 并使用 wcf 服务syncfusion 说使用,报告不呈现数据。
添加另一个复杂性是我们正在使用域服务,我可以混合 WCF 和 RIA 域服务。
这只是一个测试项目,以确保我们可以在我们正在开发的 silverlight 应用程序中做我们想做的事情。
银光代码:
Dim test As New ReportApp.ReportTest.TestReportServer
Dim staff As New List(Of SalesPerson)
Dim storedsiteurl As String = ""
'Dim data As IList(Of SalesPerson)
Public Sub New()
InitializeComponent()
End Sub
Private Sub MainPage_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
Me.test.Load(Me.test.GetStaffQuery, AddressOf GetRecords, False)
Private Sub DisplayReort(e As InvokeOperation(Of Byte()))
Dim rdlstream1 As Stream = New MemoryStream(e.Value)
Dim r As New ReportDataSource
Dim serviceUrl As String = ""
Dim hostName As String = Application.Current.Host.Source.Host
If Application.Current.Host.Source.Port <> 80 Then
hostName += ":" + Application.Current.Host.Source.Port.ToString
End If
serviceUrl = (Convert.ToString("http://") & hostName) + "/ReportingService.svc"
r.Name = "SalesPerson"
r.Value = staff
'ReportViewer1.ProcessingMode = ProcessingMode.Local
ReportViewer1.ProcessingMode = ProcessingMode.Remote
ReportViewer1.ReportServiceURL = serviceUrl
Try
ReportViewer1.DataSources.Clear()
ReportViewer1.LoadReport(rdlstream1)
ReportViewer1.DataSources.Add(r)
'ReportViewer1.DataSources.Add(New ReportDataSource With {.Name = "SalesPerson", .Value = staff})
ReportViewer1.RefreshReport()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Private Sub GetRecords(LoadOp As ServiceModel.DomainServices.Client.LoadOperation(Of SalesPerson))
'Throw New NotImplementedException
staff = LoadOp.Entities.ToList
DataGrid1.ItemsSource = staff
test.Getreport(AddressOf DisplayReort, Nothing)
End Sub
结束类
域服务代码:
Private staff As List(Of SalesPerson)
Private Function GetServerRootPath() As String
Dim r As String = HttpContext.Current.Server.MapPath("..")
If r.EndsWith("\") = False Then r &= "\"
Return r
End Function
<Invoke()>
Public Function Getreport() As Byte()
Dim b As Byte()
Dim ff As New FileFunctions.FileFunctions
If ff.filefound(GetServerRootPath() & "Reports\Report1.rdlc") = True Then
Debug.Print("File found!")
Else
Debug.Print("File not found!")
End If
b = ff.ReadFileToByte(GetServerRootPath() & "Reports\Report1.rdlc")
If b.Length <= 0 Then Debug.Print("Array Zero Length!")
Return b
End Function
'<Invoke()>
'Public Function GetReportDataSource() As ReportDataSource
' Dim r As New ReportDataSource
' dostaff()
' r.Name = "SalesPerson"
' r.Value = staff.ToList
' Return r
'End Function
Private Sub dostaff()
Dim tempstaff As New SalesPerson
staff = New List(Of SalesPerson)
tempstaff.id = 0
tempstaff.FullName = "Jason Smith"
tempstaff.Title = "Sales Representative"
tempstaff.SalesTerritory = "Northeast"
tempstaff.ID2002 = "1375876.8256"
tempstaff.ID2003 = "40"
tempstaff.ID2004 = "4557045.0459"
staff.Add(tempstaff)
End Sub
Public Function GetStaff() As IEnumerable(Of SalesPerson)
dostaff()
Return staff
End Function
<Invoke()>
Public Sub Updatestaff(s As SalesPerson)
Debug.Print(s.id.ToString)
End Sub
任何人任何想法。