This is a migrated thread and some comments may be shown as answers.

InsertFragment without new paragraph

1 Answer 183 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 24 Mar 2015, 02:58 PM
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.

1 Answer, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 27 Mar 2015, 11:10 AM
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.

 
Tags
RichTextBox
Asked by
Alexander
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Share this question
or