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

how to break paragraph into different paragraph ?

5 Answers 184 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Sopan
Top achievements
Rank 1
Sopan asked on 29 Aug 2013, 09:40 AM
Hi,

I want to divide the current selected paragraph into three different parts as paragraph. 
I have selected to words from the paragraph so, first paragraph is start position of original paragraph up to end position of selected word after then I want to insert new empty DocumentElement as Paragraph or Table. After then third paragraph as remaining words from the original paragraph.

How to do this.

see attached image for more details about functiopnality.

Thanks

5 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 02 Sep 2013, 12:39 PM
Hello Sopan,

The desired result can be achieved by creating a DocumentFragment of the content you wish to insert as "middle" paragraph and inserting it at the selection end position as follows:
if (!this.radRichTextBox.Document.Selection.IsEmpty)
{
    RadDocument doc = new RadDocument();
    Section section = new Section();
    Paragraph p = new Paragraph();
    p.Inlines.Add(new Span("Some text in new paragraph"));
    section.Blocks.Add(p);
    doc.Sections.Add(section);
 
    DocumentFragment fragment = new DocumentFragment(doc);
 
    this.radRichTextBox.Document.CaretPosition.MoveToPosition(this.radRichTextBox.Document.Selection.Ranges.First.EndPosition);
    this.radRichTextBox.Insert(FormattingSymbolLayoutBox.ENTER);
    this.radRichTextBox.InsertFragment(fragment);
}

I hope this helps! Let us know if you have further comments or questions.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Sopan
Top achievements
Rank 1
answered on 11 Sep 2013, 06:56 AM
Hi Petya,

Add Visibility property to DocumentElement in your next version of wpf Control if possible.

Thanks
Sopan Vaidya
0
Petya
Telerik team
answered on 13 Sep 2013, 09:38 AM
Hello Sopan,

Thank you for your feedback!

Unfortunately, implementing a Visibility property of document elements or providing any other way to collapse them is not considered at this point.

Let us know if you have other comments or questions.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Sopan
Top achievements
Rank 1
answered on 13 Sep 2013, 09:49 AM
Hi Petya

Thanks for replayed

Actually I am trying to implement a functionality like region in Visual studio which allow to collapse and expand the internal code within his limit
with the help of RadRichTextBox control, but such property or function is not available in RadRichTextBox. If you allow such property that is Visibility property to DocumentElement then this is possible.

Recently I am trying to implement such functionality, if you have any solution to implement same then please help me or try to implement in your next version rad controls.

Thanks
Sopan
0
Petya
Telerik team
answered on 17 Sep 2013, 04:39 PM
Hi Sopan,

As discussed in several of the other forum threads you opened on the topic implementing collapsible regions in RadRichTextBox is currently not possible. While I understand that exposing a Visibility property will allow you to implement your scenario we have no immediate plans for such functionality. Overall, collapsing parts of a document is a rather complex task as opposed to the client demand for it and I cannot tell if or when it might be available.

Do not hesitate to contact us if you have any other questions.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Sopan
Top achievements
Rank 1
Answers by
Petya
Telerik team
Sopan
Top achievements
Rank 1
Share this question
or