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