Problem of InsertPageBreak

3 posts, 0 answers
  1. alino
    alino avatar
    22 posts
    Member since:
    Sep 2010

    Posted 12 May 2011 Link to this post


    hi,
    I have problem with  InsertPageBreak method of RadDocument. When i call this method even the document already has content, it always add PageBreak on the beginining of the document. But i thought when i call the PageBreak method, it should add it after the current Content not always on the top.
    How can I solve this problem??

    Thanks for your help.

    Alino
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 17 May 2011 Link to this post

    Hello Alino,

    The InsertPageBreak methods of both RadDocument and RadRichTextBox add the line break at the current caret position and the default caret position is at the beginning of the document.
    You can insert the line break at the end of the document by moving the caret position to the end of the document like this:

    document.CaretPosition.MoveToLastPositionInDocument();
    document.InsertLineBreak();

    More information on document positions can be found here
    Note that if you are not showing the document in a RadRichTextBox in the visual tree, you need to measure and arrange the document before being able to use methods from RadDocument's API:
    private void MeasureAndArrangeInDefaultSize(RadDocument document)
    {
        document.Measure(RadDocument.MAX_DOCUMENT_SIZE);
        document.Arrange(new RectangleF(PointF.Empty, document.DesiredSize));
    }

    I hope this helps.


    Greetings,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. alino
    alino avatar
    22 posts
    Member since:
    Sep 2010

    Posted 20 May 2011 Link to this post

    Hi Iva,

    Thanks you very much for your answer il will try it and let u know if it solve my problem.

    King regards,

    Alino
Back to Top