Free Support Forum - aspose.com

Error opening file using Excel

I have an existing xls file (created in Excel) and using Aspose.cells I open the file, change the formula in one cell and write the file back out. I open and save using 97to2003 format. After saving the file with Aspose, when I open it with Excel 2007 I get the error "Office File Validation detected a problem while trying to open this file. Opening it may be dangerous." The file does open if I click Open and appears ok. I'm using the most current dll I could find (7.0.4.4).

The code I'm running is below. Note that I've tried using a filestream to write the workbook back out (using filemode.create) with no difference.

Sub FixWeeklyDate(ByVal strName As String)
Dim workbook As Workbook

Try
Using fsworkbook As FileStream = New FileStream(strName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim loOptions As LoadOptions = New LoadOptions(LoadFormat.Excel97To2003)
workbook = New Workbook(fsworkbook, loOptions)
End Using

workbook.Worksheets("Weekly Data").Cells(8, 0).Formula = "=INDEX('Daily Data'!A9:A5000,7-(MOD(INDIRECT(""'Daily Data'!A9"")-DATE(2006,9,29),7)),1)"

Dim strSaveName As String
strSaveName = "c:\SQLDiff\" & strName
workbook.Save(strSaveName, SaveFormat.Excel97To2003)

end sub

Hi,

Thanks for posting your problem and considering Aspose.Cells.

I was able to reproduce the problem when the file is just opened and saved in xls format.

Below is a sample code and I have attached the output file and screenshot for your reference.

We have logged this issue in our database. We will look into it and fix the problem and update you asap.

This issue has been logged as CELLSNET-40255.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\test\011 LNG Pipeline Vol Daily.xls”;


Workbook workbook = new Workbook(filePath);

workbook.Save(filePath + “.out.xls”);

Screenshot:

Hi,

Please download and try the latest fix: Aspose.Cells for .NET (Latest Version)

Thanks for the quick response, it now works correctly.

Rick

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

i am also same issue, I am using excel 2010 to open the file… Also, am not able to find version 7.0.4.5 to download. When using either 7.0.4 or 7.1 , i am facing the same issue…


Please investigate

Hi,

Please use this latest version instead:
Aspose.Cells for .NET (Latest Version)

It contains the fixes of all previous fixes.

Thanks it worked fine…

Can you tell me what causes this error? We’re having it too but we don’t have a license for the latest version. Ours is 4.6. If I knew what caused it maybe I can avoid it.

dasamigo9:
Can you tell me what causes this error? We're having it too but we don't have a license for the latest version. Ours is 4.6. If I knew what caused it maybe I can avoid it.
Hi,

Thanks for your posting and using Aspose.Cells.

I am afraid, this is very generic error. It can occur because of many known/unknown reasons. Also, this error relates to corruption of internal structures, so you cannot avoid it from outside.

If you encounter such an error, you will have to try the latest version or report it to us, so that it could be investigated by development team and be fixed.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.