We have created a very dynamically generated report (meaning that it adds subreports and columns depending on the data that is bound to it). When I run the report as a PDF, it works just fine. However, when I export the report as an MHTML or XLS, I get the "Parameter is not valid" exception when it attempts to render the report.
Like I said, it renders everything perfectly find as a PDF, but when it attempts to render it as an MHTML file or XLS, it blows up.
We are using the NeedDataSource event handler of the SubReports inside of the Main report as described by Telerik as the right thing to do, and it does work flawlessly for PDF. From there we are adding columns and sizing things in the subreport for each section that needs to be added to the report.
Dim mimType As String = String.Empty |
Dim extension As String = String.Empty |
Dim encoding As System.Text.Encoding = Nothing |
Dim buffer As Byte() = Telerik.Reporting.Processing.ReportProcessor.Render("MHTML", tReport, Nothing, mimType, extension, encoding) |
Dim fs As New FileStream("C:\Report" ID & ".MHTML", FileMode.Create) |
fs.Write(buffer, 0, buffer.Length) |
fs.Flush() |
fs.Close() |
Like I said, it renders everything perfectly find as a PDF, but when it attempts to render it as an MHTML file or XLS, it blows up.
We are using the NeedDataSource event handler of the SubReports inside of the Main report as described by Telerik as the right thing to do, and it does work flawlessly for PDF. From there we are adding columns and sizing things in the subreport for each section that needs to be added to the report.