radRichTextBox IndexOutOfRangeException

2 posts, 0 answers
  1. Sebastien
    Sebastien avatar
    1 posts
    Member since:
    Feb 2012

    Posted 23 Feb 2015 Link to this post

    Hello

    I use the RadRichTextBox component (version 2014.1.402.40)

    When I try to load a specific html source, I get an IndexOutOfRangeException exception.

    It's works with other source, but one specific source create this problem.


    My simple code :

    var mail = File.ReadAllText(@"Mailtest2.html");
    var htmlProvider = new HtmlFormatProvider();
    radRichTextBox1.Document = htmlProvider.Import(mail); // ERROR / IndexOutOfRangeException

    The HTML Source :

    <html><head></head>
    <body style = 'font-family:Arial, Helvetica, sans-serif; font-size:12px;'>
    Bonjour,
    <br><br>
    <br><br>
    <br><br>
    <br><br>
    <br><br>
    <br><br>
    <table border=0 style = 'font-family:Arial, Helvetica, sans-serif; font-size:12px;font-weight:bolder;'>
    <tr>
    <td rowspan=4 style="width:80px;"></td>
    <td colspan=2></td>
    </tr>
    <tr>
    <td>
    <br></td>
    <td>
    <br></td>
    </tr>
    <tr>
    <td colspan=2></td>
    </tr>
    </table>
    <br><br><br><br>
    </body>
    </html>


    Thank you very much for your help and sorry for my bad english
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 26 Feb 2015 Link to this post

    Hello,

    Thank you for writing.

    It appears that the provided html is invalid and this is why the exception occurs. I have tested the provided code with an online validation tool and the error that is causing the exception is located on the following line:
    <td rowspan=4 style="width:80px;"></td>

    If you reduce the rowspan or add more rows the exception would not occur.

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top