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

RichTextBox and DocumentTextSearch loading

1 Answer 56 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Javier
Top achievements
Rank 1
Javier asked on 23 Feb 2015, 10:05 PM
So I have a RadRichTextBox that I am using.  There are log files in which I want to import into the control:

RadDocument doc = new RadDocument();
doc = ImportText(dvm.LogText); //<-- this is a string, from TxtFormatProvider
logViewer.Document = doc;

Problem #1:  I have some log files that exceed 1MB in size, and I find the larger the log file, the longer it takes to load the control. 

And I also want to implement a search mechanism with word highlighting:

private void SelectAllMatches(string toSearch)
        {
            this.logViewer.Document.Selection.Clear();
            DocumentTextSearch search = new DocumentTextSearch(this.logViewer.Document);
            foreach (var textrange in search.FindAll(toSearch))
            {
                this.logViewer.Document.Selection.AddSelectionStart(textrange.StartPosition);
                this.logViewer.Document.Selection.AddSelectionEnd(textrange.EndPosition);
            }
        }


Problem #2:  So let's assume the RadDocument contains many results with the word "the" as a search term.  The bigger the file, the longer it takes for the DocumentTextSearch to parse through it all.

So here are my questions:

1. Is there any way to optimize the loading of larger text files into the RadRichTextBox control?  
2.  Is there a way for DocumentTextSearch to retrieve these results in a more optimal way?

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 26 Feb 2015, 09:04 AM
Hello Javier,

1. Generally speaking, some performance issues with large documents is expected. There are some tips regarding the control's performance in this help article but I'm afraid there isn't much you can do to improve the loading time in this case.

2. Regarding the TextSearch applies the same - the whole document should be checked for matches and these matches should be extracted when using the FindAll() method. You may find helpful to take a look at our Search And Highlight SDK demo that uses the Find() method for the visible layout boxes only.

Let me know if you have any other questions.

Regards,
Tanya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
RichTextBox
Asked by
Javier
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or