Worksheet.Copy not working between Workbooks


#1

Worksheet.Copy is not working
Version 4.0.2.8
Also fails with version 4.0.2.0 .6, and .7

It worked just fine in version 3.7.1.0
I have attached the template file I am using.

Here is the code to generate this error.

Workbook excelWorkbook0 = new Workbook();
Workbook excelWorkbook1 = new Workbook();
excelWorkbook0.Open(@"C:\Template.xls");

excelWorkbook1.Worksheets[0].Copy(excelWorkbook0.Worksheets[0]);
excelWorkbook1.Save(@"C:\Final.xls", FileFormatType.Default);

This code works just fine

Workbook excelWorkbook0 = new Workbook();
excelWorkbook0.Open(@"C:\Template.xls");

Worksheet ws0 = excelWorkbook0.Worksheets[0];
excelWorkbook0.Worksheets.Add();
Worksheet ws1 = excelWorkbook0.Worksheets[1];

ws1.Copy(ws0);

excelWorkbook0.Save(@"C:\Final.xls", FileFormatType.Default);


#2

Please try this attached v4.0.2.9.


#3

This works in correcting this problem but the problem you fixed with version 4.0.2.8 is back.

The example is in my post 56892. Your post of 56897 sent to me was its correction.

Thanks James


#4

Sorry, my bad.

I was using the wrong .dll.

It works just fine.

Thanks for your help. James