Syncfusion Silverlight报告查看器

时间:2013-10-07 14:44:08

标签: silverlight-5.0

我正在尝试使用同步融合报告查看器来获取银灯以将报告导出为pdf,如果我将报告设置为ProcessingMode.Local,则报告将使用数据呈现,但如果我将其切换为ProcessingMode.Remote并使用syncfusion表示使用的wcf服务,报告不呈现数据。

要添加另一个复杂功能,我们可以使用域名服务混合WCF和RIA域服务。

这只是一个测试项目,以确保我们可以在我们正在开发的silverlight应用程序中执行我们想要的操作。

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

任何一个想法。

0 个答案:

没有答案