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

Copy page layout of RadDocument to other RadDocument

4 Answers 151 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
aubrey
Top achievements
Rank 1
aubrey asked on 23 Jun 2011, 02:20 AM
Good Day Telerik Team,

Is there a way to get the properties (like Page Orientation and margin) of a radDocument, so that i can apply it to other RadDocument?

here's my code:
RadDocument doc = new RadDocument();
 
this.radRichTextBox1.Document.Selection.SelectAll();
 
doc = this.radRichTextBox1.Document.Selection.CreateDocumentFromSelection();
doc.CaretPosition.MoveToFirstPositionInDocument();
 
prev.rtbPrev.Document = doc;    
prev.rtbPrev.Document.LayoutMode = radRichTextBox1.Document.LayoutMode;
prev.rtbPrev.Document.CopyPropertiesFrom(radRichTextBox1.Document);

hoping for your reply,
Aubrey :')

4 Answers, 1 is accepted

Sort by
0
aubrey
Top achievements
Rank 1
answered on 23 Jun 2011, 03:00 AM
Hi Telerik Team,

can i ask for a code snipset for this?

thanks,
Aubrey :')
0
Andrew
Telerik team
answered on 28 Jun 2011, 02:17 PM
Hi aubrey,

Indeed the CopyPropertiesFrom(DocumentElement element) method doesn't copy PageOrientation or Margin properties. If you want to do that, you can try setting them explicitly using the following approach:

prev.rtbPrev.Document.SectionDefaultPageOrientation = radRichTextBox1.Document.SectionDefaultPageOrientation;
You can repeat that for every property you need to copy. Please note that besides SectionDefaultPageOrientation, the Section may have its own PageOrientation set, so they must be copied on a per-Section basis too. However, this cannot be done using CopyPropertiesFrom as it currently does not copy these properties. This was a bug in earlier version and is fixed for the official Q2 2011 release.

If other question occur contact us again.

Greetings,
Andrew
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
aubrey
Top achievements
Rank 1
answered on 29 Jun 2011, 09:24 AM
Hi Andrew,

I,ve done that one:
prev.rtbPrev.Document.SectionDefaultPageOrientation = radRichTextBox1.Document.SectionDefaultPageOrientation;

but it only retrieves radRichTextBox1 default pageOrientartion. Is there a way that i can retrieve radRichTextBox1's current Orientation and Margin?

Thanks,
Aubrey

0
Accepted
Boby
Telerik team
answered on 01 Jul 2011, 08:02 AM
Hi Aubrey,
Please refer to the explanation in the other forum thread you opened.

Best wishes,
Boby
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
Tags
RichTextBox
Asked by
aubrey
Top achievements
Rank 1
Answers by
aubrey
Top achievements
Rank 1
Andrew
Telerik team
Boby
Telerik team
Share this question
or