Which problems exist when using 32bit applications that handle Office 2010 64bit files?

535 Views Asked by At

I am testing one application that handles files (stored in SQL Server using FILESTREAM). It is a Delphi 32bit application.

Opening an XLS document stored in the database (originally saved with Office 2003) gives an error from Excel 2010 64bit. Is there some known compatibility issue of Office 2010 64bit with 32bit applications?

Error messages and workflow

When opening the file Excel gives one of the following error messages:

  • 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 on machine A with Office 2007 opens the file with no problems. Opening the same file on machine B with Office 2010 produces the error message. Opening again on machine A there is also an error message! In all these steps I am just reading from the database, not writing. So why does this can happen?

How do I open the documents?

  1. SELECT query to get 'DOCUMENT' varbinary(max) field for the specific ID_Document.
  2. Extract from database using TBlobField(sqlQuery.FieldByName('DOCUMENT')).SaveToFile(sDestinationPath + FileUniqueName + .zip');
  3. Copy file from one path to another using Windows.CopyFile
  4. Unzip file using TZipforge component
  5. Set attribute of unzipped file to ROM using FileSetReadOnly function.
  6. Open document using ShellExecute(0, 'open', PWideChar(FIleName), '', '', SW_SHOWNORMAL);

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

Possibly broken installation

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 database if I extract it in a folder and open it from the folder without writing anything back to database?

3

There are 3 best solutions below

1
On BEST ANSWER

Solved: it was a bug in my program. There was an error in the logic that persisted the document status and by mistake sometimes Is_File_Compressed was set to False, even if it is true.

Thanks for the support.

3
On

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.
0
On

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