
Thank you for looking into that, and confirming the issue with the HTML encoded quote ("). Paragraph previouseParagraph = (Aspose.Words. While (currentNode.NodeType != NodeType.Paragraph)Īspose.Words. Paragraph parent = fieldEnd.ParentParagraph FieldEnd fieldEnd in fieldEnds)Īspose.Words. Move all FieldEnd node to the previous paragraph if it is the first child of paragraph.įoreach (. Using ( MemoryStream fs = new MemoryStream( (html))) Replace HTML encoded quotes with quotes. String html = File.ReadAllText(path2Html) WORKAROUND: Problem occurs becuase style contains HTML encoded quotes ("). Private bool ConvertHtml2Rtf( string path2Html, string path2Rtf) You will be notified as soon as it is resolved. Your request has been linked to the appropriate issue. I managed to reproduce the problem on my side. TextRange textRange = new TextRange(, )

Using ( FileStream stream = new FileStream(path2Rtf, FileMode.Open, FileAccess.Read)) PreviouseParagraph.AppendChild(fieldEnd) Paragraph previouseParagraph = ( Paragraph)currentNode While (currentNode.NodeType!= NodeType.Paragraph)ĬurrentNode = currentNode.PreviousPreOrder(doc) Node currentNode = parent.PreviousPreOrder(doc) Node fieldEnds = doc.GetChildNodes( NodeType.FieldEnd, true).ToArray() įoreach ( FieldEnd fieldEnd in fieldEnds) WORDAROUND: Move FieldEnd node to the previouse paragraph if it is the first child of paragraph. Using ( Stream fs = File.Open(path2Html, FileMode.Open))ĭocument doc = new Document(fs, options) String path2Html = path2Rtf = Save source HTML document to disk. Also, you can move FieldEnd node to the previous paragraph, if it is the first child of the paragraph. So as a workaround of the problem you can removeĪs displayed text (anyway such hyperlink is invisible). Such construction is valid, but RichTextBox does not like it for some reason. Such hyperlink is converted to HYPERLINK field in RTF document, but start of field and end of field are in different paragraphs. I have attached a sample HTML source (sourced from a HTML email) that we are experiencing difficulty as described above.Īny information, suggestion or assistance would be very much appreciated. Presumably some of the RTF data format used is not supported by the RichTextBox/FlowDocument? Is there a way to determine what the unrecognized structure in question?Īre we taking the right approach? Is there an alternative to importing HTML into a RichTextBox that we are unaware of using the component? Unrecognized structure in data format 'Rich Text Format'. But the main concern is with the following error where the RTF failed to be loaded into the FlowDocument.

We are seeing varying degree of success and fidelity. Using (FileStream stream = new FileStream(path2Rtf, FileMode.Open)) Load the RTF stream into FlowDocument. Using (Stream fs = File.Open(path2Html, FileMode.Open))Ī doc = new (fs, options) ĭoc.Save(path2Rtf, ) We use the following roundabout way to convert HTML to RTF, then load the RTF into the FlowDocument associated with the RichTextBox: The document flow we are using is as follow: The RichTextBox is part of a WPF application, and the intent is to render HTML content, as well as the ability to subsequently modify the content via the RichTextBox. We are seeing issues with loading RTF generated by into a.
