This question is locked. New answers and comments are not allowed.
Hi,
In my custom format provider I'm running into a bit of difficulty during the export process in identifying which spans of the RadDocument are Hyperlinks from a document created by the RadRichTextBox. To insert a Hyperlink into the content of the text box I am using this code:
string url = "http://www.example.ext";
DocModel.Hyperlink link = new DocModel.Hyperlink(rtbText.Document.Selection.GetSelectedText(), url, DocModel.HyperlinkTargets.Blank);
rtbText.InsertInline(link);
The Hyperlink appears in the text box and is usable. The Telerik Xaml and Html format providers export the link properly.
In the export method of my own implementation of IDocumentFormatProvider, I am trying to identify the RadDocument's Hyperlinks in this way:
foreach (Section section in document.Sections){ foreach (Paragraph paragraph in section.Paragraphs) { foreach (Span span in paragraph.Children) { if (span is Hyperlink) { // process hyperlink here } } }}When I'm stepping through this code in the debugger, I can see that the Span I expect to be a Hyperlink does have some properties set (e.g. URL) that I would see in a Hyperlink, however the span is actually a Span object and the properties I'm seeing are internal so I can't access them.
What is the preferred way for identifying hyperlinks while exporting a RadDocument in a custom format provider? If I construct a RadDocument which includes a Hyperlink by using the import method of my format provider (by adding a Hyperlink object to the Children collection of a Paragraph) and then run this document through the export method of my format provider, I'm seeing the Hyperlink objects as expected. When I insert new Hyperlinks with the InsertInline method on the rich text box I am not able to identify the Hyperlink objects during document export.
I'm using version 2010.2.812.1040.
Thanks,
Jonathan