Free Support Forum - aspose.com

FitToPage#### not working when making copies

Version 4.0.2.6

Worksheets are not keeping the FitToPageWide and FitToPageTall settings when I copy a workbook and save.

I am required to do this due to a multi-threading issue that causes your program to error when I try to save a workbook that had its worksheets generated on multiple threads.

I works fine if I just save it without making a copy first. I just cannot use multi-threading to create the worksheets.


Workbook excelWorkbook0 = new Workbook();
Worksheet ws1 = excelWorkbook0.Worksheets[0];
ws1.Cells[0, 0].PutValue("A");
ws1.Cells[0, 7].PutValue("H");
ws1.Cells[0, 12].PutValue("M");

ws1.IsPageBreakPreview = true;
Aspose.Cells.PageSetup pagesetup = ws1.PageSetup;
pagesetup.FitToPagesWide = 1;
pagesetup.FitToPagesTall = 0;

Workbook excelWorkbook99 = new Workbook();
excelWorkbook99.Copy(excelWorkbook0);
excelWorkbook99.Save(@"C:\Final.xls", FileFormatType.Default);

Please try v4.0.2.7 attached at http://www.aspose.com/Community/forums/thread/56866.aspx . It’s fixed.