Discard Autofilters in Excel2007 Reader when filter range isn't a valid range

This commit is contained in:
MarkBaker 2014-11-11 23:18:13 +00:00
parent 37b4d18d45
commit fdefb8e392
3 changed files with 107 additions and 104 deletions

View File

@ -1006,12 +1006,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) {
$autoFilter = $docSheet->getAutoFilter();
$autoFilterRange = (string) $xmlSheet->autoFilter["ref"];
if (strpos($autoFilterRange, ':') === false) {
$autoFilterRange = "${autoFilterRange}:${autoFilterRange}";
}
if (strpos($autoFilterRange, ':') !== false) {
$autoFilter = $docSheet->getAutoFilter();
$autoFilter->setRange($autoFilterRange);
foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
@ -1108,6 +1105,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER);
}
}
}
}
}
@ -1584,10 +1582,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$extractedRange = explode(',', $extractedRange);
foreach ($extractedRange as $range) {
$autoFilterRange = $range;
if (strpos($autoFilterRange, ':') === false) {
$autoFilterRange = "${autoFilterRange}:${autoFilterRange}";
}
if (strpos($autoFilterRange, ':') !== false) {
$docSheet->getAutoFilter()->setRange($autoFilterRange);
}
}
}
break;

View File

@ -633,7 +633,11 @@ class PHPExcel_Worksheet_AutoFilter
);
} else {
// Filter on date group values
$arguments = array();
$arguments = array(
'date' => array(),
'time' => array(),
'dateTime' => array(),
);
foreach($ruleDataSet as $ruleValue) {
$date = $time = '';
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&

View File

@ -33,10 +33,12 @@ Planned for v1.8.1
- Bugfix: (MBaker) Work Item GH-384 - DOM loadHTMLFile() failing with options flags when using PHP < 5.4.0
- Bugfix: (MBaker) - Fix for percentage operator in formulae for BIFF Writer
- Bugfix: (MBaker) - Fix to getStyle() call for cell object
- Bugfix: (MBaker) - Discard Autofilters in Excel2007 Reader when filter range isn't a valid range
- Bugfix: (masanaikeshima) Work Item GH-426 - Pie chart won't work in Excel 2013
- General: (MBaker) - Small performance improvement for autosize columns
- General: (frost-nzcr4) Work Item GH-379 - Change the getter/setter for zeroHeight to camel case
- General: (MBaker) Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric
- General: (MBaker) - Default precalculate formulas to false for writers
- Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines
- Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell
- Feature: (CQD) Work Item GH-389 - Additional Mac CJK codepage definitions