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

radRichTextBox IndexOutOfRangeException

1 Answer 78 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Sebastien
Top achievements
Rank 1
Sebastien asked on 23 Feb 2015, 06:08 PM
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

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 26 Feb 2015, 02:57 PM
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.

 
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Sebastien
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or