Free Support Forum -

Corrupting Excel Files

We are using aspose to open excel files, insert a few (4) small pieces of data, and then saving the resulting file to a directory. For some reason, files that were working with Aspose.Cells 3.7 are now not working with (which we installed to fix a copy and paste problem that was causing Excel to crash). The files become corrupted and when I attempt to open them using Excel 2000 I recieve the following message:

Microsoft Excel - [Name of file]: EXCEL.EXE - Application Error

The instruction at "0x301377a4" referenced memory at "0x0086edbc". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program

I have uploaded an example of a file that has been corrupted by this process. Note: the file contains macros, but the problem happens even if you disable them.

Here is the code we are using to open, edit, and save the file:


Private Function ExcelDownload(ByVal drDocument As DataRow) As Boolean

'set license for aspose.cells

Dim license As Aspose.Cells.License = New Aspose.Cells.License


'create instance of aspose.cells.workbook

Dim objExcel As Aspose.Cells.Workbook = New Aspose.Cells.Workbook

Dim strDocumentName As String

Dim strDocumentFullPath As String

Dim strSaveFullPath As String

Dim strFullFileName As String

Dim drParameterList As DataRow()

Dim intPKPBorrowerID As Integer

Dim strDealRelationship As String

Dim strEntityIndividual As String

'get the name and path of the master spreadsheet

strDocumentName = drDocument.Item("DocumentName").ToString

strDocumentFullPath = drDocument.Item("DocumentFullPath").ToString

'get the name and path to which the spreadsheet should be saved

strSaveFullPath = drDocument.Item("SaveFullPath").ToString

'get the parameter information for the spreadsheet

drParameterList = pobjDocumentParameterList.GetParameterData(CInt(drDocument.Item("DocumentID")))

With drDocument

intPKPBorrowerID = CInt(.Item("PKPBorrowerID"))

strDealRelationship = .Item("DealRelationship").ToString

strEntityIndividual = .Item("EntityIndividual").ToString

End With

If Not strDocumentFullPath Is Nothing Then


'use the parameter information to place data in the spreadsheet

For Each drParameter As DataRow In drParameterList

Select Case drParameter.Item("ParameterName").ToString

Case "DealID"

With objExcel.Worksheets("Download")

'blank out the dealid column header to tell the spreadsheet to automatically

'refresh the first time the spreadsheet is opened.

.Cells(drParameter.Item("ParameterPlace").ToString & "1").PutValue("")

'enter the dealid into row 2 of the given column (usually 'A')

.Cells(drParameter.Item("ParameterPlace").ToString & "2").PutValue(pintDealID)

End With

Case "PKPBorrowerID"

With objExcel.Worksheets("Download")

'enter the dealid into row 2 of the given column

.Cells(drParameter.Item("ParameterPlace").ToString & "2").PutValue(intPKPBorrowerID)

End With

Case "DealRelationship"

With objExcel.Worksheets("Download")

'enter the dealid into row 2 of the given column

.Cells(drParameter.Item("ParameterPlace").ToString & "2").PutValue(strDealRelationship)

End With

Case "EntityIndividual"

With objExcel.Worksheets("Download")

'enter the dealid into row 2 of the given column

.Cells(drParameter.Item("ParameterPlace").ToString & "2").PutValue(strEntityIndividual)

End With

End Select

Next drParameter

'create the subdirectories needed to save the spreadsheet to the specified location

CreateSubDirectories(Left(strSaveFullPath, strSaveFullPath.LastIndexOf("\")))

'save the new spreadsheet


'clean up Aspose.Excel


objExcel = Nothing

End If

'clean up

strDocumentName = Nothing

strDocumentFullPath = Nothing

strSaveFullPath = Nothing

strFullFileName = Nothing

ExcelDownload = True

End Function


Any ideas what we can do?


We ran the debugger on the file and here is where the code stops executing:

3014A210 push dword ptr [ecx+eax*4+4]

I am attaching a version of the original file, prior to Aspose.Cells working with it.


I am investigating a cut-and-paste problem (with email hyperlinks) in our application. Is there anything that you can tell me about your issue that might help me? Thanks.

I cannot explain why Aspose.Cells (3.7) stopped working with our files.

We used it to open a pre-existing spreadsheet, insert a few words into a couple cells, and then save the file as a new file on the server. For several months the resulting files were perfect and then we started experiencing problems a month ago.

At that point, any spreadsheet that went through the process described above with Aspose.Cells would cause Excel to crash when a user attempted to copy any cell and paste it into another workbook. The original spreadsheet (prior to being copied and saved) does not suffer from this problem.

We took this opportunity to download Aspose.Cells and found that it (somehow) caused the problem to go away.

Now the problem is that ‘some’ spreadsheets that go through this process will cause Excel to crash when they are opened. Normally this would lead me to believe there was a problem with ‘some’ of our spreadsheets, however, the template (or original) spreadsheets work fine and these same sheets were working fine with Aspose.Cells 3.7.

We tried using, but that didn’t help.

I don’t really have any other information at this point. Do you have a specific question?

It’s caused by the images files in your template file. We tried to provide the ability to access image in template files in recent version but found this action caused some problems. We rolled it back now. Now final testing is doing. Thanks for your patience.

Please try this attached version.


Thank you for your help. I installed the DLL that you sent me. I tested it against all of our Excel download templates for the copy and paste issue and the crashing when opening issue and it passed every test.

Thank you again.