Combine workbooks does not preserve worksheets PageSetup

Hi,

I use v.6.0.17.

I. Workbook.Combine() method copies worksheets from one workbook to another but I found that it does not preserve worksheets' page setup so I have to manually copy it for each sheet, property by property (and using methods like .GetEvenFooter() and .SetEvenFooter()) as the PageSetup property is read-only. It's a very unconvenient approach:

targetSheet.PageSetup.BlackAndWhite = sourcePageSetup.BlackAndWhite;
targetSheet.PageSetup.BottomMargin = sourcePageSetup.BottomMargin;

s = sourcePageSetup.GetEvenFooter(0);
if (s != null)
{
targetSheet.PageSetup.SetEvenFooter(0, s);
}

I think that .Combine() method should do this job.

II. Another issue is with Header/Footer picture methods:

Aspose.Cells.Drawing.Picture p = sourcePageSetup.GetPicture(false, 0);
targetSheet.PageSetup.SetFooterPicture(0, p.Data);

SetFooterPicture() uses only binary data and does not set the picture properties (like Height, Width etc). I have to set it manually again.

In this scenario, I set up a footer picture (Page Layout/Print Titles-> Header/Footer tab in Excel 2010) for wb2.Worksheets["S1"], then combine another workbook with this one wb1.Combine(wb2) and copy PageSetup property as I described above for each worksheet. As a result, print preview in Excel looks different for the same sheet in combined wb1 and in the original wb2 - size of the pictures are different.

Please advice.

Thanks,
Leo

Hi,



Please try our latest fixed version: v7.0.2.2, if it works fine for your first issue.

1) Try the latest version v7.0.2.2. If yous find any issue, give us your sample code, template files to show the issue.

2) Please try PageSetup.GetPicture() method to extract picture from the header/footer and then set Picture’s properties accordingly.
e.g

Aspose.Cells.Drawing.Picture pic = pageSetup.GetPicture(true, 0);
pic.Height = ____ ;
pic.Width = _____;



Thanks

1) Combine works fine in 7.0.2.2; It preserves Print Areas. However it looks like it does not preserve Even/Odd page setup (the first thing I checked eventually);
2) Pictures have right properites in 7.0.2.2.

Thanks for quick response,
Leo

Btw, it's probably a good idea to provide more convenient way of copying PageSetup from one sheet to another rather then setting property by property (I did not consider using reflection at all)

Could you please tell me where can I get a list of issues fixed since v.6.0.1.7?

We have another issue with the files generated - Excel crashes in print preview (i.e. Excel stops working). I found a line causing the problem. It was worksheet.VisibilityType = VisibilityType.VeryHidden; It was called before .Combine(). Moving it after .Combine() method helps and generated files are successfully opened in Excel for print preview. Has it been fixed in 7.0.2.2?

Thanks,
Leo

Hi,


1) “Could you please tell me where can I get a list of issues fixed since v.6.0.1.7?

Please check the release notes for v7.0.0, v7.0.1 and v7.0.2 to know which issues are fixed in different releases:
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry324931.aspx
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry328122.aspx
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry335485.aspx

2) “We have another issue with the files generated - Excel crashes in print preview (i.e. Excel stops working). I found a line causing the problem. It wasworksheet.VisibilityType = VisibilityType.VeryHidden; It was called before .Combine(). Moving it after .Combine() method helps and generated files are successfully opened in Excel for print preview. Has it been fixed in 7.0.2.2

It should work fine with v7.0.2.2, could you try it. If you still find the issue, give us your complete sample code and template files(input (if you have) and output file with screen shot(s)), we will check it soon.

Thank you.