Corrupted Excel2007 with bar graph: How to debug?

Topics: Developer Forum, User Forum
Nov 15, 2012 at 9:36 PM

Hi,

I am using PHPExcel (develop) from Nov. 15, 2012 and am encountering a problem, that I can't figure out how to resolve.

Basically I have a workbook with 2 sheets (similar to example 33). My bar-chart is vertical, instead of horizontal and I have more data (4 columns, 1200 values each).

When looking for differences between my chart-object and the one of example 33 (with print_r($chart) ) I see that whereas example 33 has a cell-array for each cell, and mine uses a ptr (Not too sure about the cell-aray wording, but if needed I can clarify tomorow).

Some other things that are different: I have cells with UTF-8 Portuguese text, but that should not be a problem (I think).

The file opens fine with LibreOffice, even showing the chart! But with Excel 2010 (Win) and Excel 2011 (OSX) it results in a corrupted file, that after being corrected is stripped from it's graph.

If I do not include the graph when writing the xlsx-file, it is perfect (but obviously without graph).

The error is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>Repair Result to Energist-2012-11-01_2012-11-15-29 08327.xml</logFileName><summary>Errors were detected in file 'Flatlander OS:Users:martijn:Downloads:Energist-2012-11-01_2012-11-15-29.xlsx'</summary><removedParts summary="Following is a list of removed parts:"><removedPart>Removed Part: /xl/drawings/drawing1.xml part.  (Drawing shape)</removedPart></removedParts></recoveryLog>

 

I could upload the file, but it is very possible my error and not yours :-)

Basically, how can one go around and do some debugging, to see where this error might come from?

Thanks, PHPExcel is awesome!

Martijn

Nov 16, 2012 at 8:34 AM

Partly SOLVED

 

I got the graphs working in Excel 2010 and 2011.

I thought the direction of the bar was optional and set to vertical by default. It is not.

I added the following line to my php-code:

$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);

 

And now it works, so that part is solved.

 

Still remaining is some hints on how to do debugging instead of brute-force try everything and hope it works.

/Martijn