views:

73

answers:

2

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?

A: 

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?

birger
+5  A: 

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?

The_Fox
Yeah, it seems to be related to date/time formats.
Mason Wheeler
Thanks for the link. This starts with something completely different. I'll look through the spec and see what I can find...
Mason Wheeler