How to add RadDocument(template) to another RadDocument

2 posts, 0 answers
  1. Fredrik
    Fredrik avatar
    58 posts
    Member since:
    Mar 2013

    Posted 11 Jan Link to this post

    Here is the rub:

    Basicly i work on a RadDocument within a RichTextBox. With the help of a combobox the user can insert templated documents within his current document.

    This is allready storred as DocxFormat bytestream.

    I have the following code: 

           private async Task DoInsertTemplate(DocumentGroups template, object par,byte[] templateContent )
            {
                byte[] contentarray = templateContent;
         

                var provider = new DocxFormatProvider();
                var documentTemplate = provider.Import(contentarray);

                var radRichTextBox = par as Telerik.Windows.Controls.RadRichTextBox;

                var documentOrginal = radRichTextBox.Document;

            }

    So i have 2 diffrent RadDocuments, and i want to insert the documentTemplate at my current caret position, so that the documentTemplate can sometimes be "pasted" in the middle of my documentOrginal .

    I have seen a post on how to merge documents after eachother(http://www.telerik.com/forums/how-to-merge-multiple-raddocuments-into-one-raddocument)

    But that is not what i want.

    How can i acheive the RadDocument "paste" at the current carret position?

     

  2. Fredrik
    Fredrik avatar
    58 posts
    Member since:
    Mar 2013

    Posted 12 Jan in reply to Fredrik Link to this post

    Found the solution

    One simple line

    radRichTextBox.Document.InsertFragment(new DocumentFragment(templateDocument));

  3. DevCraft banner
Back to Top