8 Answers, 1 is accepted
RadDocument is the base class representing the document of RadRichTextBox. The product category of this forum is dedicated to Telerik Document Processing libraries, so I am not sure which component that you are using. Can you please specify the product and elaborate more on what exactly you would like to change so I can better assist you?
Sorry for the simple question. I'll be more specific!
I have a document created with RadDocumentEditor (created with a combination of other merged RTF documents). But in my application, the user must choose different templates of documents pre-configured for printing this "merged documents". Templates have different page sizes and margins for each even / odd page. So, I need to get this document created and apply specific page margins and page sizes on each page generated by RadDocumentEditor. This final formated document will be sent to the printer.
I hope I have made my doubt clear.
To achieve the desired behavior, you can benefit from the functionality of Section class. The Section exposes several properties that allow you to customize the layout of the elements placed underneath it. Please take a look at our Section article where you can find detailed information on the matter.
I hope that this helps.
I had already researched about the Section class. However, I have not been able to reach the specified goal yet. How can I trigger the creation of a new section as the pages are being created? I have not found any events that trigger as soon as a new page appears in the document. Can you put me in the right direction?
There is no specific event notifying about the creation of a page. Actually, the Open XML format allows you to specify the properties of a page through the Section and all the pages in a single section have the same settings. If you would like to separate the pages on different sections so you can control their properties separately, you can do this using continuous section breaks. What you would need to do is to move the caret to the last position in the page using the MoveTo~() methods of the caret position and insert a section break there:
Once you have divided the pages into different sections, you can control their properties through the members of the Section class.
Hope this is helpful.
Thanks for the help. But I'm still stuck with this issue...
Follow the code I'm using. The creation of a section for each page of the document is not working. With the folowing code all the sections are created in the same page (In the page two to be more specific). The combination of the two documents It's working perfectilly. Can you explain to me what I'm doing wrong?
The Continuous section break creates a new section but doesn't transfer it to another page. If you would like to create the sections on different pages, you would need to use the SectionBreakType.NextPage. More information about the different types of section breaks is available in the Section help article.