Declined
Last Updated: 03 May 2016 10:35 by Martin
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 21 Sep 2015 11:52
Category:
Type: Bug Report
2
Moved to TDP: FIX. RadWordsProcessing - updating fields without Separator causes NullReferenceException
This item is migrated to the Telerik Document Processing portal: 
http://feedback.telerik.com/Project/184/Feedback/Details/190083 
Please use the new item for commenting, voting and subscribing instead of this one.
1 comment
Martin
Posted on: 01 Oct 2015 13:31
Here is the workaround.

      private static void WorkaroundFieldsIssue(RadFlowDocument flowdocument)
        {
            foreach (FieldCharacter fieldCharacter in flowdocument.EnumerateChildrenOfType<FieldCharacter>().ToList())
            {
                // only for start
                if (fieldCharacter.FieldCharacterType == FieldCharacterType.Start)
                {
                    if (fieldCharacter.FieldInfo.Separator != null && fieldCharacter.FieldInfo.Separator.Parent == null)
                    {
                        Paragraph parent = fieldCharacter.FieldInfo.End.Paragraph;
                        int index = parent.Inlines.IndexOf(fieldCharacter.FieldInfo.End);

                        fieldCharacter.FieldInfo.End.Paragraph.Inlines.Insert(index, fieldCharacter.FieldInfo.Separator);
                    }
                }
            }
        }