i have a issue converting a docx file into a HTML file and then displayig the HTML in the RichTexBox control.
I am trying to upload a docx file with a table in it, by convertig the byte array into a RadDocument with the DocxFromatProvider.
This works great. Then i export the RadDocument into a HMTL string with the HtmlFormatProvider. This also works.
Then i try to create a new RadDocument with the generated HTML string and the HtmlFormatProvider. But it throws me a InvalidCastException. Here is my code:
data = dlg.File.OpenRead();
RadDocument tmpDoc = new DocxFormatProvider().Import(data);
html = new HtmlFormatProvider().Export(tmpDoc);
Document = new HtmlFormatProvider().Import(html);
The last line causes the exception. The HTML in the string is valid html.
It seems that a docx containing a table can be converted in valid HTML, but it cannot been imported as RadDocument.
When i try to upload the generated html in your silverlight demo RichTextBox it says "The file cannot be opened".
Is there any solution for this issue?
Thanks a lot!