Completed
Last Updated: 04 Mar 2022 12:58 by ADMIN
Release LIB 2022.1.307 (07 Mar 2021)
ADMIN
Boby
Created on: 16 Jul 2018 14:22
Category: WordsProcessing
Type: Bug Report
0
WordsProcessing: Inserting document containing fields without Separator causes NullReferenceException
When a document containing a field without a separator is inserted using the RadFlowDocumentEditor.InsertDocument(*) method, NullRferenceException is thrown.

Workaround: Fix the document before inserting: 

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);
            }
        }
    }
}
1 comment
ADMIN
Peshito
Posted on: 04 Mar 2022 12:58

Hello,

This item will be available in R2 2022 Release. 

It is also available with Telerik UI for WPF's latest internal build - LIB 2022.1.307 (07 Mar 2021) if you need it earlier. 

Regards,
Peshito
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.