Copy RadDocument

2 posts, 0 answers
  1. FU
    FU avatar
    24 posts
    Member since:
    Jul 2006

    Posted 07 Apr 2011 Link to this post


    I'm trying to replace some variables in a document when saving it. I want it done as it saves the document so that the saved file contains the replacements and the document in the editor is not changed. Saving the document and replacing the variables works but the changes are made in the RadDocument in the editor. Is it possible to make a copy of the RadDocument in the editor, make the changes in the copy and save it?

  2. Mike
    Mike avatar
    640 posts

    Posted 08 Apr 2011 Link to this post

    Hi FU,

    It is possible to create a copy of the document by exporting and then importing it with the XamlFormatProvider. It will create an identical copy of the document, however you should have in mind that all UIElements inside InlineUIContainer will be cloned and their settings might be different from the actual ones and event handlers might not work.
    Another option for you may be to use Undo several times. This will be possible if you use the API of and commands of RadRichTextBox to modify the document only. Change made using the API of RadDocument are often not undo-able and document history would be cleared in these cases.
    Let us know if you have more questions.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top