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

CurrentSpanBox and wrapping issue

1 Answer 43 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 29 Jun 2011, 08:23 AM
Hi. Here is my scenario:
User inserts some small text blocks into RadRichTextBox like this: "[name]" or "[address]". These are templates which can contain empty spaces inside: "[full name]".
User may want to edit any template. He moves caret cursor on template text to specify the template he wants to change.
When the whole template is located in one line, it's ok - I can take current span box and change the text inside:
SpanLayoutBox currentSpanBox = RadRichTextBox.Document.CaretPosition.GetCurrentSpanBox();
currentSpanBox.Text = "New value";

But when the text is long it can be wrapped in two or more lines (without paragraphs). Then the current span box will contain only some part of template. It looks like every line of text in RadRichTextBox is a different span even if paragraph is the same.
1. How can I identify the whole template in this case?
2. How can I replace the template if it is divided into several spans?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 29 Jun 2011, 04:42 PM
I've found the solution.
Tags
RichTextBox
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Share this question
or