Bugfix: takaakik) Work Item 15455 - getNestingLevel() Error on Excel5 Read

Bugfix: ix to Excel5 Reader when cell annotations are defined before their referenced text objects
This commit is contained in:
Mark Baker 2012-08-01 17:25:10 +01:00
parent f12189b29d
commit 0b60b61104
5 changed files with 122 additions and 92 deletions

View File

@ -339,6 +339,12 @@ class PHPExcel_Chart_DataSeries
foreach($this->_plotValues as $plotValues) {
$plotValues->refresh($worksheet);
}
foreach($this->_plotLabel as $plotValues) {
$plotValues->refresh($worksheet);
}
foreach($this->_plotCategory as $plotValues) {
$plotValues->refresh($worksheet);
}
}
}

View File

@ -944,6 +944,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
// echo '<br />';
// the first shape container never has a corresponding OBJ record, hence $n + 1
if (isset($allSpContainers[$n + 1]) && is_object($allSpContainers[$n + 1])) {
$spContainer = $allSpContainers[$n + 1];
// we skip all spContainers that are a part of a group shape since we cannot yet handle those
@ -968,7 +969,6 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
$offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $startRow) / 256;
switch ($obj['otObjType']) {
case 0x19:
// Note
// echo 'Cell Annotation Object<br />';
@ -977,20 +977,10 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
if (isset($this->_cellNotes[$obj['idObjID']])) {
$cellNote = $this->_cellNotes[$obj['idObjID']];
// echo '_cellNotes[',$obj['idObjID'],']: ';
// var_dump($cellNote);
// echo '<br />';
//
if (isset($this->_textObjects[$obj['idObjID']])) {
$textObject = $this->_textObjects[$obj['idObjID']];
// echo '_textObject: ';
// var_dump($textObject);
// echo '<br />';
//
$this->_cellNotes[$obj['idObjID']]['objTextData'] = $textObject;
$text = $textObject['text'];
}
// echo $text,'<br />';
}
break;
@ -1041,6 +1031,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
}
}
}
// treat SHAREDFMLA records
if ($this->_version == self::XLS_BIFF8) {
@ -1055,6 +1046,14 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
if (!empty($this->_cellNotes)) {
foreach($this->_cellNotes as $note => $noteDetails) {
if (!isset($noteDetails['objTextData'])) {
if (isset($this->_textObjects[$note])) {
$textObject = $this->_textObjects[$note];
$noteDetails['objTextData'] = $textObject;
} else {
$noteDetails['objTextData']['text'] = '';
}
}
// echo '<b>Cell annotation ',$note,'</b><br />';
// var_dump($noteDetails);
// echo '<br />';

View File

@ -238,7 +238,11 @@ class PHPExcel_Shared_Date
* @return boolean
*/
public static function isDateTime(PHPExcel_Cell $pCell) {
return self::isDateTimeFormat($pCell->getParent()->getStyle($pCell->getCoordinate())->getNumberFormat());
return self::isDateTimeFormat(
$pCell->getParent()->getStyle(
$pCell->getCoordinate()
)->getNumberFormat()
);
} // function isDateTime()

View File

@ -50,16 +50,34 @@ $objWorksheet->fromArray(
);
// Set the Labels for each data series we want to plot
// Datatype
// Cell reference for data
// Format Code
// Number of datapoints in series
// Data values
// Data Marker
$dataseriesLabels = array(
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
// Cell reference for data
// Format Code
// Number of datapoints in series
// Data values
// Data Marker
$xAxisTickValues = array(
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
);
// Set the Data values for each data series we want to plot
// Datatype
// Cell reference for data
// Format Code
// Number of datapoints in series
// Data values
// Data Marker
$dataSeriesValues = array(
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
@ -76,6 +94,7 @@ $series = new PHPExcel_Chart_DataSeries(
$dataSeriesValues // plotValues
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
// Set the series in the plot area

View File

@ -92,7 +92,9 @@ Fixed in develop branch:
- Bugfix: (MBaker) Various fixes to Chart handling
- Bugfix: (MBaker) Work item 18370 - Error loading xlsx file with column breaks
- Bugfix: (MBaker) OOCalc Reader now handles percentage and currency data types
- Bugfix: (MBaker) Work Item 18415- mb_stripos empty delimiter
- Bugfix: (MBaker) Work Item 18415 - mb_stripos empty delimiter
- Bugfix: (takaakik) Work Item 15455 - getNestingLevel() Error on Excel5 Read
- Bugfix: (MBaker) Fix to Excel5 Reader when cell annotations are defined before their referenced text objects
2012-05-19 (v1.7.7):