Excel 调试技巧
我有一个库,可以将 VCL 网格的内容导出为 XLS 格式。 (不确定是哪个版本的 XLS 格式;这就是问题的一部分。)它通常工作得很好,但在某些情况下,当我在 Excel 2007 中打开此库导出的 XLS 时,它会显示“Excel 在'[myfile.xls]'。您想恢复此工作簿的内容吗?”
它能够正确地恢复它,所以无论问题是什么,它一定不会那么严重,但我花了很长时间才弄清楚问题是什么。。我无法做任何简单的事情,比如在调试器下运行 Excel,因为它是专有软件。我尝试将更正后的版本保存为各种风格的 XLS 并比较这两个文件,但我没有找到任何看起来与原始文件格式非常相似的内容。恢复完成后,它会向我提供一个指向 XML 文件的链接,该文件声明文档已恢复,但没有描述有关已发现或修复的错误的任何内容。
有什么方法可以获取有关 Excel 期望看到的内容以及实际看到的内容的一些实际详细信息吗?
I've got a library that can export the contents of a VCL grid to XLS format. (Not sure which version of XLS format; that's part of the problem.) It usually works just fine, but in some cases, when I open an XLS that was exported by this library in Excel 2007, it says "Excel found unreadable content in '[myfile.xls]'. Do you want to recover the contents of this workbook?"
It's able to recover it correctly, so whatever the problem is, it must not be that severe, but I'm having a heck of a time figuring out what the problem is. I can't do anything simple like run Excel under the debugger because it's proprietary software. I've tried saving the corrected version as various flavors of XLS and diffing the two files, but I don't ever find anything that looks even remotely like the file format of the original. When the recovery is finished, it gives me a link to an XML file that states that a document was recovered, without describing anything whatsoever about the errors that were found or fixed.
Is there any way I can get some actual detailed information about what Excel was expecting to see and what it saw instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Excel 版本 5 及更高版本使用复合文件来保存其内容。这些文件以 d0 cf 11 e0 a1 b1 1a e1 开头。您可能拥有的不是复合文件,而是工作簿的二进制表示形式,如 MICROSOFT OFFICE EXCEL 97-2007 二进制文件格式规范。我不知道你的网格导出到哪个版本的BIFF。
由于您“随机”收到这些错误,我认为生成 xls 文件的代码中存在错误。您能做的最好的事情就是尝试制作一个可复制的案例并联系该组件的制造商。也许它与unicode相关?导致错误的某些字符?也许是日期格式?
Excel versions 5 and later use compound files to save their contents. Those files start with
d0 cf 11 e0 a1 b1 1a e1
. What you probably have is not a compound file but the binary representation of a workbook as described in MICROSOFT OFFICE EXCEL 97-2007 BINARY FILE FORMAT SPECIFICATION. I don't know which version of BIFF your grid exports to.Since you are 'randomly' getting those errors I think there is a bug in the code that generates the xls file. The best thing you can do is trying to make a reproducible case and contact the manufacturer of that component. Maybe it is unicode related? Certain characters that cause the error? Date formats maybe?
如果您知道网格组件和导出库的名称,将会有很大帮助。也许您还可以联系这些库的创建者并检查他们的网站是否有更新?
It would help a lot if you have the name of the grid component and the export library. Maybe you can also contact the creators of these libraries and check their sites for an update?