Excel found unreadable content in filename.xls.

View: New views
3 Messages — Rating Filter:   Alert me  

Excel found unreadable content in filename.xls.

by dahoffer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

*

Parent Message unknown Re: Excel found unreadable content in filename.xls.

by everymoment :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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" <dhoffer6@...>
To: user@...
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

*

Re: Excel found unreadable content in filename.xls when using wb.setRepeatingRowsAndColumns()

by Hannes Erven :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Folks,


sorry to re-activite this thread... I've run into the same issue, but I
could track it down to using workbook.setRepeatingRowsAndColumns() on
the workbook: if used, Excel complains when opening about the same
things as David Hoffer described:

> Errors were detected in file 'C:\filename.xls'
> The following is a list of repairs:
>
> Removed one or more invalid names.

Unfortunately, my Excel is in German, but there is no more info
available anyways.

If I omit that call, the file opens fine.


OpenOffice opens the file without issues and also the repeating rows are
set the way I'd like them to be.


Has anyone any idea what might be going on? If helpful, I can make up
some test files to inspect.


Thanks, best regards

        -hannes

PS: I was surprised that I have to use
workbook.setRepeatingRowsAndColumns() at all since I'm wb.cloneSheet() a
sheet that already has repeating rows/columns set... is this by design?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...