The Hyperlink field is wrongly exported when the Code fragment is divided into several text fragments.
Actual:
Expected:
Workaround: Iterate the document content after importing it into RadFlowDocument in order to modify the Code fragment:
bool isBetweenStartAndSeparation = false;
string fieldInfoText = string.Empty;
int startIndex = 0;
IEnumerable<Paragraph> paragraphs = document.EnumerateChildrenOfType<Paragraph>();
foreach (Paragraph paragraph in paragraphs)
{
foreach (InlineBase inline in paragraph.Inlines.ToList())
{
if (inline is FieldCharacter)
{
FieldCharacter fieldCharacter = inline as FieldCharacter;
if (fieldCharacter.FieldCharacterType == FieldCharacterType.Separator)
{
isBetweenStartAndSeparation = false;
Run run = new Run(this.document)
{
Text = fieldInfoText
};
paragraph.Inlines.Insert(startIndex, run);
}
else if (fieldCharacter.FieldCharacterType == FieldCharacterType.Start)
{
isBetweenStartAndSeparation = true;
startIndex = paragraph.Inlines.IndexOf(inline) + 1;
fieldInfoText = fieldCharacter.FieldInfo.GetCode().Trim().ToLowerInvariant();
}
}
else if (isBetweenStartAndSeparation)
{
paragraph.Inlines.Remove(inline);
}
}
}