This is a migrated thread and some comments may be shown as answers.

"Parameter is not valid" exception

3 Answers 363 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 03 Jul 2008, 03:52 PM
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.

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.

3 Answers, 1 is accepted

Sort by
0
Chavdar
Telerik team
answered on 04 Jul 2008, 08:21 AM
Hello Adam,

The most likely reason for the problem is that you are using a PictureBox item and assign an image, which is either disposed prior to rendering in MTHML/XLS or has inappropriate ImageFormat. In order to troubleshoot the issue more precisely, please open a support ticket and send us the stack trace or a sample project with report which replicates it. Another possible reason might be that the size of the image is 0.

Regards,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Thomas Salt
Top achievements
Rank 1
answered on 15 Aug 2008, 02:24 PM
Just an FYI for others who come across this error.  This occured on my report when exporting to RTF using the Web Form Viewer.  I narrowed the problem down to a textbox that I was assigning data to dynamically in the code behind of the report.

The textbox was set to a height of 16px (enough for one text line) with CanGrow = true.  Whenever the textbox was 2 lines, thus relying on the CanGrow property, an error occured on my report.  I then changed the height of the textbox to 32 px (knowing that no information will ever be over 2 lines), and set the CanGrow = false.

No more error.  I'm not sure if this is a bug in the reporting control or something I overlooked in documentation.  Hope this helps somebody out.
0
Rossen Hristov
Telerik team
answered on 15 Aug 2008, 02:44 PM
Hi Thomas Salt,

Could you please open a support ticket and attach a project that demonstrates this behavior. We are very keen to examine it and if there is a problem with the product to take the respective actions in order to fix it. Thank you in advance.

Regards,
Ross
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Adam
Top achievements
Rank 1
Answers by
Chavdar
Telerik team
Thomas Salt
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or