We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Top margin docx document wrong when printing

hello aspose,

When i make a new docx document with some text and print this it works great. It is the same as when printing it from Word itself.

So i took a existing document which we already use for internal use. When i print this one, it does not print ok. It misses the top of the document because the wrong offset.Offcourse it works great when you print from Word.

When you open the document you will see an address on the top-right side. When i print this with your DLL then the whole 1 page was moved to the top and the text "Nobel" is lost and the half of the text "Rietveldeweg 72" is printed at the top of the print.

Is there restriction with borders or margins in a document?
Could you please exam my document and look if you can reproduce it?

Thanks in advance



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

Best regards,

Hello andrey,

I'm glad you can reproduce it.
If you already have a workaround for this ( change borders,margins or something), please let me know.

I will be notified by mail?
Or can i see somewhere the status of the linked issue?

Thanks in advance


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please try setting PageSetup.TopMargin manually before printing:

doc.Sections[0].PageSetup.TopMargin = 25;

You will be notified by e-mail.

Hope this helps.

Best regards,

Hello Andrey,

Thank you for that code.
I tried that code and it works perfect. That was a trigger to test something more.
I discovered that, with my document, the value of that property was -70.

So i did this :

If doc.Sections(0).PageSetup.TopMargin < 0 Then

doc.Sections(0).PageSetup.TopMargin = doc.Sections(0).PageSetup.TopMargin * -1

End If

When i print my document now it prints exactly on the right place which Word would do, so that is perfect. ( maybe the solution for your DLL too?)

One last question:
i want this for every page offcourse.
Your property "Sections", are those all the pages or what is the definition of a section?
What i mean, if i have a docx file with 3 pages in it. Can i do this:
doc.Sections(0).PageSetup.TopMargin = doc.Sections(0).PageSetup.TopMargin * -1
doc.Sections(1).PageSetup.TopMargin = doc.Sections(1).PageSetup.TopMargin * -1
doc.Sections(2).PageSetup.TopMargin = doc.Sections(2).PageSetup.TopMargin * -1

Thanks again!


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I think in this case you can use loop foreach:

// Loop through all Sections.

foreach (Section sect in doc.Sections)


sect.PageSetup.TopMargin = sect.PageSetup.TopMargin * -1;


Best regards,

The issues you have found earlier (filed as 16161) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.