Header and document margins

Hello

I'm creating xls document from a template "template_1.xls" (document with landscape orientation and certain document margins) .
After simple manipulation I save result file as "xlsio-result.xls":

ExcelEngine excelEngine = new ExcelEngine();
IWorkbook excelWorkbook = excelEngine.Excel.Workbooks.Open("d:\\template_1.xls");
IWorksheet excelSheet = excelWorkbook.Worksheets[0];
excelSheet.PageSetup.LeftHeader = "Header after xlsio";
excelWorkbook.SaveAs("d:\\xlsio-result.xls");

As you can see in "xlsio-margins.png" image or comparing "template_1.xls" and "xlsio-result.xls" documents header was changed.
Could you explain how to avoid such changing? I want header margins in result document remain the same as they are in a template. Is it possible?

Thanks Alexander.



xls-margins_66979a9e.zip

3 Replies

GM Geetha M Syncfusion Team November 6, 2009 11:22 AM UTC

Hi Alexander,

Thank you for your interest in Syncfusion products.

Could you please let me know if this file is generated using Excel 2007? This is because, I was able to see the same problem with your input file if opened in Excel 2003. It appears that you made set "Align with page margins" of Header / Footer tab of PageSetup, which is not available in Excel 2003.

preview.png

Please try adjusting left margin which is compatible with Excel 2003.

>Modified Template

Regards,
Geetha


AL Alexander November 6, 2009 03:14 PM UTC

Hello Geetha,

Thank you for your reply. Regarding your question, I did create template document using Excel 2007.
If I understood you right there is no way to alter header margins (left and right) in excel 2003 file format isn't it?

Thanks, Alexander.


GM Geetha M Syncfusion Team November 9, 2009 06:42 AM UTC

Hi Alexander,

If you have not set "Align with page margins", (in PageSetup->Header / Footer) and if you have used Margins to align the Header, then it is possible to get and alter the same result.

Regards,
Geetha

Loader.
Up arrow icon