Hello,
I have an object that collects data that then needs to be passed to the Report. A small example is below:
Imports Telerik.Reporting
Public Class Form1
Public dataList As List(Of String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Fill data collection
dataList.Add("Item 1")
dataList.Add("Item 2")
dataList.Add("Item 3")
'Setup Telerik report
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor
Dim deviceInfo As New System.Collections.Hashtable()
Dim typeReportSource As New Telerik.Reporting.TypeReportSource
typeReportSource.TypeName = GetType(Report1).AssemblyQualifiedName
Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo)
Dim fileName As String = "testFile" & "." & result.Extension
Dim path As String = "C:\Projects\Telerik"
Dim filePath As String = System.IO.Path.Combine(path, fileName)
'Save Telerik report
Using fs As New System.IO.FileStream(filePath, System.IO.FileMode.Create)
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length)
End Using
End Sub
End Class
Public Class telerikAdapter
Public Property New dataList As List(Of String)
Public Sub New()
End Sub
End Class
In this example, I need dataList to be available in the report. I can set the DataSource to the telerikAdapter class, or any of the other classes that exist in my application. However, these classes are instantiated when Telerik runs the report, and thus have no access to data that exists elsewhere in already instantiated objects.
I also tried passing parameters to the report, but I can't pass a collection. I need access to several rather deep collections of data in the report.
There must be a way to access dataList or to pass it in when the report is run, but I can't see it.
I'm working with Windows 7 32 bit, VB.NET, and WinForms, if it makes any difference.