RadDocument Insert in Selection range

2 posts, 0 answers
  1. Manuel
    Manuel avatar
    61 posts
    Member since:
    Oct 2011

    Posted 28 Dec 2011 Link to this post

    Hi there,

    I've this code:

     private void ReplaceAllMatches(string toSearch, string toReplaceWith,RadDocument doc)
                DocumentTextSearch search = new DocumentTextSearch(doc);
                List<TextRange> rangesTrackingDocumentChanges = new List<TextRange>();
                foreach (var textRange in search.FindAll(toSearch))
                    TextRange newRange = new TextRange(new DocumentPosition(textRange.StartPosition, true), new DocumentPosition(textRange.EndPosition, true));

                foreach (var textRange in rangesTrackingDocumentChanges)
                    string textoSeleccionado = doc.Selection.GetSelectedText();

                    DocumentPosition posInicial = textRange.StartPosition;
                    DocumentPosition posFinal = textRange.EndPosition;
                    DocumentPosition posTotal = new DocumentPosition(posInicial);

                    doc.Insert(toReplaceWith,new Telerik.Windows.Documents.Model.Styles.StyleDefinition());

    So I´ve the word that I want replace selected, how I can get that range to replace here, with RadDocument?

    Thanks in advance,

  2. Boby
    Boby avatar
    685 posts

    Posted 30 Dec 2011 Link to this post

    Hello Manuel,
    It looks you've found the answer in the other thread you opened. Don't hesitate to contact us if you have other questions.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top