InsertFragment without new paragraph

2 posts, 0 answers
  1. Alexander
    Alexander avatar
    20 posts
    Member since:
    Aug 2014

    Posted 24 Mar 2015 Link to this post

    Hello,

    When I use InsertFragment(document) to insert text from one document to another it is getting inserted with a new paragraph and a new line after the fragment. But I want to insert text without that. It must be exactly as in the original file.

    I've tried this code:

    var editor = new RadDocumentEditor(document);
    editor.Document.Selection.SelectAll();
    var fragment = new DocumentFragment(editor.Document.Selection);

    But it was wrong if there were CustomAnnotationRange in the copied fragment (CopyContentFromOverride is not called and values of my properties are lost).

    Can you help me?
    Thanks in advance.

    Alexandre.
  2. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 27 Mar 2015 Link to this post

    Hello Alexander,

    I am sorry to hear that you have problems with creating document fragment.

    Regarding the additional paragraph inserted before the elements in the fragment, this should happen only if the first element in the fragment is table. We are aware of this problem and it is actually already fixed and should be available with 2015 Q1 SP1 expected earlier next month.

    Regarding to the problem with copying custom annotation range properties, my suggestion is to move that logic into CopyPropertiesFromOverride method. This method is created with the goal to copy any additional properties of the element.

    When it comes to CopyContentFromOverride method the intention behind it is to allow copy of the element content . By content I have in mind text, image source etc. In the case of custom annotations there is no content that should be copied. Nevertheless it is a problem that the method is not called when the copy is made. That is why I have logged bug report to our feedback portal.

    I hope this information is helpful for you. In case this is not sufficient, could you provide more information about the actual elements which should be inserted in the DocumentFragment.


    Regards,
    Mihail
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top