Opening .xlsx files in Windows 7

APD Toronto
APD Toronto used Ask the Experts™
on
Hi Experts,

I have a software that generates .xlsx file, but I keep getting "Unreadable content in file.xlsx" and the chart is deleted. If I open the same file on a MAC, no error and the chart is there. I am also reading online that these files can be opened in XP, Vista, and even Windows 8. I cannot confirm that.

I also read that this is a security bug in Windows 7.

Does anyone know how to fix this?

I cannot open the file on another OS, re-save it, then re-opened in Windows 7 because there are a lot of files in a fast pace environment.

Any help will be greatly appreciated
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Enterprise Business Process Architect
Commented:
Open Control Panel and select Programs, then select Default Programs.
Select Associate a file type or protocol with a program.
Select the .xlsx extension and double-click it or select Change Program in the upper right.
If necessary, browse to the directory where Excel is installed and select the appropriate EXCEL.EXE application file.
Select OK then select OK again.  Close the Default Programs and Control Panel windows.
Try opening the XLSX file again.
APD TorontoSoftware Developer

Author

Commented:
Under Control Panel I clicked programs and features, but from that point on there is no Default Programs
APD TorontoSoftware Developer

Author

Commented:
I found Default programs and did as you described, but the issue persists.

This is the file that I am trying to open. You will notice the chart on a MAC and probably other Windows OS, but not on Windows 7.
NiagaraPAXreport-5cq0jeijug00o8r18e1jdol
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

APD TorontoSoftware Developer

Author

Commented:
For some reason EE truncated the extension, but it is .xlsx
Top Expert 2016
Commented:
EE has a bug and only saves the first 40 characters
Excel 2016 error report
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error032400_01.xml</logFileName><summary>Errors were detected in file 'I:\Downloads\NiagaraPAXreport-5cq0jeijug00o8r18e1jdol.xlsx'</summary><removedParts><removedPart>Removed Part: /xl/drawings/drawing1.xml part.  (Drawing shape)</removedPart></removedParts></recoveryLog>

Open in new window

Error msgError message
Most Valuable Expert 2015
Commented:
You first need a software that can open excel files. As not everyone has excel installed, I suggest you look at libreoffice. It is better than m$ office, OpenSource and free. You can open the file with it:

http://portableapps.com/
http://portableapps.com/apps/office/libreoffice_portable
APD TorontoSoftware Developer

Author

Commented:
I thought this is an issue with Windows 7 because I can open in other OSs.
Most Valuable Expert 2015

Commented:
No. The other OS's probably have m$ Office installed.
APD TorontoSoftware Developer

Author

Commented:
m$ Office?

But I tried Office 2010 and 2007 both on Windows 7, same error
Most Valuable Expert 2015

Commented:
Maybe it was created with another Office software, for example LibreOffice like I suggested that you use. Those programs can also save their files in using the m$ Office extensions. I opened the file using LibreOffice on my Windows 7 PC, and could read it without problems.
>>> "I have a software that generates .xlsx file" <<<

What is this software?
Do you have any control over how it works?
Does the software run on a Mac, Linux, Windows, or some other operating system?

I think that's where the problem lies, and where you will have to look to fix the issue.

You may or may not already know that an *.XLSX file is just a *.ZIP file containing a lot of separate resource files that are all cross-linked with each other.  Most of these files in an XLSX file will be *.XML files, or in XML layout.

Prior to Microsoft Office Excel 2007, spreadsheet files were saved with the *.XLS extension.  These files are mostly binary data all in one package.  Excel 2007 introduced XLSX, XLSM (spreadsheet containing Macros), and several other variations.  Those files are ZIP containers that are more or less "unpacked" when run by an application that supports the file type, and all the cross-referenced resource files are parsed.

Here are all the resource files inside your attached XLSX file:
NiagaraPAXreport.xlsx
|
|   [Content_Types].xml
|   
+---docProps
|       app.xml
|       core.xml
|       
+---xl
|   |   sharedStrings.xml
|   |   styles.xml
|   |   workbook.xml
|   |   
|   +---charts
|   |       chart1.xml
|   |       
|   +---drawings
|   |   |   drawing1.xml
|   |   |   
|   |   \---_rels
|   |           drawing1.xml.rels
|   |           
|   +---theme
|   |       theme1.xml
|   |       
|   +---worksheets
|   |   |   sheet1.xml
|   |   |   
|   |   \---_rels
|   |           sheet1.xml.rels
|   |           
|   \---_rels
|           workbook.xml.rels
|           
\---_rels
        .rels

Open in new window

