AddCopy Problem

I am using your Cells product and creating a workbook from a template we have created. I have 4 sheets which are populated with data and then I have one sheet which I use Addcopy to dynamically create many new sheets. If I do not create new sheets I have no problem. If I create a new sheet then I cannot open the xls file without getting file errors. her is the code that executes to add new sheets. Any ideas?

wb.Worksheets.AddCopy("Facility")

wb.Worksheets.ActiveSheetIndex = x + 4

ws = wb.Worksheets.Item(x + 4)

If Len(ProcessLevel(x).ToString & " - " & ProcessLevelDisplayName(x).ToString) > 31 Then

ws.Name = (ProcessLevel(x).ToString)

Else

ws.Name = (ProcessLevel(x).ToString & " - " & ProcessLevelDisplayName(x).ToString.Replace("/", " "))

End If

Hi,

Thanks for considering Aspose.

Could you try the attached version. I tested and tried the following sample code using a template file and it works fine. I opened the output file into MS Excel and it opened fine.

[C#]
Workbook wb = new Workbook();
wb.Open("d:\\test\\Template_book .xls");
for (int i = 0;i<5;i++)
{
wb.Worksheets.AddCopy("Module_Detail");
}
wb.Save("d:\\test\\TestNewAddCopy1.xls")
[VB]
Dim wb As Workbook = New Workbook()
wb.Open("d:\test\Template_book .xls")
Dim i As Integer
For i = 0 To 4
wb.Worksheets.AddCopy("Module_Detail")
Next
wb.Save("d:\test\TestNewAddCopy1.xls")
If you still find the issue, kindly post your template file here.
Thank you.

How do I post the template so that you may use it.

Hi,

If you reply the post, you will see "File attachment " below edit box. Click "Add/Update",then.....

This is the file. The sheet I copy is the one named “Facility”. When I open the xls file I get a message that file is damaged and it does a recover. If I save the file and reopen everything looks fine. Could it be that I am running the trial version? I am using VB in VS2005 with a Web Project. Thanks for the help.

Hi,

Thanks for the template file.

We found the issue and will figure it out soon.

Thank you.

Hi,

Please try the attached version.

Thank you.

The correction did not fix the issue. Any ideas?

Hi,

Well, I have no problem at all. I utilized your template file and implement AddCopy() method, the output file (attached) is fine. Please make sure that your are using the lastest fix which I posted in my previous post in this thread.

Following is my sample code and attached the output file.

Workbook wb = new Workbook();
wb.Open("d:\\test\\ScoreCard_Template.xls");
for (int i = 0;i<5;i++)
{
wb.Worksheets.AddCopy("Facility");
}
wb.Save("d:\\test\\Test_AddCopy_2.xls");

If you still find the problem, please create a sample console app with your template file, zip it and post it here. We will check it soon.

Thank you.

I tried it again and it worked but I lost some of the formatting with your new dll. I received my license file this morning and I uninstalled cells and reinstalled the orginal version and everything is now working fine. I guess the fact that it was the trial version was the culprit. Thank You for your help.

We have the same problem with Aspose.Cell v4.4.0.0.

Replacing DLL with your (4.4.0.23) helps to fix the problem.

Thx!