使用处理 Office 2010 64 位文件的 32 位应用程序时存在哪些问题?

发布于 2024-09-25 06:31:25 字数 1233 浏览 0 评论 0原文

我正在测试一个处理文件的应用程序(使用 FILESTREAM 存储在 SQL Server 中)。它是一个 Delphi 32 位应用程序。

打开存储在数据库中的 XLS 文档(最初使用 Office 2003 保存)会在 Excel 2010 64 位中出现错误。 Office 2010 64 位与 32 位应用程序之间是否存在一些已知的兼容性问题?

错误消息和工作流程

打开文件时,Excel 会显示以下错误消息之一:

  • <块引用>

    由于内容问题,无法打开文件 FILE

  • <块引用>

    无法打开文件,因为某些部分丢失或无效

在计算机 A 上使用 Office 2007 打开文件可以正常打开该文件。使用 Office 2010 在计算机 B 上打开同一文件会产生错误消息。再次在A机上打开也出现错误信息!在所有这些步骤中,我只是从数据库中读取,而不是写入。那么为什么会发生这种情况呢?

我如何打开文档?

  1. SELECT 查询以获取特定 ID_Document 的“DOCUMENT”varbinary(max) 字段。
  2. 使用从数据库中提取 TBlobField(sqlQuery.FieldByName('DOCUMENT')).SaveToFile(sDestinationPath + FileUniqueName + .zip');
  3. 使用 Windows.CopyFile 将文件从一个路径复制到另一个路径 解
  4. 压缩文件使用TZipforge组件
  5. 使用FileSetReadOnly函数将解压文件的属性设置到ROM。
  6. 使用 ShellExecute(0, 'open', PWideChar(FIleName), '', '', SW_SHOWNORMAL); 打开文档

如您所见,没有任何内容写回数据库。从 TBlobField 中提取文件后,它甚至会在解压缩和打开之前复制到另一个位置。

可能损坏的安装

Office 已重新安装,现在一切正常,损坏问题是由于与打开的 Office 安装发生冲突,询问“您要修复 Office 安装吗?”。无论如何,问题仍然存在,因为我无法理解发生了什么。如果我将数据库中的文件提取到文件夹中并从该文件夹中打开它而不将任何内容写回数据库,如何损坏数据库中的文件?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撧情箌佬 2024-10-02 06:31:25

Office 2010 64 位应该不会出现使用 32 位版本创建的文件的问题。文件(.docx、.xls)与位数无关。

我有一些问题:

  1. 您如何打开文件?
  2. 你能展示一些代码吗?
  3. 您确定只从数据库中读取文件吗?
  4. 您是否为文件指定了正确的扩展名?将 .xls 保存为 .xlsx 会导致打开文件时出现问题。

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.
海风掠过北极光 2024-10-02 06:31:25

检查您的 SQL Server 数据库是否损坏。检查数据库所在磁盘是否有错误。重新安装 SQL 服务器。

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

风启觞 2024-10-02 06:31:25

已解决:这是我的程序中的一个错误。保留文档状态的逻辑存在错误,有时 Is_File_compressed 会被错误地设置为 False,即使它是 true。

感谢您的支持。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文