views:

110

answers:

3

I am testing one application that handles files (stored in sql server using filestream). It is a Delphi win32 application.

Opening a xls document stored in the db (originally saved with Office 2003) gives an error from Excel 2010 64bit.

Is there some known compatibility issues with Office 2010 64bit with win32 applications?

i am trying to get closer to the problem, but in the meantime I ask to have help.

*Additional notes:

When opening the file Excel gives the following error "Impossible to open the file FILE because of problems in contents"/"Impossible to open the file because some parts are missing or not valid".

Opening a file from machine A with office 2007 opens the file with no problems.

Opening the same file from machine B with office 2010 gives the problem.

Opening again from machine A it gives the problem! In all these steps I am just reading from db, not writing. So why this can happen?*

Extra update: how do I open the documents

These are the steps I use: 1. Select Query to get 'DOCUMENT' varbinary(max) field for Specific ID_Document.

  1. extract From Db using TBlobField(sqlQuery.FieldByName('DOCUMENT')).SaveToFile(sDestinationPath + FileUniqueName + .zip');

  2. Copy File from One Path to Another file using Windows.CopyFile

  3. Unzip file using TZipforge component

  4. Set attribute of unzipped file to readonly using FileSetReadOnly function.

  5. open document using

    ShellExecute(0, 'open', PWideChar(FIleName), '', '', SW_SHOWNORMAL);

As you can see there is nothing that writes back to the db. Once the file is extracted from TBlobField it is even copied to another place before unzipping and opening it.

FINAL NOTE:

Office has been reinstalled and now everything works, the problem of corruption was due to a conflict with an open office installation that asked "do you want to fix the office installation?". Anyway the problem still remains, because I cannot understand what happened. How can I corrupt a file in the DB if I extract in a folder and open it from the folder without psoting anything back to DB?

+1  A: 

Office 2010 64-bit should have no problems with files created with its 32-bit version. The files (.docx, .xls) are bitness independant.

I have some questions:

  1. How do you open your files?
  2. Can you show some code?
  3. Are you sure that you are only reading the file from the database?
  4. Do you give your files the right extension? Saving a .xls as .xlsx will cause problems when opening the file.
The_Fox
I extract a TBlobFIeld and save it as file. THan i Unzip it. Then I set it as readonly (in case i am just opening it for reading, while if I "check out" I don't set it readonly), then I open it with ShellExecute. THis works perfectly, but in the 64 bit system with 64 bit office I have this bad behaviour.
I will try to get a simplified version of what I do and post it.
I double checked and I am really not writing at all in the db, anyway I posted the steps above.
A: 

Check if your SQL server database is corrupt. Check disk where database is for errors. Reinstall SQL server.

avra
A: 

FOUND!!!

Guess? Bug!

There was an error in the logic that persisted the document status and by mistake some times Is_File_Compressed where set to False, even if it is True.

Thanks for the support.