Here's my code:
Code: Select all
Private Function GetReport() As StiReport
Dim report As StiReport = New StiReport()
Dim data As DataSet = New DataSet("test")
data.ReadXmlSchema("D:\TEMP\sample.xsd")
data.ReadXml("D:\TEMP\sample.xml")
report.RegData("MyDataSet", data)
report.Dictionary.Synchronize()
report.Render(False)
Return report
End Function
Code: Select all
Function HTML() As MvcHtmlString
Dim report As StiReport = GetReport()
Dim exportservice = New StiHtmlExportService()
Dim stream = New MemoryStream()
exportservice.ExportHtml(report, stream)
Dim reader = New StreamReader(stream)
stream.Position = 0
Dim test As String = (reader.ReadToEnd)
Return MvcHtmlString.Create(test)
End Function
Function Excel() As ActionResult
Dim report = GetReport()
Dim s = New Stimulsoft.Report.Export.StiExcelExportService()
Dim mySettings = New StiExcelExportSettings()
Dim fs = New FileStream("MyFile.xls", FileMode.Create, FileAccess.ReadWrite)
s.ExportExcel(report, fs, mySettings)
Return File(fs, "application/vnd.ms-excel", "GridExcelExport.xls")
End Function
If I use this code an empty screen appears. If I add a line to the GetReport-method that loads a sample report, empty tables are shown. I just cannot get the data to be shown.
What am I doing wrong? In the debugger the report does seem to contain data (I use 'seem' because I thought my code was suppose to work).