Error Copying Data from aspose workbook to new Excel Workbook

We are experiencing a problem when a user opens an Cells generated excel file and attempts to copy the data into a new workbook. Here are the duplication steps along with an attached excel file to demonstrate the problem.

1) Open the attached Excel file.
2) Select the data tab
3) Select A1 through O16, use ctrl-c to copy
4) Use File menu and select New
5) When the new dialog pops up select Workbook and click the Ok button
6) Paste the data onto sheet 1 of the new workbook using ctrl-v .
You should receive a "memory could not be read" error.

Additional information, we are using Office 2k SR1.

Thanks,
Chris

Hi Chris,

I found this problem in Excel97 and Excel2000 but it works fine in ExcelXP and Excel2003, very strange. Could you please post your sample project to create this file? That will greatly help us to figure out the problem. Thank you very much.

Laurence,
This code is used to populate the data sheet. (VB.Net)

Public Sub LoadData(ByRef objpDataReader As OleDb.OleDbDataReader, ByVal spSheetName As String, ByRef ipRowCount As Integer, ByRef ipColumnCount As Integer, ByVal spRangeName As String)

TraceLog("RLWorkbook.LoadData(objpDataReader," & spSheetName & "," & ipRowCount & "," & ipColumnCount & "," & spRangeName & ")")

Dim iActiveSheet As Integer
Dim objSheet As Aspose.Cells.Worksheet
Dim objWorkSheets As Aspose.Cells.Worksheets
Dim objRange As Aspose.Cells.Range
objSheet = objmExcel.Worksheets(spSheetName)

objWorkSheets = objmExcel.Worksheets()
Try
' Try to get the pivot table position
iActiveSheet = objWorkSheets.Item(System.Configuration.ConfigurationManager.AppSettings.Get("PivotTableName")).Index
Catch ex As Exception
' has been renamed, this shouldn't throw an error.
iActiveSheet = objWorkSheets.ActiveSheetIndex
End Try

objSheet.Cells.Clear()

objRange = objmExcel.Worksheets.GetRangeByName(spRangeName)

If Not objRange Is Nothing Then
objSheet.Cells.ClearFormats(objRange.FirstRow, objRange.FirstColumn, _
objRange.FirstRow + objRange.RowCount, _
objRange.FirstColumn + objRange.ColumnCount)
Else
' Shouldn't be here, someone changed the rangename
End If

ipRowCount = objSheet.Cells.ImportFromDataReader(objpDataReader, True, 0, 0, False)

ipColumnCount = objpDataReader.FieldCount
objWorkSheets.ActiveSheetIndex = iActiveSheet
objpDataReader.Close()

End Sub
Public Sub SaveData(ByVal spSheetName As String, ByVal spFileName As String)

TraceLog("RLWorkbook.SaveData(" & spSheetName & "," & spFileName & ")")

Dim objSheet As Aspose.Cells.Worksheet

objSheet = objmExcel.Worksheets(spSheetName)

objmExcel.Save(spFileName, Aspose.Cells.FileFormatType.Excel97)

objSheet.Cells.Clear()

End Sub

Let me know if you need any additional code or information.
Thank you,
Chris

Hi Chris,

Please try this attached fix. If this problem still occurs, please post your output file with the new version.

Laurence,
This fix resolved the problem! Is this included in the 3.9.1 release?
Thanks again.

Chris

Yes. V3.9.1 includes this fix.