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

Problem of InsertPageBreak

2 Answers 60 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
alino
Top achievements
Rank 1
alino asked on 12 May 2011, 07:35 PM

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 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 17 May 2011, 05:15 PM
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
0
alino
Top achievements
Rank 1
answered on 20 May 2011, 04:14 PM
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
Tags
RichTextBox
Asked by
alino
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
alino
Top achievements
Rank 1
Share this question
or