"Parameter is not valid" exception

4 posts, 0 answers
  1. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 03 Jul 2008 Link to this post

    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) 

    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.
  2. Chavdar
    Chavdar avatar
    898 posts

    Posted 04 Jul 2008 Link to this post

    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.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
  4. Thomas Salt
    Thomas Salt avatar
    136 posts
    Member since:
    Apr 2005

    Posted 15 Aug 2008 Link to this post

    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.
  5. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 15 Aug 2008 Link to this post

    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.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top