RichTextBox and DocumentTextSearch loading

2 posts, 0 answers
  1. Javier
    Javier avatar
    7 posts
    Member since:
    Jun 2014

    Posted 23 Feb 2015 Link to this post

    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?
  2. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 26 Feb 2015 Link to this post

    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.

     
  3. DevCraft banner
Back to Top