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

Free Support Forum - aspose.com

Header/Footer not aligning with page margins when using FileFormatType.Pdf


I am creating a worksheet with the property worksheet.PageSetup.IsHFAlignMargins = true; This works fine when I save the workbook as a xlsx document. However, when I save the workbook using workbook.Save(path, Aspose.Cells.FileFormatType.Pdf); the header and footer margins are not aligned with the rest of the document which uses 0.5" margins.

Is there a way to get the header footer properly aligned to the page margins when using FileFormatType.Pdf?


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

Thank you for considering Aspose.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our internal issue tracking system with issue id CELLSNET-13650.

Thank you & Best Regards,

I haven't gotten a reply to this post in the last week, so I'm going to add some more information in case the initial message was not clear.

I have set up a worksheet's PageSetup as follows:

worksheet.PageSetup.PaperSize = PaperSizeType.PaperLetter;

worksheet.PageSetup.LeftMarginInch = 0.50;

worksheet.PageSetup.RightMarginInch = 0.50;

worksheet.PageSetup.IsHFAlignMargins = true;

worksheet.PageSetup.SetHeader(0, "Left Header Text..");

worksheet.PageSetup.HeaderMarginInch = 0.75;

This properly displays the "Left Header Text.." header at 0.5" from the left when the workbook is saved as an Excel 2007 file. However, when the workbook is saved as a pdf file, the header text ends up indented about 1" rather than 0.5". I have attached an image of the top left part of the PDF and Excel files display.

So, is this a problem in Aspose.Cells and is there a way to work around it?


Thanks for your further details.

As we have replied your issue was registered into our issue tracking system with an issue id: CELLSNET-13650. I am afraid, the issue is not resolved yet. We will surely inform you when it is sorted out.

Thanks for being patient!


Please try the attached version.

Kindly let us know if it works fine now.

Thank you.


The attached version does fix the header alignment problem, but now the png picture that I was displaying in a cell below the header does not get its transparent background rendered properly. The background comes out as black rather than white like the cell's background. This is only in the PDF file format. Picture transparency was not a problem with the previous version.

Please advise,


Kindly post your input excel and output pdf files here to check your issue. We will check your issue soon.

Thank you.

I have attached an Excel and a PDF file that are generated using the same Aspose.Cells code, but saved to alternate Aspose.Cells.FileFormatType using Workbook.Save(). Note that the bitmap picture (also attached) does not show its transparancy in the PDF format. This was working in the previous version.

Also note that the PDF version does not support gradient shadning. This was not working in the previous version either and we accepted this as a limitation of Aspose PDF. Full gradient support in Aspose PDF would be appreciated for the future.


Sig Isaac


Thanks for providing us template files.

We found the issue as you have mentioned after an initial test.

We have logged your issue into our issue tracking system with an issue id: CELLSNET-14183.

Thank you.


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

Please try the attached latest version of Aspose.Cells. We have fixed your mentioned issue.

Thank You & Best Regards,

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

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