Steps to reproduce:
The pasted content is not formatted properly, resulting in an InvalidOperationException("'Token EndElement in state EndRootElement would result in an invalid XML document. Make sure that the ConformanceLevel setting is set to ConformanceLevel.Fragment or ConformanceLevel.Auto if you want to write an XML fragment. ') when saving the content to DOCX.
Steps to reproduce:
Workaround: intercept the table paste and add an empty paragraph as the first element of the document before the table.
Another case:
Try the following scenario:
Here we are:
HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
htmlProvider.ExportSettings.StylesExportMode = StylesExportMode.Inline;
string _html =
@"
<html>
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">
</head>
<body>
<div name=""divtagdefaultwrapper"" style=""font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0"">
<div class=""WordSection1"">
<p class=""MsoNormal"" style=""text-autospace:none"">
<span style=""font-size:11pt; color:rgb(31,73,125)"">
I am out of office, please contact Aaaaaa Bbbbbbb (Tel: +1-234-567-8900/email:
<a href=""mailto:aaaaaa.bbbbbb@zzz.com"">aaaaaa.bbbbbb@zzz.com</a>) for assistance
</span>
</p>
</div>
</div>
</body>
</html>
";
RadDocument _doc = htmlProvider.Import(_html);
radRichTextBox.Document = _doc;
And here is an exception:
System.NullReferenceException
htmlString = htmlString.Replace("<p>", string.Empty).Replace("</p>", string.Empty);
In a specific scenario when there are many tables in a document the following case leads to NullReferenceException.
- Select few tables
- while mouse is still selecting tables use keyboard's Ctrl + A
- Leave the mouse
- use Ctrl + A again (this time everything is selected)
- hit Delete
- Object reference not set to an instance of an object is thrown