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

Problem RadDocument insert section in a template

1 Answer 112 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Manuel
Top achievements
Rank 1
Manuel asked on 16 Feb 2012, 11:42 AM
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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Iva Toteva
Telerik team
answered on 21 Feb 2012, 06:16 PM
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 >>
Tags
RichTextBox
Asked by
Manuel
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or