Hi,
in Error on second call to license file you wrote
Laurence wrote: |
When you call save method, many data contained in the Excel object is changed to generate the result file.
|
|
Why is this necessary?
I see that in a web environment after a save the use of this excel object is no more of intrest, but in a windows forms app, it could be.
The solution you provide in this thread is obvious, but why don’t do the save method this copying to leave the origin object intact?
Besides this the copying is unfortunately not working in VB.NET. I get a ‘System.ArgumentNullException’ in mscorlib.dll: ‘Key could not be null’ and don’t have any glue why.
best regards
Dominik
PS: could you provide the version number to the download files (either msi or zip)?
Hi Dominik,
When saving to disk, a lot of internal conversions and calculations are done. It’s complex to leave it intact. We provide Excel.Copy method to preserve the data.
[C#]
Excel excel1 = new Excel();
//… Do something on excel1
Excel excel2 = new Excel();
excel2.Copy(excel1);
//Save file
excel1.Save(…);
//Release excel1 and you have excel2 for future use
excel1 = null;
[VB]
Dim excel1 As Excel = New Excel()
'… Do something on excel1
Dim excel2 As Excel = New Excel()
excel2.Copy(excel1)
'Save file
excel1.Save(…)
'Release excel1 and you have excel2 for future use
excel1 = Nothing
Could you post your code here or send it to me? I will investigate your code to see what caused your problem.
In the msi, version is 2.0 and the zip file is 2.2.4.
Hi Laurence,
first, thanks for the prompt answer.
Second: What I thought about the save is: If the save method is called it can do the copying and then save the copy and destroy it. Then the origin object would not be touched an can be used appropriate (and I don’t have to bother with the copy )
It’s just a proposal.
Third: I tried to do this copy but it doesn’t work
Dim _excel as new Excel(LicenseFile) 'class object
public sub DoSomething()
’ …
’ _excel.Worksheets(EXPORT_SHEET).Cells.ImportDataTable(dt, True, 1, 0)
Dim localExcel As New Excel
localExcel.Copy(_excel) ’ causes System.ArgumentNullException
localExcel.Save(_excelPath, FileFormatType.Default)
end sub
Forth: Shure I can look inside the files (at least to the zip file), what i meant was this: could you append the version to the downloadfiles like Aspose.Excel.2.2.0.0.msi or Aspose.Excel.2.2.4.0.zip. Than it would be a lot of easier to track the downloads
Dominik
Hi Dominik,
Do you use a designer file(template)? I think maybe that cause the copy problem. Could you send me you designer file and more of you code? Thanks.
The zip file is always most updated. Thanks for your suggestion. I will talk with my colleagues about it.
Hi Dominik,
Please download the latest hotfix. I fixed this problem.
Thanks,
it’s working now
Dominik