Bugfix: Work item 17471 - OOCalc cells contain same data bug?

Plus a couple of charting bugs


git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@90420 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-05-13 18:15:09 +00:00
parent 540aebe68b
commit 762f12624b
4 changed files with 28 additions and 32 deletions

View File

@ -38,6 +38,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Prefix used to uniquely identify cache data for this worksheet * Prefix used to uniquely identify cache data for this worksheet
* *
* @access private
* @var string * @var string
*/ */
private $_cachePrefix = null; private $_cachePrefix = null;
@ -45,6 +46,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Cache timeout * Cache timeout
* *
* @access private
* @var integer * @var integer
*/ */
private $_cacheTime = 600; private $_cacheTime = 600;
@ -54,6 +56,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
* Store cell data in cache for the current cell object if it's "dirty", * Store cell data in cache for the current cell object if it's "dirty",
* and the 'nullify' the current cell object * and the 'nullify' the current cell object
* *
* @access private
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
@ -74,6 +77,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Add or Update a cell in cache identified by coordinate address * Add or Update a cell in cache identified by coordinate address
* *
* @access public
* @param string $pCoord Coordinate address of the cell to update * @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update * @param PHPExcel_Cell $cell Cell to update
* @return void * @return void
@ -96,6 +100,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
* *
* @access public
* @param string $pCoord Coordinate address of the cell to check * @param string $pCoord Coordinate address of the cell to check
* @return void * @return void
* @return boolean * @return boolean
@ -122,6 +127,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Get cell at a specific coordinate * Get cell at a specific coordinate
* *
* @access public
* @param string $pCoord Coordinate of the cell * @param string $pCoord Coordinate of the cell
* @throws Exception * @throws Exception
* @return PHPExcel_Cell Cell that was found, or null if not found * @return PHPExcel_Cell Cell that was found, or null if not found
@ -159,6 +165,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Delete a cell in cache identified by coordinate address * Delete a cell in cache identified by coordinate address
* *
* @access public
* @param string $pCoord Coordinate address of the cell to delete * @param string $pCoord Coordinate address of the cell to delete
* @throws Exception * @throws Exception
*/ */
@ -174,6 +181,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
/** /**
* Clone the cell collection * Clone the cell collection
* *
* @access public
* @param PHPExcel_Worksheet $parent The new worksheet * @param PHPExcel_Worksheet $parent The new worksheet
* @return void * @return void
*/ */

View File

@ -448,7 +448,7 @@ class PHPExcel_Chart
public function refresh() { public function refresh() {
if ($this->_worksheet !== NULL) { if ($this->_worksheet !== NULL) {
$this->$_plotArea->refresh($this->_worksheet); $this->_plotArea->refresh($this->_worksheet);
} }
} }

View File

@ -626,7 +626,13 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
// echo 'Adjusted Formula: '.$cellDataFormula.'<br />'; // echo 'Adjusted Formula: '.$cellDataFormula.'<br />';
} }
$repeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ?
$cellDataTableAttributes['number-columns-repeated'] : 1;
if ($type !== NULL) { if ($type !== NULL) {
for ($i = 0; $i < $repeats; ++$i) {
if ($i > 0) {
++$columnID;
}
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type); $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type);
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
// echo 'Forumla result is '.$dataValue.'<br />'; // echo 'Forumla result is '.$dataValue.'<br />';
@ -640,6 +646,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink); $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink);
} }
} }
}
// Merged cells // Merged cells
if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) { if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) {
@ -655,25 +662,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
$objPHPExcel->getActiveSheet()->mergeCells($cellRange); $objPHPExcel->getActiveSheet()->mergeCells($cellRange);
} }
if (isset($cellDataTableAttributes['number-columns-repeated'])) {
// echo 'Repeated '.$cellDataTableAttributes['number-columns-repeated'].' times<br />';
$columnID = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-repeated'] - 2);
if ($type !== NULL) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type);
if ($hasCalculatedValue) {
// echo 'Forumla result is '.$dataValue.'<br />';
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($dataValue);
}
if (($cellDataOfficeAttributes['value-type'] == 'date') ||
($cellDataOfficeAttributes['value-type'] == 'time')) {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rowID)->getNumberFormat()->setFormatCode($formatting);
}
if ($hyperlink !== NULL) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink);
}
}
}
++$columnID; ++$columnID;
} }
++$rowID; ++$rowID;

View File

@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->startElement('a:p'); $objWriter->startElement('a:p');
$caption = $title->getCaption(); $caption = $title->getCaption();
if (is_array($caption)) if ((is_array($caption)) && (count($caption) > 0))
$caption = $caption[0]; $caption = $caption[0];
$this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a'); $this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a');