Hello,
excuse my english its not that good, but I try my best.
I want to make a CrystalReport without using the CrystalReportViewer or any Databases/DataSets.
I have an ObjectList (just like a ListView) which I filled with 10 elements (ID,Name,Description). Now I am trying to export this list to .pdf
Here I am trying to fill the list:
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
Dim itemList As List(Of DataHelper) = New List(Of DataHelper)
For i As Integer = 1 To 10 Step 1
itemList.Add(New DataHelper(String.Format("Name {0:00000}", i), String.Format("Desc {0:00000}", i)))
Next
m_ObjectListView.AddObjects(itemList)
End Sub
Here I am calling the function:
Private Sub btnPdf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPdf.Click
Dim report As DataFormatter = New DataFormatter
report.WriteReportToPDF(m_ObjectListView)
End Sub
Here I am trying to export it: And I am stuck here!! Please Help!!
Public Sub WriteReportToPDF(ByVal _list As BrightIdeasSoftware.ObjectListView) Implements IDataFormatter.WriteReportToPDF
Dim cr As ReportDocument = New ReportDocument
Try
cr.SetDataSource(_list)
cr.ExportToDisk(ExportFormatType.PortableDocFormat, "Report")
Catch ex As Exception
ex.Message.ToString(ex)
End Try
End Sub
I am just a beginner with CrystalReports, so that means I dont have
much experience. The problem ist the "WriteReportToPDF".
Thanks in advance!!!
Greetings
Manda