We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Different Margins on first page

Hi,

I am wondering if there is a way to have different margins on the first page of a document created with DocIO?

thanks in advance,
John


5 Replies

GT Gunasekaran T Syncfusion Team October 13, 2010 06:25 AM UTC

Hi John,

Thank you for using Syncfusion products.

We have created a sample application to illustrate your requirement to apply different margin for first page of a word document created using DocIO. Please do find the sample in the attachment.

Please let us know if you have any other questions.

Regards,
Gunasekaran




Sample_1916dacf.zip


JS John Sivilla October 13, 2010 07:22 PM UTC

Thanks Gunasekaran for the sample code it is very kind.

Unfortantely, there is still an issue with the snippet.

In your code you
add a section to the document, set it's margins which appears on the first page, and add a break code.

You then add a paragraph, which is the only content which appears on the first page and then you set the section to null

The next step is that you add another section to the document, set different margins to it, and then add content that appears on all subsequent pages with the new margins.

The problem I am having with this is that I have content on the first page which may be longer than a page. According to your example, this is not possible. Please let me know if I am missing something or if there is a way to fix this.

thanks,
John







GT Gunasekaran T Syncfusion Team October 14, 2010 07:03 AM UTC

Hi John,

Thank you for your update.

In MS Word document the page margins will be applied for all the pages in a section. Different page margins cannot be applied for the pages in a section. In your case, the content that exceeds the first page can be added to a new section in order to apply different margin for first page.

Please let us know if you have any other questions.

Regards,
Gunasekaran




JS John SivillaDUPLICATE October 18, 2010 05:21 PM UTC

Hi Gunasekaran,

thanks once again for your response.

I just wanted to let you know that I did manage to get it working despite my requirement. I simply set SectionBreakCode.NoBreak on my second section. I had no break code previously. This did not break the section to the second page but rather continued from right after the first section, which contains the margins for the first page.

John





GT Gunasekaran T Syncfusion Team October 19, 2010 03:51 AM UTC

Hi John,

Thank you for your update.

Please set the break code for the second section as SectionBreakCode.NewPage for your requirement to apply different margin for first page. The SectionBreakCode.NewPage sets the section to start from a new page, Whereas SectionBreakCode.NoBreak sets the section to continue from the end of previous section.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Loader.
Live Chat Icon For mobile
Up arrow icon