Hi David,
It might not be a problem in POI or in your code either. Instead, recent changes in the Visual Basic interpreter might be the root source of this Excel NAMES problem. Microsoft pushed Office Service Pack 3 (SP3) as a security upgrade. This would have upgraded your Excel 2003 from SP2 (11.8169.8172) to SP3 (11.8307.8221). The same changes to the Visual Basic interpreter that appear in Excel 2003 also seem to exist in Excel 2007, making for macro incompabilities and NAME incompatibilities. Since SP3 I have noticed some changes in Excel functions (regardless of whether you use POI or not), including the following: 1. Visual Basic now gives a fatal error for arguments out of range to the MID function (in SP2, a START beyond the END just returned the empty string). SOLUTION: Use a bunch of IF statements to test the constraints of all inputs before calling a Visual Basic function. 2. Visual Basic no longer seems to recognize the readingOrder parameter on the textBox object creation. My readingOrder parameters arose from recording macros that created text boxes. SOLUTION: delete all instances of readingOrder, unless you need them. 3, When you combine spreadsheets, say by using a Visual Basic OPEN, and then copy sheets from one workbook to another, Visual Basic puts some of the NAMES that should have had local scope into the global (workbook) scope. SOLUTION: First, stop giving your ranges a name. Second, delete all NAMES, especially those beginning with a forward slash or a backslash and those with "workbook" scope. Therefore, to be "super compliant", fix your Visual Basic macros and Excel names in several ways: use IF statements before Visual Basic functions, don't use readingOrder, stop using NAMES, and then, after all the names are no longer in use, delete all NAMES from all of your spreadsheets. By doing these things, I hope you will no longer get that NAMES error. Mike Brenner ----- Original Message ----- From: "David Hoffer" <[email protected]> To: [email protected] Sent: Monday, November 2, 2009 8:15:54 PM GMT -05:00 US/Canada Eastern Subject: Excel found unreadable content in filename.xls. Having created a new program using POI 3.5 I get the following error on one system (happens to be the customer's) when the file is opened in Excel 2003. *Excel found unreadable content in 'filename.xls.' Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes. If they select Yes they get the following error report: Microsoft Office Excel File Repair Log Errors were detected in file 'C:\filename.xls' The following is a list of repairs: Removed one or more invalid names. I have tested this on all my systems and I do not see any error. However I only have 2000, 2007 and OpenOffice. Is there anything I can do in code to make the output 'super' Excel compliant? I am doing nothing fancy in the workbook. Any ideas? -Dave *
