Insert document inside a run of another document

1 Answer 78 Views
WordsProcessing
Muhammad
Top achievements
Rank 1
Iron
Muhammad asked on 20 Dec 2022, 09:06 PM

I'm using RadFlowDocument editor to insert a document in a specific position after a text from run.

So flow is read a document runs and when a text is reach insert another RawFlowDocument in it.

But the problem is always adding it in the end.

I want to insert it at specific position. 

There are total 3 documents that needs to be added at specific position.
The run text shows i am at the right position but the generated document always shows new document in the end.

else if (currentRun.Text.EndsWith("Template»"))
                                {

                                    string ebrTemplateName = currentRun.Text.Substring(7, currentRun.Text.Length - 8);
                                    var currentT = ModifyTemplate(ebrTemplateName, jsonToken + "[" + i + "].");
                                    if (currentT != null)
                                    {


                                       // documents.Enqueue(new DocumentsStack { document = currentT, run = currentRun });
                                        currentRun.GetEditorBefore().InsertDocument(currentT);
                                         //editor.InsertDocument(currentT);
                                        
                                    }

                                }

1 Answer, 1 is accepted

Sort by
0
Maria
Telerik team
answered on 23 Dec 2022, 01:07 PM

Hello Muhammad,

I looked at your code snippet and we don't have GetEditorBefore() method. You need to check if the editor is in the correct position you want to insert the second document. I am sending you an example project on how can you achieve the wanted behavior and modify it with your data.

I hope this information is helpful.

Let me know if I can be of further assistance.

Regards,
Maria
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/.

Tags
WordsProcessing
Asked by
Muhammad
Top achievements
Rank 1
Iron
Answers by
Maria
Telerik team
Share this question
or