Problem RadDocument insert section in a template

2 posts, 1 answers
  1. Manuel
    Manuel avatar
    61 posts
    Member since:
    Oct 2011

    Posted 16 Feb 2012 Link to this post

    Hi there,

    I want in my application open a docx or .rtf and this file is a template that have some tags that will be replaced by the application.

    This template have 3 parts, first have a area that have tags and are replaced and this works good.

    After that, I have another tag, that will be replaced for one section dynamically created by the application.

    And in final of document, I have text that I want not change, is  a template text.

    The problem is that, the section created by me, are put before of last part of template. How I can put a section between two parts?
  2. Answer
    Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 21 Feb 2012 Link to this post

    Hello Manuel,

    You can use the DocumentFragment elements and the InsertFragment method of RadRichTextBox.
    DocumentFragments can be created from a RadDocument in the way specified in this forum thread. (A RadDocument can be created either programmatically or through import.)
    After creating the DocumentFragment, you can insert it using the InsertFragment method of RadRichTextBox. In this way, the fragment will be inserted at the caret position, which you can adjust using the methods of DocumentPosition.
    I hope this helps.

    Kind regards,
    Iva Toteva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top