Free Support Forum - aspose.com

Error while copying Worksheets

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

I’m using a template file to set up product specific comprehensive reports. During the generation process I copy worksheets from the template into the final report file. Thereby I reuse template worksheets as much as possible. After the upgrade from Aspose 5.x to 7.3 everything worked fine. Last week I changed the size of the plotting area within one template worksheet. Since this point of time, I’m unable to reuse these worksheets. Ther first usage is ok, but the second usage results in an exception.

Can you please check this? Please find attached also the sample source code, the sample excel file (template) as well as the error message.

Thanks in advance

Code:

private static void Kopieren()

{

string path = System.Windows.Forms.Application.StartupPath;

License l = new License();

l.SetLicense("Aspose.Total.lic");

//Vorlage

Workbook template = new Workbook(Path.Combine(path, "example.xls"));

//Erzeugen einer neuen Arbeitsmappe

Workbook wb = new Workbook();

KopiereTemplates(template, wb, "Chart", "Chart 1");

KopiereTemplates(template, wb, "Chart", "Chart 2"); //Without this line, the code can be executed without en error message

KopiereTemplates(template, wb, "Data", "Data 2");

wb.Save(Path.Combine(path, "test.xlsx"), SaveFormat.Xlsx);

}

public static void KopiereTemplates(Workbook wb_template, Workbook wb, string template, string name)

{

if (template.Length > 0)

{

if (wb_template != null)

{

Worksheet ws = wb_template.Worksheets[template];

if (ws != null)

{

int index = wb.Worksheets.Add();

wb.Worksheets[index].Copy(ws);

wb.Worksheets[index].IsVisible = true;

wb.Worksheets[index].Name = name;

}

}

}

}

Hi,

I have logged a ticket with an id: CELLSNET-41160 for your issue. Once we figure it out, we will let you know here.

Hi,

We have fixed this issue.

Please download and try this fix: Aspose.Cells for .NET v7.3.3.2 and let us know your feedback.

Hi,

great! It seems to work fine.

Thank you

Erik

Hi,

Thanks for sharing your feedback.

It’s good to know that your issue is resolved with this latest fix.

Let us know if you face any other issue, we will be glad to help you asap.

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


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