David Johnson posted details of the error messages that he encountered while trying to open your file in Excel 2016:

Removed Part: /xl/drawings/drawing1.xml part.  (Drawing shape)

"drawing1.xml" contains:
<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId1"/>

The file "drawing1.xml.rels" in the _rels sub-folder establishes the relationship of the embedded chart with the file which contains all the chart layout settings and cell references:

<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="../charts/chart1.xml"/>

"chart1.xml" contains all the chart formatting layout (gridlines, fonts, orientation, etc) and also the cell references it needs to populate the chart, for example:
<c:f>'Daily Passenger Totals'!$B$5:$B$13</c:f>

I notice that row 13 of your spreadsheet data is blank, but I don't think that references to unpopulated cells would really cause any issues.

Somewhere between drawing1.xml > drawing1.xml.rels > chart1.xml, Microsoft Excel on Windows is finding something that it doesn't like or cannot resolve, but on your Mac the application that opens it can do so without error.  It is as though Excel is unable to follow the cross-links to load the chart.

My version of LibreOffice Calc opens this XLSX file without error to display the cellular data and chart, but I am not sure whether the chart is complete because the columns in the bar graph aren't properly labelled.  Even if I do a "Save As" and resave the file to the older Office 97 to 2003 *.XLS, or the 2007 onwards *.XLSX format, the file still errors out on Excel.  I don't have a Mac, so I can't test this.

I think you will have to go back to the program that creates these XLSX files and see whether there are any settings (eg. compatibility settings) that you can experiment with to see whether it will create a spreadsheet that opens in all the applications and operating systems that you need to view the files on.
APD TorontoSoftware Developer

Author

Commented:
I am using PHPEXcel to generate this file, if that helps.
APD TorontoSoftware Developer

Author

Commented:
Any advice?
Unfortunately PHP scripting is not one of my strengths, but there may be other experts lurking around who are expert in this field.
Top Expert 2016

Commented:
are you using the latest version from github?
APD TorontoSoftware Developer

Author

Commented:
I'm using v 1.8.0
APD TorontoSoftware Developer

Author

Commented:
I downloaded PHPExcel 1.9 from github, the issue persists.
Darrell PorterEnterprise Business Process Architect

Commented:
One issue with this file is the drawing object, xl\drawings\drawing1.xml, which seems to be malformed.
Is there some functionality you need in Excel 2007/2010/2013 you cannot find in 2003 or prior?

To rephrase, do you need XLSX format, or can you recode your solution to create either a CSV or XLS file?

If you don't need the drawing object, can you omit it?

Have you opened the XLSX file with 7Zip or Winzip to look at the contents in detail to ensure your code is generating the XML as expected?

This is the contents of the drawing1.xls from the file you attached previously:

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<xdr:wsDr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
	-<xdr:twoCellAnchor>
		-<xdr:from>
			<xdr:col>0</xdr:col>
			<xdr:colOff>0</xdr:colOff>
			<xdr:row>16</xdr:row>
			<xdr:rowOff>0</xdr:rowOff>
		</xdr:from>
		-<xdr:to>
			<xdr:col>12</xdr:col>
			<xdr:colOff>95250</xdr:colOff>
			<xdr:row>40</xdr:row>
			<xdr:rowOff>95250</xdr:rowOff>
		</xdr:to>
		-<xdr:graphicFrame macro="">
			-<xdr:nvGraphicFramePr>
				<xdr:cNvPr id="1025" name="Chart 1"/>
				-<xdr:cNvGraphicFramePr>
					<a:graphicFrameLocks/>
				</xdr:cNvGraphicFramePr>
			</xdr:nvGraphicFramePr>
			-<xdr:xfrm>
				<a:off y="0" x="0"/>
				<a:ext cy="0" cx="0"/>
			</xdr:xfrm>
			-<a:graphic>
				-<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
					<c:chart r:id="rId1"
						xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
						xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>
				</a:graphicData>
			</a:graphic>
		</xdr:graphicFrame>
		<xdr:clientData/>
	</xdr:twoCellAnchor>
</xdr:wsDr>

Open in new window

Darrell PorterEnterprise Business Process Architect

Commented:
What does your PHP code look like that generates the XLSX file?
Please submit it as a code block.
APD TorontoSoftware Developer

Author

Commented:
Its strange. When I run from PHPExcel exmples/33chrtcreate-bar.php, there is no error, but when I adjust this code to my needs in chart.php, I get the error. I don't understand. I am attaching both files.
33chartcreate-bar.php
chart.php
Thank you APD_Toronto

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial