Hi All
I try to produce a generated document using RadDocument. Let's say I have template like this:
A. Chapter a
<texttoreplace>
B. Chapter b
Chapter A, B and so on is a 'report template', each header is indented 150 point. I have multi paragraph text like this (2 paragraph in this sample below):
text1 text1
text2 text 2
All of these text is *not left indented*. What I need is , I can produce report like this:
A. Chapter a
text1 text1
text2 text2
B. Chapter b
I expect the second paragrah, "text2 text2" is also indented just look like first one (text1 text1).
I have tried to use this code to do this job:
01.
foreach
(var textRange
in
search.FindAll(
"<<toreplace>>"
))
02.
{
03.
// select text to replace
04.
docx.Selection.AddSelectionStart(textRange.StartPosition);
05.
docx.Selection.AddSelectionEnd(textRange.EndPosition);
06.
docxEdit =
new
Telerik.WinForms.Documents.Model.RadDocumentEditor(docx);
07.
//remove the text
08.
docxEdit.Delete(
false
);
09.
//put 'multi paragraph' replacement text
10.
docxEdit.InsertFragment(fragment);
11.
//just in case there more than one text to replace, loop
12.
docx.Selection.Clear();
13.
textRange.StartPosition.Dispose();
14.
textRange.EndPosition.Dispose();
15.
}
this code replace all occurrences of <<texttoreplace>> successfully, but the output is always like this:
A. Chapter a
text1 text1
text2 text2
B. Chapter b
The second paragraph of the replacement text is not following destination paragraph indentation but use its own indent.
Can I have any clue how to produce report I need ?