How to use InsertReadOnlyRange from RadDocumentEditor

3 posts, 0 answers
  1. Pavel
    Pavel avatar
    2 posts
    Member since:
    Dec 2018

    Posted 11 Jun 2019 Link to this post

    Hi all,

    I am updating some code and it appears the use of InsertReadOnlyPage(DocumentPosition start, DocumentPosition end) from RadDocument is obselete and replaced by RadDocumentEditor.InsertReadOnlyPage().


    The original call was the following (note the parameters):

    1.editor.Document.InsertReadOnlyRange(start, end);

    Would this be equivalent the equivalent update?

    1.RadDocumentEditor _radDocEditor = new RadDocumentEditor(editor.Document);
  2. Boby
    Boby avatar
    763 posts

    Posted 14 Jun 2019 Link to this post

    Hello Pavel,

    You guessed this correctly, RadDocumentEditor works with the current selection (RadDocument.Selection) and position (RadDocument.CaretPosition) of its associated RadDocument.

    Just a small tweak, which might not be relevant, but still -  DocumentSelection.AddSelectionStart(*) will start adding new range to the selection, meaning that if you call this method multiple times, it will create selection with multiple ranges. Instead, you can use DocumentSelection.SetSelectionStart(*), which clears the current selection before starting the creation of a new range.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Pavel
    Pavel avatar
    2 posts
    Member since:
    Dec 2018

    Posted 14 Jun 2019 in reply to Boby Link to this post

    excellent. Yeah, I think I will have to perform a reset of the selection since we are dealing with a fresh selection based on the original premise of the original method.
Back to Top