mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 05:16:06 +03:00
PSR-2 : Fixes
This commit is contained in:
parent
06c1ea78de
commit
2881bca443
@ -38,7 +38,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
|
||||
if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
||||
// Test for support of \P (multibyte options) in PCRE
|
||||
if(defined('PREG_BAD_UTF8_ERROR')) {
|
||||
if (defined('PREG_BAD_UTF8_ERROR')) {
|
||||
// Cell reference (cell or range of cells, with or without a sheet reference)
|
||||
define('CALCULATION_REGEXP_CELLREF','((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})');
|
||||
// Named Range of cells
|
||||
@ -1724,7 +1724,7 @@ class PHPExcel_Calculation {
|
||||
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
|
||||
$this->_savedPrecision = ini_get('precision');
|
||||
if ($this->_savedPrecision < $setPrecision) {
|
||||
ini_set('precision',$setPrecision);
|
||||
ini_set('precision', $setPrecision);
|
||||
}
|
||||
$this->delta = 1 * pow(10, -$setPrecision);
|
||||
|
||||
@ -1740,7 +1740,7 @@ class PHPExcel_Calculation {
|
||||
|
||||
public function __destruct() {
|
||||
if ($this->_savedPrecision != ini_get('precision')) {
|
||||
ini_set('precision',$this->_savedPrecision);
|
||||
ini_set('precision', $this->_savedPrecision);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1963,7 +1963,7 @@ class PHPExcel_Calculation {
|
||||
// Identify our locale and language
|
||||
$language = $locale = strtolower($locale);
|
||||
if (strpos($locale,'_') !== FALSE) {
|
||||
list($language) = explode('_',$locale);
|
||||
list($language) = explode('_', $locale);
|
||||
}
|
||||
|
||||
if (count(self::$_validLocaleLanguages) == 1)
|
||||
@ -1978,7 +1978,7 @@ class PHPExcel_Calculation {
|
||||
// Default is English, if user isn't requesting english, then read the necessary data from the locale files
|
||||
if ($locale != 'en_us') {
|
||||
// Search for a file with a list of function names for locale
|
||||
$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.'functions';
|
||||
$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions';
|
||||
if (!file_exists($functionNamesFile)) {
|
||||
// If there isn't a locale specific function file, look for a language specific function file
|
||||
$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions';
|
||||
@ -1989,9 +1989,9 @@ class PHPExcel_Calculation {
|
||||
// Retrieve the list of locale or language specific function names
|
||||
$localeFunctions = file($functionNamesFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($localeFunctions as $localeFunction) {
|
||||
list($localeFunction) = explode('##',$localeFunction); // Strip out comments
|
||||
list($localeFunction) = explode('##', $localeFunction); // Strip out comments
|
||||
if (strpos($localeFunction,'=') !== FALSE) {
|
||||
list($fName,$lfName) = explode('=',$localeFunction);
|
||||
list($fName, $lfName) = explode('=', $localeFunction);
|
||||
$fName = trim($fName);
|
||||
$lfName = trim($lfName);
|
||||
if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
|
||||
@ -2003,16 +2003,16 @@ class PHPExcel_Calculation {
|
||||
if (isset(self::$_localeFunctions['TRUE'])) { self::$_localeBoolean['TRUE'] = self::$_localeFunctions['TRUE']; }
|
||||
if (isset(self::$_localeFunctions['FALSE'])) { self::$_localeBoolean['FALSE'] = self::$_localeFunctions['FALSE']; }
|
||||
|
||||
$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.'config';
|
||||
$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config';
|
||||
if (!file_exists($configFile)) {
|
||||
$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config';
|
||||
}
|
||||
if (file_exists($configFile)) {
|
||||
$localeSettings = file($configFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($localeSettings as $localeSetting) {
|
||||
list($localeSetting) = explode('##',$localeSetting); // Strip out comments
|
||||
list($localeSetting) = explode('##', $localeSetting); // Strip out comments
|
||||
if (strpos($localeSetting,'=') !== FALSE) {
|
||||
list($settingName,$settingValue) = explode('=',$localeSetting);
|
||||
list($settingName, $settingValue) = explode('=', $localeSetting);
|
||||
$settingName = strtoupper(trim($settingName));
|
||||
switch ($settingName) {
|
||||
case 'ARGUMENTSEPARATOR' :
|
||||
@ -2034,10 +2034,10 @@ class PHPExcel_Calculation {
|
||||
|
||||
|
||||
|
||||
public static function _translateSeparator($fromSeparator,$toSeparator,$formula,&$inBraces) {
|
||||
public static function _translateSeparator($fromSeparator, $toSeparator, $formula,&$inBraces) {
|
||||
$strlen = mb_strlen($formula);
|
||||
for ($i = 0; $i < $strlen; ++$i) {
|
||||
$chr = mb_substr($formula,$i,1);
|
||||
$chr = mb_substr($formula, $i,1);
|
||||
switch ($chr) {
|
||||
case '{' : $inBraces = TRUE;
|
||||
break;
|
||||
@ -2045,14 +2045,14 @@ class PHPExcel_Calculation {
|
||||
break;
|
||||
case $fromSeparator :
|
||||
if (!$inBraces) {
|
||||
$formula = mb_substr($formula,0,$i).$toSeparator.mb_substr($formula,$i+1);
|
||||
$formula = mb_substr($formula,0, $i).$toSeparator.mb_substr($formula, $i+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $formula;
|
||||
}
|
||||
|
||||
private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator) {
|
||||
private static function _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator) {
|
||||
// Convert any Excel function names to the required language
|
||||
if (self::$_localeLanguage !== 'en_us') {
|
||||
$inBraces = FALSE;
|
||||
@ -2060,22 +2060,22 @@ class PHPExcel_Calculation {
|
||||
if (strpos($formula,'"') !== FALSE) {
|
||||
// So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
|
||||
// the formula
|
||||
$temp = explode('"',$formula);
|
||||
$temp = explode('"', $formula);
|
||||
$i = FALSE;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only count/replace in alternating array entries
|
||||
if ($i = !$i) {
|
||||
$value = preg_replace($from,$to,$value);
|
||||
$value = self::_translateSeparator($fromSeparator,$toSeparator,$value,$inBraces);
|
||||
$value = preg_replace($from, $to, $value);
|
||||
$value = self::_translateSeparator($fromSeparator, $toSeparator, $value, $inBraces);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$formula = implode('"',$temp);
|
||||
$formula = implode('"', $temp);
|
||||
} else {
|
||||
// If there's no quoted strings, then we do a simple count/replace
|
||||
$formula = preg_replace($from,$to,$formula);
|
||||
$formula = self::_translateSeparator($fromSeparator,$toSeparator,$formula,$inBraces);
|
||||
$formula = preg_replace($from, $to, $formula);
|
||||
$formula = self::_translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2088,10 +2088,10 @@ class PHPExcel_Calculation {
|
||||
public function _translateFormulaToLocale($formula) {
|
||||
if (self::$functionReplaceFromExcel === NULL) {
|
||||
self::$functionReplaceFromExcel = array();
|
||||
foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
|
||||
foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) {
|
||||
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
|
||||
}
|
||||
foreach(array_keys(self::$_localeBoolean) as $excelBoolean) {
|
||||
foreach (array_keys(self::$_localeBoolean) as $excelBoolean) {
|
||||
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
|
||||
}
|
||||
|
||||
@ -2099,15 +2099,15 @@ class PHPExcel_Calculation {
|
||||
|
||||
if (self::$functionReplaceToLocale === NULL) {
|
||||
self::$functionReplaceToLocale = array();
|
||||
foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
|
||||
foreach (array_values(self::$_localeFunctions) as $localeFunctionName) {
|
||||
self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
|
||||
}
|
||||
foreach(array_values(self::$_localeBoolean) as $localeBoolean) {
|
||||
foreach (array_values(self::$_localeBoolean) as $localeBoolean) {
|
||||
self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2';
|
||||
}
|
||||
}
|
||||
|
||||
return self::_translateFormula(self::$functionReplaceFromExcel,self::$functionReplaceToLocale,$formula,',',self::$_localeArgumentSeparator);
|
||||
return self::_translateFormula(self::$functionReplaceFromExcel,self::$functionReplaceToLocale, $formula,',',self::$_localeArgumentSeparator);
|
||||
} // function _translateFormulaToLocale()
|
||||
|
||||
|
||||
@ -2117,25 +2117,25 @@ class PHPExcel_Calculation {
|
||||
public function _translateFormulaToEnglish($formula) {
|
||||
if (self::$functionReplaceFromLocale === NULL) {
|
||||
self::$functionReplaceFromLocale = array();
|
||||
foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
|
||||
foreach (array_values(self::$_localeFunctions) as $localeFunctionName) {
|
||||
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
|
||||
}
|
||||
foreach(array_values(self::$_localeBoolean) as $excelBoolean) {
|
||||
foreach (array_values(self::$_localeBoolean) as $excelBoolean) {
|
||||
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$functionReplaceToExcel === NULL) {
|
||||
self::$functionReplaceToExcel = array();
|
||||
foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
|
||||
foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) {
|
||||
self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';
|
||||
}
|
||||
foreach(array_keys(self::$_localeBoolean) as $excelBoolean) {
|
||||
foreach (array_keys(self::$_localeBoolean) as $excelBoolean) {
|
||||
self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2';
|
||||
}
|
||||
}
|
||||
|
||||
return self::_translateFormula(self::$functionReplaceFromLocale,self::$functionReplaceToExcel,$formula,self::$_localeArgumentSeparator,',');
|
||||
return self::_translateFormula(self::$functionReplaceFromLocale,self::$functionReplaceToExcel, $formula,self::$_localeArgumentSeparator,',');
|
||||
} // function _translateFormulaToEnglish()
|
||||
|
||||
|
||||
@ -2170,7 +2170,7 @@ class PHPExcel_Calculation {
|
||||
// Return strings wrapped in quotes
|
||||
return '"'.$value.'"';
|
||||
// Convert numeric errors to NaN error
|
||||
} else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
|
||||
} else if ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
@ -2190,7 +2190,7 @@ class PHPExcel_Calculation {
|
||||
return substr($value,1,-1);
|
||||
}
|
||||
// Convert numeric errors to NaN error
|
||||
} else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
|
||||
} else if ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
return $value;
|
||||
@ -2284,7 +2284,7 @@ class PHPExcel_Calculation {
|
||||
|
||||
if ($result === NULL) {
|
||||
return 0;
|
||||
} elseif((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
|
||||
} elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
return $result;
|
||||
@ -2435,33 +2435,33 @@ class PHPExcel_Calculation {
|
||||
* 1 = shrink to fit
|
||||
* 2 = extend to fit
|
||||
*/
|
||||
private static function _checkMatrixOperands(&$operand1,&$operand2,$resize = 1) {
|
||||
private static function _checkMatrixOperands(&$operand1,&$operand2, $resize = 1) {
|
||||
// Examine each of the two operands, and turn them into an array if they aren't one already
|
||||
// Note that this function should only be called if one or both of the operand is already an array
|
||||
if (!is_array($operand1)) {
|
||||
list($matrixRows,$matrixColumns) = self::_getMatrixDimensions($operand2);
|
||||
$operand1 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand1));
|
||||
list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand2);
|
||||
$operand1 = array_fill(0, $matrixRows,array_fill(0, $matrixColumns, $operand1));
|
||||
$resize = 0;
|
||||
} elseif (!is_array($operand2)) {
|
||||
list($matrixRows,$matrixColumns) = self::_getMatrixDimensions($operand1);
|
||||
$operand2 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand2));
|
||||
list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand1);
|
||||
$operand2 = array_fill(0, $matrixRows,array_fill(0, $matrixColumns, $operand2));
|
||||
$resize = 0;
|
||||
}
|
||||
|
||||
list($matrix1Rows,$matrix1Columns) = self::_getMatrixDimensions($operand1);
|
||||
list($matrix2Rows,$matrix2Columns) = self::_getMatrixDimensions($operand2);
|
||||
list($matrix1Rows, $matrix1Columns) = self::_getMatrixDimensions($operand1);
|
||||
list($matrix2Rows, $matrix2Columns) = self::_getMatrixDimensions($operand2);
|
||||
if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
|
||||
$resize = 1;
|
||||
}
|
||||
|
||||
if ($resize == 2) {
|
||||
// Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger
|
||||
self::_resizeMatricesExtend($operand1,$operand2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
|
||||
self::_resizeMatricesExtend($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
|
||||
} elseif ($resize == 1) {
|
||||
// Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller
|
||||
self::_resizeMatricesShrink($operand1,$operand2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
|
||||
self::_resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
|
||||
}
|
||||
return array( $matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
|
||||
return array( $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
|
||||
} // function _checkMatrixOperands()
|
||||
|
||||
|
||||
@ -2474,8 +2474,8 @@ class PHPExcel_Calculation {
|
||||
public static function _getMatrixDimensions(&$matrix) {
|
||||
$matrixRows = count($matrix);
|
||||
$matrixColumns = 0;
|
||||
foreach($matrix as $rowKey => $rowValue) {
|
||||
$matrixColumns = max(count($rowValue),$matrixColumns);
|
||||
foreach ($matrix as $rowKey => $rowValue) {
|
||||
$matrixColumns = max(count($rowValue), $matrixColumns);
|
||||
if (!is_array($rowValue)) {
|
||||
$matrix[$rowKey] = array($rowValue);
|
||||
} else {
|
||||
@ -2483,7 +2483,7 @@ class PHPExcel_Calculation {
|
||||
}
|
||||
}
|
||||
$matrix = array_values($matrix);
|
||||
return array($matrixRows,$matrixColumns);
|
||||
return array($matrixRows, $matrixColumns);
|
||||
} // function _getMatrixDimensions()
|
||||
|
||||
|
||||
@ -2497,7 +2497,7 @@ class PHPExcel_Calculation {
|
||||
* @param integer $matrix2Rows Row size of second matrix operand
|
||||
* @param integer $matrix2Columns Column size of second matrix operand
|
||||
*/
|
||||
private static function _resizeMatricesShrink(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
|
||||
private static function _resizeMatricesShrink(&$matrix1,&$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) {
|
||||
if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
|
||||
if ($matrix2Rows < $matrix1Rows) {
|
||||
for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) {
|
||||
@ -2540,7 +2540,7 @@ class PHPExcel_Calculation {
|
||||
* @param integer $matrix2Rows Row size of second matrix operand
|
||||
* @param integer $matrix2Columns Column size of second matrix operand
|
||||
*/
|
||||
private static function _resizeMatricesExtend(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
|
||||
private static function _resizeMatricesExtend(&$matrix1,&$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) {
|
||||
if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
|
||||
if ($matrix2Columns < $matrix1Columns) {
|
||||
for ($i = 0; $i < $matrix2Rows; ++$i) {
|
||||
@ -2593,18 +2593,18 @@ class PHPExcel_Calculation {
|
||||
if (is_array($value)) {
|
||||
$returnMatrix = array();
|
||||
$pad = $rpad = ', ';
|
||||
foreach($value as $row) {
|
||||
foreach ($value as $row) {
|
||||
if (is_array($row)) {
|
||||
$returnMatrix[] = implode($pad,array_map(array($this,'_showValue'),$row));
|
||||
$returnMatrix[] = implode($pad,array_map(array($this,'_showValue'), $row));
|
||||
$rpad = '; ';
|
||||
} else {
|
||||
$returnMatrix[] = $this->_showValue($row);
|
||||
}
|
||||
}
|
||||
return '{ '.implode($rpad,$returnMatrix).' }';
|
||||
} elseif(is_string($value) && (trim($value,'"') == $value)) {
|
||||
return '{ '.implode($rpad, $returnMatrix).' }';
|
||||
} elseif (is_string($value) && (trim($value,'"') == $value)) {
|
||||
return '"'.$value.'"';
|
||||
} elseif(is_bool($value)) {
|
||||
} elseif (is_bool($value)) {
|
||||
return ($value) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
|
||||
}
|
||||
}
|
||||
@ -2629,11 +2629,11 @@ class PHPExcel_Calculation {
|
||||
return 'a NULL value';
|
||||
} elseif (is_float($value)) {
|
||||
$typeString = 'a floating point number';
|
||||
} elseif(is_int($value)) {
|
||||
} elseif (is_int($value)) {
|
||||
$typeString = 'an integer number';
|
||||
} elseif(is_bool($value)) {
|
||||
} elseif (is_bool($value)) {
|
||||
$typeString = 'a boolean';
|
||||
} elseif(is_array($value)) {
|
||||
} elseif (is_array($value)) {
|
||||
$typeString = 'a matrix';
|
||||
} else {
|
||||
if ($value == '') {
|
||||
@ -2659,26 +2659,26 @@ class PHPExcel_Calculation {
|
||||
if (strpos($formula,'"') !== FALSE) {
|
||||
// So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
|
||||
// the formula
|
||||
$temp = explode('"',$formula);
|
||||
$temp = explode('"', $formula);
|
||||
// Open and Closed counts used for trapping mismatched braces in the formula
|
||||
$openCount = $closeCount = 0;
|
||||
$i = FALSE;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only count/replace in alternating array entries
|
||||
if ($i = !$i) {
|
||||
$openCount += substr_count($value,'{');
|
||||
$closeCount += substr_count($value,'}');
|
||||
$value = str_replace($matrixReplaceFrom,$matrixReplaceTo,$value);
|
||||
$value = str_replace($matrixReplaceFrom, $matrixReplaceTo, $value);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$formula = implode('"',$temp);
|
||||
$formula = implode('"', $temp);
|
||||
} else {
|
||||
// If there's no quoted strings, then we do a simple count/replace
|
||||
$openCount = substr_count($formula,'{');
|
||||
$closeCount = substr_count($formula,'}');
|
||||
$formula = str_replace($matrixReplaceFrom,$matrixReplaceTo,$formula);
|
||||
$formula = str_replace($matrixReplaceFrom, $matrixReplaceTo, $formula);
|
||||
}
|
||||
// Trap for mismatched braces and trigger an appropriate error
|
||||
if ($openCount < $closeCount) {
|
||||
@ -2765,7 +2765,7 @@ class PHPExcel_Calculation {
|
||||
// should be null in a function call
|
||||
// The guts of the lexical parser
|
||||
// Loop through the formula extracting each operator and operand in turn
|
||||
while(TRUE) {
|
||||
while (TRUE) {
|
||||
//echo 'Assessing Expression '.substr($formula, $index),PHP_EOL;
|
||||
$opCharacter = $formula{$index}; // Get the first character of the value at the current index position
|
||||
//echo 'Initial character of expression block is '.$opCharacter,PHP_EOL;
|
||||
@ -2795,13 +2795,13 @@ class PHPExcel_Calculation {
|
||||
|
||||
} elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
|
||||
//echo 'Element with value '.$opCharacter.' is an Operator',PHP_EOL;
|
||||
while($stack->count() > 0 &&
|
||||
while ($stack->count() > 0 &&
|
||||
($o2 = $stack->last()) &&
|
||||
isset(self::$_operators[$o2['value']]) &&
|
||||
@(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) {
|
||||
$output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output
|
||||
}
|
||||
$stack->push('Binary Operator',$opCharacter); // Finally put our current operator onto the stack
|
||||
$stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack
|
||||
++$index;
|
||||
$expectingOperator = FALSE;
|
||||
|
||||
@ -2855,7 +2855,7 @@ class PHPExcel_Calculation {
|
||||
}
|
||||
}
|
||||
} elseif ($expectedArgumentCount != '*') {
|
||||
$isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/',$expectedArgumentCount,$argMatch);
|
||||
$isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/', $expectedArgumentCount, $argMatch);
|
||||
//print_r($argMatch);
|
||||
//echo PHP_EOL;
|
||||
switch ($argMatch[2]) {
|
||||
@ -2901,7 +2901,7 @@ class PHPExcel_Calculation {
|
||||
if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches))
|
||||
return $this->_raiseFormulaError("Formula Error: Unexpected ,");
|
||||
$d = $stack->pop();
|
||||
$stack->push($d['type'],++$d['value'],$d['reference']); // increment the argument count
|
||||
$stack->push($d['type'],++$d['value'], $d['reference']); // increment the argument count
|
||||
$stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again
|
||||
$expectingOperator = FALSE;
|
||||
$expectingOperand = TRUE;
|
||||
@ -2920,7 +2920,7 @@ class PHPExcel_Calculation {
|
||||
// echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />';
|
||||
|
||||
if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
|
||||
$val = preg_replace('/\s/u','',$val);
|
||||
$val = preg_replace('/\s/u','', $val);
|
||||
// echo 'Element '.$val.' is a Function<br />';
|
||||
if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) { // it's a function
|
||||
$stack->push('Function', strtoupper($val));
|
||||
@ -2967,13 +2967,13 @@ class PHPExcel_Calculation {
|
||||
if ($testPrevOp['value'] == ':') {
|
||||
$startRowColRef = $output[count($output)-1]['value'];
|
||||
$rangeWS1 = '';
|
||||
if (strpos('!',$startRowColRef) !== FALSE) {
|
||||
list($rangeWS1,$startRowColRef) = explode('!',$startRowColRef);
|
||||
if (strpos('!', $startRowColRef) !== FALSE) {
|
||||
list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef);
|
||||
}
|
||||
if ($rangeWS1 != '') $rangeWS1 .= '!';
|
||||
$rangeWS2 = $rangeWS1;
|
||||
if (strpos('!',$val) !== FALSE) {
|
||||
list($rangeWS2,$val) = explode('!',$val);
|
||||
if (strpos('!', $val) !== FALSE) {
|
||||
list($rangeWS2, $val) = explode('!', $val);
|
||||
}
|
||||
if ($rangeWS2 != '') $rangeWS2 .= '!';
|
||||
if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
|
||||
@ -3058,7 +3058,7 @@ class PHPExcel_Calculation {
|
||||
if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) &&
|
||||
($output[count($output)-1]['type'] == 'Cell Reference')) {
|
||||
// echo 'Element is an Intersect Operator<br />';
|
||||
while($stack->count() > 0 &&
|
||||
while ($stack->count() > 0 &&
|
||||
($o2 = $stack->last()) &&
|
||||
isset(self::$_operators[$o2['value']]) &&
|
||||
@(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) {
|
||||
@ -3136,18 +3136,18 @@ class PHPExcel_Calculation {
|
||||
case '<=' : // Less than or Equal to
|
||||
case '=' : // Equality
|
||||
case '<>' : // Inequality
|
||||
$this->_executeBinaryComparisonOperation($cellID,$operand1,$operand2,$token,$stack);
|
||||
$this->_executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack);
|
||||
break;
|
||||
// Binary Operators
|
||||
case ':' : // Range
|
||||
$sheet1 = $sheet2 = '';
|
||||
if (strpos($operand1Data['reference'],'!') !== FALSE) {
|
||||
list($sheet1,$operand1Data['reference']) = explode('!',$operand1Data['reference']);
|
||||
list($sheet1, $operand1Data['reference']) = explode('!', $operand1Data['reference']);
|
||||
} else {
|
||||
$sheet1 = ($pCellParent !== NULL) ? $pCellWorksheet->getTitle() : '';
|
||||
}
|
||||
if (strpos($operand2Data['reference'],'!') !== FALSE) {
|
||||
list($sheet2,$operand2Data['reference']) = explode('!',$operand2Data['reference']);
|
||||
list($sheet2, $operand2Data['reference']) = explode('!', $operand2Data['reference']);
|
||||
} else {
|
||||
$sheet2 = $sheet1;
|
||||
}
|
||||
@ -3171,9 +3171,9 @@ class PHPExcel_Calculation {
|
||||
}
|
||||
}
|
||||
|
||||
$oData = array_merge(explode(':',$operand1Data['reference']),explode(':',$operand2Data['reference']));
|
||||
$oData = array_merge(explode(':', $operand1Data['reference']),explode(':', $operand2Data['reference']));
|
||||
$oCol = $oRow = array();
|
||||
foreach($oData as $oDatum) {
|
||||
foreach ($oData as $oDatum) {
|
||||
$oCR = PHPExcel_Cell::coordinateFromString($oDatum);
|
||||
$oCol[] = PHPExcel_Cell::columnIndexFromString($oCR[0]) - 1;
|
||||
$oRow[] = $oCR[1];
|
||||
@ -3184,26 +3184,26 @@ class PHPExcel_Calculation {
|
||||
} else {
|
||||
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
||||
}
|
||||
$stack->push('Cell Reference',$cellValue,$cellRef);
|
||||
$stack->push('Cell Reference', $cellValue, $cellRef);
|
||||
} else {
|
||||
$stack->push('Error',PHPExcel_Calculation_Functions::REF(),NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
case '+' : // Addition
|
||||
$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'plusEquals',$stack);
|
||||
$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token,'plusEquals', $stack);
|
||||
break;
|
||||
case '-' : // Subtraction
|
||||
$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'minusEquals',$stack);
|
||||
$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token,'minusEquals', $stack);
|
||||
break;
|
||||
case '*' : // Multiplication
|
||||
$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayTimesEquals',$stack);
|
||||
$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token,'arrayTimesEquals', $stack);
|
||||
break;
|
||||
case '/' : // Division
|
||||
$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayRightDivide',$stack);
|
||||
$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token,'arrayRightDivide', $stack);
|
||||
break;
|
||||
case '^' : // Exponential
|
||||
$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'power',$stack);
|
||||
$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token,'power', $stack);
|
||||
break;
|
||||
case '&' : // Concatenation
|
||||
// If either of the operands is a matrix, we need to treat them both as matrices
|
||||
@ -3217,7 +3217,7 @@ class PHPExcel_Calculation {
|
||||
}
|
||||
if ((is_array($operand1)) || (is_array($operand2))) {
|
||||
// Ensure that both operands are arrays/matrices
|
||||
self::_checkMatrixOperands($operand1,$operand2,2);
|
||||
self::_checkMatrixOperands($operand1, $operand2,2);
|
||||
try {
|
||||
// Convert operand 1 from a PHP array to a matrix
|
||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
|
||||
@ -3232,21 +3232,21 @@ class PHPExcel_Calculation {
|
||||
$result = '"'.str_replace('""','"',self::_unwrapResult($operand1,'"').self::_unwrapResult($operand2,'"')).'"';
|
||||
}
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
|
||||
$stack->push('Value',$result);
|
||||
$stack->push('Value', $result);
|
||||
break;
|
||||
case '|' : // Intersect
|
||||
$rowIntersect = array_intersect_key($operand1,$operand2);
|
||||
$rowIntersect = array_intersect_key($operand1, $operand2);
|
||||
$cellIntersect = $oCol = $oRow = array();
|
||||
foreach(array_keys($rowIntersect) as $row) {
|
||||
foreach (array_keys($rowIntersect) as $row) {
|
||||
$oRow[] = $row;
|
||||
foreach($rowIntersect[$row] as $col => $data) {
|
||||
foreach ($rowIntersect[$row] as $col => $data) {
|
||||
$oCol[] = PHPExcel_Cell::columnIndexFromString($col) - 1;
|
||||
$cellIntersect[$row] = array_intersect_key($operand1[$row],$operand2[$row]);
|
||||
$cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]);
|
||||
}
|
||||
}
|
||||
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($cellIntersect));
|
||||
$stack->push('Value',$cellIntersect,$cellRef);
|
||||
$stack->push('Value', $cellIntersect, $cellRef);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3265,7 +3265,7 @@ class PHPExcel_Calculation {
|
||||
$multiplier = 0.01;
|
||||
}
|
||||
if (is_array($arg)) {
|
||||
self::_checkMatrixOperands($arg,$multiplier,2);
|
||||
self::_checkMatrixOperands($arg, $multiplier,2);
|
||||
try {
|
||||
$matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg);
|
||||
$matrixResult = $matrix1->arrayTimesEquals($multiplier);
|
||||
@ -3275,9 +3275,9 @@ class PHPExcel_Calculation {
|
||||
$result = '#VALUE!';
|
||||
}
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
|
||||
$stack->push('Value',$result);
|
||||
$stack->push('Value', $result);
|
||||
} else {
|
||||
$this->_executeNumericBinaryOperation($cellID,$multiplier,$arg,'*','arrayTimesEquals',$stack);
|
||||
$this->_executeNumericBinaryOperation($cellID, $multiplier, $arg,'*','arrayTimesEquals', $stack);
|
||||
}
|
||||
|
||||
} elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
|
||||
@ -3358,7 +3358,7 @@ class PHPExcel_Calculation {
|
||||
}
|
||||
}
|
||||
}
|
||||
$stack->push('Value',$cellValue,$cellRef);
|
||||
$stack->push('Value', $cellValue, $cellRef);
|
||||
|
||||
// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
|
||||
} elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) {
|
||||
@ -3421,18 +3421,18 @@ class PHPExcel_Calculation {
|
||||
// $this->_debugLog->writeDebugLog('Argument is a matrix: ', $this->_showValue($operand1));
|
||||
// $result = array();
|
||||
// $row = 0;
|
||||
// foreach($operand1 as $args) {
|
||||
// foreach ($operand1 as $args) {
|
||||
// if (is_array($args)) {
|
||||
// foreach($args as $arg) {
|
||||
// foreach ($args as $arg) {
|
||||
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($arg), ' )');
|
||||
// $r = call_user_func_array($functionCall,$arg);
|
||||
// $r = call_user_func_array($functionCall, $arg);
|
||||
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
|
||||
// $result[$row][] = $r;
|
||||
// }
|
||||
// ++$row;
|
||||
// } else {
|
||||
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($args), ' )');
|
||||
// $r = call_user_func_array($functionCall,$args);
|
||||
// $r = call_user_func_array($functionCall, $args);
|
||||
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
|
||||
// $result[] = $r;
|
||||
// }
|
||||
@ -3443,13 +3443,13 @@ class PHPExcel_Calculation {
|
||||
$args[] = $pCell;
|
||||
}
|
||||
if (strpos($functionCall,'::') !== FALSE) {
|
||||
$result = call_user_func_array(explode('::',$functionCall),$args);
|
||||
$result = call_user_func_array(explode('::', $functionCall), $args);
|
||||
} else {
|
||||
foreach($args as &$arg) {
|
||||
foreach ($args as &$arg) {
|
||||
$arg = PHPExcel_Calculation_Functions::flattenSingleValue($arg);
|
||||
}
|
||||
unset($arg);
|
||||
$result = call_user_func_array($functionCall,$args);
|
||||
$result = call_user_func_array($functionCall, $args);
|
||||
}
|
||||
// }
|
||||
if ($functionName != 'MKMATRIX') {
|
||||
@ -3467,7 +3467,7 @@ class PHPExcel_Calculation {
|
||||
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
|
||||
} elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
|
||||
// echo 'Token is a number, boolean, string, null or an Excel error<br />';
|
||||
$stack->push('Value',$token);
|
||||
$stack->push('Value', $token);
|
||||
// if the token is a named range, push the named range name onto the stack
|
||||
} elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) {
|
||||
// echo 'Token is a named range<br />';
|
||||
@ -3477,7 +3477,7 @@ class PHPExcel_Calculation {
|
||||
$cellValue = $this->extractNamedRange($namedRange, ((NULL !== $pCell) ? $pCellWorksheet : NULL), FALSE);
|
||||
$pCell->attach($pCellParent);
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->_showTypeDetails($cellValue));
|
||||
$stack->push('Named Range',$cellValue,$namedRange);
|
||||
$stack->push('Named Range', $cellValue, $namedRange);
|
||||
} else {
|
||||
return $this->_raiseFormulaError("undefined variable '$token'");
|
||||
}
|
||||
@ -3534,24 +3534,24 @@ class PHPExcel_Calculation {
|
||||
if ((is_array($operand1)) || (is_array($operand2))) {
|
||||
$result = array();
|
||||
if ((is_array($operand1)) && (!is_array($operand2))) {
|
||||
foreach($operand1 as $x => $operandData) {
|
||||
foreach ($operand1 as $x => $operandData) {
|
||||
$this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->_showValue($operandData), ' ', $operation, ' ', $this->_showValue($operand2));
|
||||
$this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2,$operation,$stack);
|
||||
$this->_executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack);
|
||||
$r = $stack->pop();
|
||||
$result[$x] = $r['value'];
|
||||
}
|
||||
} elseif ((!is_array($operand1)) && (is_array($operand2))) {
|
||||
foreach($operand2 as $x => $operandData) {
|
||||
foreach ($operand2 as $x => $operandData) {
|
||||
$this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->_showValue($operand1), ' ', $operation, ' ', $this->_showValue($operandData));
|
||||
$this->_executeBinaryComparisonOperation($cellID,$operand1,$operandData,$operation,$stack);
|
||||
$this->_executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack);
|
||||
$r = $stack->pop();
|
||||
$result[$x] = $r['value'];
|
||||
}
|
||||
} else {
|
||||
if (!$recursingArrays) { self::_checkMatrixOperands($operand1,$operand2,2); }
|
||||
foreach($operand1 as $x => $operandData) {
|
||||
if (!$recursingArrays) { self::_checkMatrixOperands($operand1, $operand2,2); }
|
||||
foreach ($operand1 as $x => $operandData) {
|
||||
$this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->_showValue($operandData), ' ', $operation, ' ', $this->_showValue($operand2[$x]));
|
||||
$this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,TRUE);
|
||||
$this->_executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack,TRUE);
|
||||
$r = $stack->pop();
|
||||
$result[$x] = $r['value'];
|
||||
}
|
||||
@ -3559,7 +3559,7 @@ class PHPExcel_Calculation {
|
||||
// Log the result details
|
||||
$this->_debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->_showTypeDetails($result));
|
||||
// And push the result onto the stack
|
||||
$stack->push('Array',$result);
|
||||
$stack->push('Array', $result);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3640,7 +3640,7 @@ class PHPExcel_Calculation {
|
||||
// Log the result details
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
|
||||
// And push the result onto the stack
|
||||
$stack->push('Value',$result);
|
||||
$stack->push('Value', $result);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3658,10 +3658,10 @@ class PHPExcel_Calculation {
|
||||
return strcmp($inversedStr1, $inversedStr2);
|
||||
}
|
||||
|
||||
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
|
||||
private function _executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction,&$stack) {
|
||||
// Validate the two operands
|
||||
if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return FALSE;
|
||||
if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return FALSE;
|
||||
if (!$this->_validateBinaryOperand($cellID, $operand1, $stack)) return FALSE;
|
||||
if (!$this->_validateBinaryOperand($cellID, $operand2, $stack)) return FALSE;
|
||||
|
||||
// If either of the operands is a matrix, we need to treat them both as matrices
|
||||
// (converting the other operand to a matrix if need be); then perform the required
|
||||
@ -3722,7 +3722,7 @@ class PHPExcel_Calculation {
|
||||
// Log the result details
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
|
||||
// And push the result onto the stack
|
||||
$stack->push('Value',$result);
|
||||
$stack->push('Value', $result);
|
||||
return TRUE;
|
||||
} // function _executeNumericBinaryOperation()
|
||||
|
||||
@ -3756,7 +3756,7 @@ class PHPExcel_Calculation {
|
||||
// echo 'Range reference is '.$pRange.PHP_EOL;
|
||||
if (strpos ($pRange, '!') !== false) {
|
||||
// echo '$pRange reference includes sheet reference',PHP_EOL;
|
||||
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
|
||||
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
|
||||
$pSheet = $this->_workbook->getSheetByName($pSheetName);
|
||||
@ -3814,7 +3814,7 @@ class PHPExcel_Calculation {
|
||||
// echo 'Range reference is '.$pRange.'<br />';
|
||||
if (strpos ($pRange, '!') !== false) {
|
||||
// echo '$pRange reference includes sheet reference',PHP_EOL;
|
||||
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
|
||||
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
|
||||
$pSheet = $this->_workbook->getSheetByName($pSheetName);
|
||||
@ -3830,7 +3830,7 @@ class PHPExcel_Calculation {
|
||||
// Convert row and column references
|
||||
if (ctype_alpha($splitRange[0][0])) {
|
||||
$pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
|
||||
} elseif(ctype_digit($splitRange[0][0])) {
|
||||
} elseif (ctype_digit($splitRange[0][0])) {
|
||||
$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
|
||||
}
|
||||
// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
|
||||
@ -3851,7 +3851,7 @@ class PHPExcel_Calculation {
|
||||
// var_dump($aReferences);
|
||||
if (!isset($aReferences[1])) {
|
||||
// Single cell (or single column or row) in range
|
||||
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
|
||||
list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
|
||||
$cellValue = NULL;
|
||||
if ($pSheet->cellExists($aReferences[0])) {
|
||||
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
||||
@ -3862,7 +3862,7 @@ class PHPExcel_Calculation {
|
||||
// Extract cell data for all cells in the range
|
||||
foreach ($aReferences as $reference) {
|
||||
// Extract range
|
||||
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference);
|
||||
list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($reference);
|
||||
// echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
|
||||
$cellValue = NULL;
|
||||
if ($pSheet->cellExists($reference)) {
|
||||
@ -3906,7 +3906,7 @@ class PHPExcel_Calculation {
|
||||
// Return value
|
||||
$returnValue = array();
|
||||
// Loop functions
|
||||
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
|
||||
foreach (self::$_PHPExcelFunctions as $functionName => $function) {
|
||||
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
|
||||
$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
|
||||
$functionName,
|
||||
@ -3938,7 +3938,7 @@ class PHPExcel_Calculation {
|
||||
// Return value
|
||||
$returnValue = array();
|
||||
// Loop functions
|
||||
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
|
||||
foreach (self::$_PHPExcelFunctions as $functionName => $function) {
|
||||
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
|
||||
$returnValue[] = $functionName;
|
||||
}
|
||||
|
@ -847,7 +847,7 @@ class PHPExcel_Calculation_DateTime
|
||||
}
|
||||
|
||||
if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) {
|
||||
switch($method) {
|
||||
switch ($method) {
|
||||
case 0:
|
||||
return self::DAYS360($startDate, $endDate) / 360;
|
||||
case 1:
|
||||
|
@ -1019,7 +1019,7 @@ class PHPExcel_Calculation_Engineering
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
switch(floor($ord)) {
|
||||
switch (floor($ord)) {
|
||||
case 0:
|
||||
return self::besselK0($x);
|
||||
case 1:
|
||||
@ -1103,7 +1103,7 @@ class PHPExcel_Calculation_Engineering
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
switch(floor($ord)) {
|
||||
switch (floor($ord)) {
|
||||
case 0:
|
||||
return self::besselY0($x);
|
||||
case 1:
|
||||
|
@ -1120,7 +1120,7 @@ class PHPExcel_Calculation_MathTrig
|
||||
$subtotal = array_shift($aArgs);
|
||||
|
||||
if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
|
||||
switch($subtotal) {
|
||||
switch ($subtotal) {
|
||||
case 1:
|
||||
return PHPExcel_Calculation_Statistical::AVERAGE($aArgs);
|
||||
case 2:
|
||||
|
@ -3452,7 +3452,7 @@ class PHPExcel_Calculation_Statistical
|
||||
* of a data set.
|
||||
*
|
||||
* Excel Function:
|
||||
* TRIMEAN(value1[,value2[, ...]],$discard)
|
||||
* TRIMEAN(value1[,value2[, ...]], $discard)
|
||||
*
|
||||
* @access public
|
||||
* @category Statistical Functions
|
||||
|
@ -584,7 +584,7 @@ class PHPExcel_Cell
|
||||
public static function coordinateFromString($pCoordinateString = 'A1')
|
||||
{
|
||||
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
|
||||
return array($matches[1],$matches[2]);
|
||||
return array($matches[1], $matches[2]);
|
||||
} elseif ((strpos($pCoordinateString,':') !== false) || (strpos($pCoordinateString,',') !== false)) {
|
||||
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells');
|
||||
} elseif ($pCoordinateString == '') {
|
||||
|
@ -90,33 +90,33 @@ class PHPExcel_Chart
|
||||
*/
|
||||
private $_displayBlanksAs = '0';
|
||||
|
||||
/**
|
||||
* Chart Asix Y as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_yAxis = null;
|
||||
/**
|
||||
* Chart Asix Y as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_yAxis = null;
|
||||
|
||||
/**
|
||||
* Chart Asix X as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_xAxis = null;
|
||||
/**
|
||||
* Chart Asix X as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_xAxis = null;
|
||||
|
||||
/**
|
||||
* Chart Major Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_majorGridlines = null;
|
||||
/**
|
||||
* Chart Major Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_majorGridlines = null;
|
||||
|
||||
/**
|
||||
* Chart Minor Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_minorGridlines = null;
|
||||
/**
|
||||
* Chart Minor Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_minorGridlines = null;
|
||||
|
||||
/**
|
||||
* Top-Left Cell Position
|
||||
@ -304,7 +304,8 @@ class PHPExcel_Chart
|
||||
* @param PHPExcel_Chart_Title $label
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label) {
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label)
|
||||
{
|
||||
$this->_yAxisLabel = $label;
|
||||
|
||||
return $this;
|
||||
@ -365,62 +366,62 @@ class PHPExcel_Chart
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get yAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisY()
|
||||
{
|
||||
if ($this->_yAxis !== null) {
|
||||
return $this->_yAxis;
|
||||
/**
|
||||
* Get yAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisY()
|
||||
{
|
||||
if ($this->_yAxis !== null) {
|
||||
return $this->_yAxis;
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
/**
|
||||
* Get xAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisX()
|
||||
{
|
||||
if ($this->_xAxis !== null) {
|
||||
return $this->_xAxis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get xAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisX()
|
||||
{
|
||||
if ($this->_xAxis !== null) {
|
||||
return $this->_xAxis;
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
/**
|
||||
* Get Major Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMajorGridlines()
|
||||
{
|
||||
if ($this->_majorGridlines !== null) {
|
||||
return $this->_majorGridlines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Major Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMajorGridlines()
|
||||
{
|
||||
if ($this->_majorGridlines !== null) {
|
||||
return $this->_majorGridlines;
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
/**
|
||||
* Get Minor Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMinorGridlines()
|
||||
{
|
||||
if ($this->_minorGridlines !== null) {
|
||||
return $this->_minorGridlines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Minor Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMinorGridlines()
|
||||
{
|
||||
if ($this->_minorGridlines !== null) {
|
||||
return $this->_minorGridlines;
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Top Left position for the chart
|
||||
@ -430,7 +431,7 @@ class PHPExcel_Chart
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null)
|
||||
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
|
||||
{
|
||||
$this->_topLeftCellRef = $cell;
|
||||
if (!is_null($xOffset)) {
|
||||
@ -662,9 +663,9 @@ class PHPExcel_Chart
|
||||
$this->refresh();
|
||||
|
||||
$libraryPath = PHPExcel_Settings::getChartRendererPath();
|
||||
$includePath = str_replace('\\','/',get_include_path());
|
||||
$rendererPath = str_replace('\\','/',$libraryPath);
|
||||
if (strpos($rendererPath,$includePath) === false) {
|
||||
$includePath = str_replace('\\', '/', get_include_path());
|
||||
$rendererPath = str_replace('\\', '/', $libraryPath);
|
||||
if (strpos($rendererPath, $includePath) === false) {
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
|
||||
}
|
||||
|
||||
|
@ -371,17 +371,17 @@ class PHPExcel_Chart_DataSeries
|
||||
|
||||
public function refresh(PHPExcel_Worksheet $worksheet)
|
||||
{
|
||||
foreach($this->_plotValues as $plotValues) {
|
||||
foreach ($this->_plotValues as $plotValues) {
|
||||
if ($plotValues !== null) {
|
||||
$plotValues->refresh($worksheet, true);
|
||||
}
|
||||
}
|
||||
foreach($this->_plotLabel as $plotValues) {
|
||||
foreach ($this->_plotLabel as $plotValues) {
|
||||
if ($plotValues !== null) {
|
||||
$plotValues->refresh($worksheet, true);
|
||||
}
|
||||
}
|
||||
foreach($this->_plotCategory as $plotValues) {
|
||||
foreach ($this->_plotCategory as $plotValues) {
|
||||
if ($plotValues !== null) {
|
||||
$plotValues->refresh($worksheet, false);
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function multiLevelCount() {
|
||||
$levelCount = 0;
|
||||
foreach($this->_dataValues as $dataValueSet) {
|
||||
foreach ($this->_dataValues as $dataValueSet) {
|
||||
$levelCount = max($levelCount,count($dataValueSet));
|
||||
}
|
||||
return $levelCount;
|
||||
@ -281,31 +281,31 @@ class PHPExcel_Chart_DataSeriesValues
|
||||
);
|
||||
if ($flatten) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
foreach($this->_dataValues as &$dataValue) {
|
||||
foreach ($this->_dataValues as &$dataValue) {
|
||||
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
|
||||
$dataValue = 0.0;
|
||||
}
|
||||
}
|
||||
unset($dataValue);
|
||||
} else {
|
||||
$cellRange = explode('!',$this->_dataSource);
|
||||
$cellRange = explode('!', $this->_dataSource);
|
||||
if (count($cellRange) > 1) {
|
||||
list(,$cellRange) = $cellRange;
|
||||
list(, $cellRange) = $cellRange;
|
||||
}
|
||||
|
||||
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange));
|
||||
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','', $cellRange));
|
||||
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
} else {
|
||||
$newArray = array_values(array_shift($newDataValues));
|
||||
foreach($newArray as $i => $newDataSet) {
|
||||
foreach ($newArray as $i => $newDataSet) {
|
||||
$newArray[$i] = array($newDataSet);
|
||||
}
|
||||
|
||||
foreach($newDataValues as $newDataSet) {
|
||||
foreach ($newDataValues as $newDataSet) {
|
||||
$i = 0;
|
||||
foreach($newDataSet as $newDataVal) {
|
||||
array_unshift($newArray[$i++],$newDataVal);
|
||||
foreach ($newDataSet as $newDataVal) {
|
||||
array_unshift($newArray[$i++], $newDataVal);
|
||||
}
|
||||
}
|
||||
$this->_dataValues = $newArray;
|
||||
|
@ -71,7 +71,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
private static $_plotMark = 0;
|
||||
|
||||
|
||||
private function _formatPointMarker($seriesPlot,$markerID) {
|
||||
private function _formatPointMarker($seriesPlot, $markerID) {
|
||||
$plotMarkKeys = array_keys(self::$_markSet);
|
||||
if (is_null($markerID)) {
|
||||
// Use default plot marker (next marker in the series)
|
||||
@ -106,18 +106,18 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
}
|
||||
|
||||
$testCurrentIndex = 0;
|
||||
foreach($datasetLabels as $i => $datasetLabel) {
|
||||
foreach ($datasetLabels as $i => $datasetLabel) {
|
||||
if (is_array($datasetLabel)) {
|
||||
if ($rotation == 'bar') {
|
||||
$datasetLabels[$i] = implode(" ",$datasetLabel);
|
||||
$datasetLabels[$i] = implode(" ", $datasetLabel);
|
||||
} else {
|
||||
$datasetLabel = array_reverse($datasetLabel);
|
||||
$datasetLabels[$i] = implode("\n",$datasetLabel);
|
||||
$datasetLabels[$i] = implode("\n", $datasetLabel);
|
||||
}
|
||||
} else {
|
||||
// Format labels according to any formatting code
|
||||
if (!is_null($datasetLabelFormatCode)) {
|
||||
$datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode);
|
||||
$datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode);
|
||||
}
|
||||
}
|
||||
++$testCurrentIndex;
|
||||
@ -127,14 +127,14 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _formatDataSetLabels()
|
||||
|
||||
|
||||
private function _percentageSumCalculation($groupID,$seriesCount) {
|
||||
private function _percentageSumCalculation($groupID, $seriesCount) {
|
||||
// Adjust our values to a percentage value across all series in the group
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
if ($i == 0) {
|
||||
$sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
} else {
|
||||
$nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
foreach($nextValues as $k => $value) {
|
||||
foreach ($nextValues as $k => $value) {
|
||||
if (isset($sumValues[$k])) {
|
||||
$sumValues[$k] += $value;
|
||||
} else {
|
||||
@ -148,8 +148,8 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _percentageSumCalculation()
|
||||
|
||||
|
||||
private function _percentageAdjustValues($dataValues,$sumValues) {
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
private function _percentageAdjustValues($dataValues, $sumValues) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
$dataValues[$k] = $dataValue / $sumValues[$k] * 100;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
// If we do, it could be a plain string or an array
|
||||
if (is_array($caption)) {
|
||||
// Implode an array to a plain string
|
||||
$caption = implode('',$caption);
|
||||
$caption = implode('', $caption);
|
||||
}
|
||||
}
|
||||
return $caption;
|
||||
@ -276,7 +276,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
|
||||
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
|
||||
}
|
||||
|
||||
// Loop through each data series in turn
|
||||
@ -285,13 +285,13 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
|
||||
if ($grouping == 'percentStacked') {
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
|
||||
}
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
while ($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
@ -309,7 +309,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
|
||||
} else {
|
||||
// Set the appropriate plot marker
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$this->_formatPointMarker($seriesPlot, $marker);
|
||||
}
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
@ -352,20 +352,20 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
|
||||
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
|
||||
}
|
||||
|
||||
// Loop through each data series in turn
|
||||
for($j = 0; $j < $seriesCount; ++$j) {
|
||||
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
|
||||
}
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
while ($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
@ -411,7 +411,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _renderPlotBar()
|
||||
|
||||
|
||||
private function _renderPlotScatter($groupID,$bubble) {
|
||||
private function _renderPlotScatter($groupID, $bubble) {
|
||||
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
$scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
@ -423,18 +423,18 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
|
||||
foreach($dataValuesY as $k => $dataValueY) {
|
||||
foreach ($dataValuesY as $k => $dataValueY) {
|
||||
$dataValuesY[$k] = $k;
|
||||
}
|
||||
|
||||
$seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY);
|
||||
$seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
|
||||
if ($scatterStyle == 'lineMarker') {
|
||||
$seriesPlot->SetLinkPoints();
|
||||
$seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
} elseif ($scatterStyle == 'smoothMarker') {
|
||||
$spline = new Spline($dataValuesY,$dataValuesX);
|
||||
list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
|
||||
$lplot = new LinePlot($splineDataX,$splineDataY);
|
||||
$spline = new Spline($dataValuesY, $dataValuesX);
|
||||
list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
|
||||
$lplot = new LinePlot($splineDataX, $splineDataY);
|
||||
$lplot->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
|
||||
$this->_graph->Add($lplot);
|
||||
@ -446,7 +446,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesPlot->mark->SetSize($bubbleSize);
|
||||
} else {
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$this->_formatPointMarker($seriesPlot, $marker);
|
||||
}
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
@ -469,7 +469,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
|
||||
$dataValues = array();
|
||||
foreach($dataValuesY as $k => $dataValueY) {
|
||||
foreach ($dataValuesY as $k => $dataValueY) {
|
||||
$dataValues[$k] = implode(' ',array_reverse($dataValueY));
|
||||
}
|
||||
$tmp = array_shift($dataValues);
|
||||
@ -486,7 +486,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
if ($radarStyle == 'filled') {
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]);
|
||||
}
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$this->_formatPointMarker($seriesPlot, $marker);
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
@ -520,13 +520,13 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
|
||||
$dataValues = array();
|
||||
// Loop through each data series in turn and build the plot arrays
|
||||
foreach($plotOrder as $i => $v) {
|
||||
foreach ($plotOrder as $i => $v) {
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
|
||||
foreach($dataValuesX as $j => $dataValueX) {
|
||||
foreach ($dataValuesX as $j => $dataValueX) {
|
||||
$dataValues[$plotOrder[$i]][$j] = $dataValueX;
|
||||
}
|
||||
}
|
||||
if(empty($dataValues)) {
|
||||
if (empty($dataValues)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotLine($i,True,False,$dimensions);
|
||||
$this->_renderPlotLine($i,True,False, $dimensions);
|
||||
}
|
||||
} // function _renderAreaChart()
|
||||
|
||||
@ -570,7 +570,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotLine($i,False,False,$dimensions);
|
||||
$this->_renderPlotLine($i,False,False, $dimensions);
|
||||
}
|
||||
} // function _renderLineChart()
|
||||
|
||||
@ -581,7 +581,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotBar($i,$dimensions);
|
||||
$this->_renderPlotBar($i, $dimensions);
|
||||
}
|
||||
} // function _renderBarChart()
|
||||
|
||||
@ -640,8 +640,8 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
while ($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
@ -707,7 +707,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _renderStockChart()
|
||||
|
||||
|
||||
private function _renderContourChart($groupCount,$dimensions) {
|
||||
private function _renderContourChart($groupCount, $dimensions) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
|
||||
|
||||
$this->_renderCartesianPlotArea('intint');
|
||||
@ -718,7 +718,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _renderContourChart()
|
||||
|
||||
|
||||
private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) {
|
||||
private function _renderCombinationChart($groupCount, $dimensions, $outputDestination) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
|
||||
@ -734,17 +734,17 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
case 'area3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'areaChart' :
|
||||
$this->_renderPlotLine($i,True,True,$dimensions);
|
||||
$this->_renderPlotLine($i,True,True, $dimensions);
|
||||
break;
|
||||
case 'bar3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'barChart' :
|
||||
$this->_renderPlotBar($i,$dimensions);
|
||||
$this->_renderPlotBar($i, $dimensions);
|
||||
break;
|
||||
case 'line3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'lineChart' :
|
||||
$this->_renderPlotLine($i,False,True,$dimensions);
|
||||
$this->_renderPlotLine($i,False,True, $dimensions);
|
||||
break;
|
||||
case 'scatterChart' :
|
||||
$this->_renderPlotScatter($i,false);
|
||||
@ -785,7 +785,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
echo 'Chart is not yet implemented<br />';
|
||||
return false;
|
||||
} else {
|
||||
return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination);
|
||||
return $this->_renderCombinationChart($groupCount, $dimensions, $outputDestination);
|
||||
}
|
||||
}
|
||||
|
||||
@ -793,27 +793,27 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
case 'area3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'areaChart' :
|
||||
$this->_renderAreaChart($groupCount,$dimensions);
|
||||
$this->_renderAreaChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'bar3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'barChart' :
|
||||
$this->_renderBarChart($groupCount,$dimensions);
|
||||
$this->_renderBarChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'line3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'lineChart' :
|
||||
$this->_renderLineChart($groupCount,$dimensions);
|
||||
$this->_renderLineChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'pie3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'pieChart' :
|
||||
$this->_renderPieChart($groupCount,$dimensions,False,False);
|
||||
$this->_renderPieChart($groupCount, $dimensions,False,False);
|
||||
break;
|
||||
case 'doughnut3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'doughnutChart' :
|
||||
$this->_renderPieChart($groupCount,$dimensions,True,True);
|
||||
$this->_renderPieChart($groupCount, $dimensions,True,True);
|
||||
break;
|
||||
case 'scatterChart' :
|
||||
$this->_renderScatterChart($groupCount);
|
||||
@ -827,10 +827,10 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
case 'surface3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'surfaceChart' :
|
||||
$this->_renderContourChart($groupCount,$dimensions);
|
||||
$this->_renderContourChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'stockChart' :
|
||||
$this->_renderStockChart($groupCount,$dimensions);
|
||||
$this->_renderStockChart($groupCount, $dimensions);
|
||||
break;
|
||||
default :
|
||||
echo $chartType.' is not yet implemented<br />';
|
||||
|
@ -466,7 +466,7 @@ class PHPExcel_DocumentProperties
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
} elseif (is_float($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_FLOAT;
|
||||
} elseif(is_int($propertyValue)) {
|
||||
} elseif (is_int($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_INTEGER;
|
||||
} elseif (is_bool($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_BOOLEAN;
|
||||
@ -497,7 +497,7 @@ class PHPExcel_DocumentProperties
|
||||
}
|
||||
}
|
||||
|
||||
public static function convertProperty($propertyValue,$propertyType)
|
||||
public static function convertProperty($propertyValue, $propertyType)
|
||||
{
|
||||
switch ($propertyType) {
|
||||
case 'empty': // Empty
|
||||
|
@ -637,7 +637,7 @@ class PHPExcel_Helper_HTML
|
||||
|
||||
protected function rgbToColour($rgb) {
|
||||
preg_match_all('/\d+/', $rgb, $values);
|
||||
foreach($values[0] as &$value) {
|
||||
foreach ($values[0] as &$value) {
|
||||
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return implode($values[0]);
|
||||
@ -655,7 +655,7 @@ class PHPExcel_Helper_HTML
|
||||
if ($attributeName == 'color') {
|
||||
if (preg_match('/rgb\s*\(/', $attributeValue)) {
|
||||
$this->$attributeName = $this->rgbToColour($attributeValue);
|
||||
} elseif(strpos(trim($attributeValue), '#') === 0) {
|
||||
} elseif (strpos(trim($attributeValue), '#') === 0) {
|
||||
$this->$attributeName = ltrim($attributeValue, '#');
|
||||
} else {
|
||||
$this->$attributeName = $this->colourNameLookup($attributeValue);
|
||||
|
@ -203,7 +203,7 @@ class PHPExcel_IOFactory
|
||||
{
|
||||
$reader = self::createReaderForFile($pFilename);
|
||||
$className = get_class($reader);
|
||||
$classType = explode('_',$className);
|
||||
$classType = explode('_', $className);
|
||||
unset($reader);
|
||||
return array_pop($classType);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class PHPExcel_NamedRange
|
||||
|
||||
// Re-attach
|
||||
if ($this->_worksheet !== NULL) {
|
||||
$this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet);
|
||||
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
|
||||
}
|
||||
$this->_name = $value;
|
||||
|
||||
|
@ -266,7 +266,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
|
||||
// Loop through each line of the file in turn
|
||||
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||
$columnLetter = 'A';
|
||||
foreach($rowData as $rowDatum) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
|
||||
// Unescape enclosures
|
||||
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum);
|
||||
|
@ -101,7 +101,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
fclose($fileHandle);
|
||||
|
||||
$valid = true;
|
||||
foreach($signature as $match) {
|
||||
foreach ($signature as $match) {
|
||||
// every part of the signature must be present
|
||||
if (strpos($data, $match) === false) {
|
||||
$valid = false;
|
||||
@ -110,10 +110,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
|
||||
// Retrieve charset encoding
|
||||
if(preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um',$data,$matches)) {
|
||||
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
|
||||
$this->_charSet = strtoupper($matches[1]);
|
||||
}
|
||||
// echo 'Character Set is ',$this->_charSet,'<br />';
|
||||
// echo 'Character Set is ', $this->_charSet,'<br />';
|
||||
|
||||
return $valid;
|
||||
}
|
||||
@ -141,9 +141,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
foreach ($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
$worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'],$this->_charSet);
|
||||
$worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet);
|
||||
}
|
||||
|
||||
return $worksheetNames;
|
||||
@ -170,7 +170,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
$worksheetID = 1;
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
foreach ($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
|
||||
$tmpInfo = array();
|
||||
@ -189,11 +189,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
if (isset($worksheet->Table->Row)) {
|
||||
$rowIndex = 0;
|
||||
|
||||
foreach($worksheet->Table->Row as $rowData) {
|
||||
foreach ($worksheet->Table->Row as $rowData) {
|
||||
$columnIndex = 0;
|
||||
$rowHasData = false;
|
||||
|
||||
foreach($rowData->Cell as $cell) {
|
||||
foreach ($rowData->Cell as $cell) {
|
||||
if (isset($cell->Data)) {
|
||||
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||
$rowHasData = true;
|
||||
@ -241,7 +241,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||
foreach($styleList as $style) {
|
||||
foreach ($styleList as $style) {
|
||||
if ($styleAttributeValue == strtolower($style)) {
|
||||
$styleAttributeValue = $style;
|
||||
return true;
|
||||
@ -336,52 +336,52 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
if (isset($xml->DocumentProperties[0])) {
|
||||
foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
switch ($propertyName) {
|
||||
case 'Title' :
|
||||
$docProps->setTitle(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Subject' :
|
||||
$docProps->setSubject(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Author' :
|
||||
$docProps->setCreator(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Created' :
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
break;
|
||||
case 'LastAuthor' :
|
||||
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'LastSaved' :
|
||||
$lastSaveDate = strtotime($propertyValue);
|
||||
$docProps->setModified($lastSaveDate);
|
||||
break;
|
||||
case 'Company' :
|
||||
$docProps->setCompany(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Category' :
|
||||
$docProps->setCategory(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Manager' :
|
||||
$docProps->setManager(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Keywords' :
|
||||
$docProps->setKeywords(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Description' :
|
||||
$docProps->setDescription(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($xml->CustomDocumentProperties)) {
|
||||
foreach($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
$propertyAttributes = $propertyValue->attributes($namespaces['dt']);
|
||||
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str',$propertyName);
|
||||
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName);
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
|
||||
switch((string) $propertyAttributes) {
|
||||
switch ((string) $propertyAttributes) {
|
||||
case 'string' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
$propertyValue = trim($propertyValue);
|
||||
@ -403,11 +403,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$propertyValue = strtotime(trim($propertyValue));
|
||||
break;
|
||||
}
|
||||
$docProps->setCustomProperty($propertyName,$propertyValue,$propertyType);
|
||||
$docProps->setCustomProperty($propertyName, $propertyValue, $propertyType);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($xml->Styles[0] as $style) {
|
||||
foreach ($xml->Styles[0] as $style) {
|
||||
$style_ss = $style->attributes($namespaces['ss']);
|
||||
$styleID = (string) $style_ss['ID'];
|
||||
// echo 'Style ID = '.$styleID.'<br />';
|
||||
@ -421,17 +421,17 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
// echo $styleType.'<br />';
|
||||
switch ($styleType) {
|
||||
case 'Alignment' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
$styleAttributeValue = (string) $styleAttributeValue;
|
||||
switch ($styleAttributeKey) {
|
||||
case 'Vertical' :
|
||||
if (self::identifyFixedStyleValue($verticalAlignmentStyles,$styleAttributeValue)) {
|
||||
if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
|
||||
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
|
||||
}
|
||||
break;
|
||||
case 'Horizontal' :
|
||||
if (self::identifyFixedStyleValue($horizontalAlignmentStyles,$styleAttributeValue)) {
|
||||
if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
|
||||
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
|
||||
}
|
||||
break;
|
||||
@ -442,10 +442,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Borders' :
|
||||
foreach($styleData->Border as $borderStyle) {
|
||||
foreach ($styleData->Border as $borderStyle) {
|
||||
$borderAttributes = $borderStyle->attributes($namespaces['ss']);
|
||||
$thisBorder = array();
|
||||
foreach($borderAttributes as $borderStyleKey => $borderStyleValue) {
|
||||
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
|
||||
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
|
||||
switch ($borderStyleKey) {
|
||||
case 'LineStyle' :
|
||||
@ -472,7 +472,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Font' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
$styleAttributeValue = (string) $styleAttributeValue;
|
||||
switch ($styleAttributeKey) {
|
||||
@ -492,7 +492,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$this->_styles[$styleID]['font']['italic'] = true;
|
||||
break;
|
||||
case 'Underline' :
|
||||
if (self::identifyFixedStyleValue($underlineStyles,$styleAttributeValue)) {
|
||||
if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
|
||||
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue;
|
||||
}
|
||||
break;
|
||||
@ -500,7 +500,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Interior' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
switch ($styleAttributeKey) {
|
||||
case 'Color' :
|
||||
@ -510,9 +510,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'NumberFormat' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
$styleAttributeValue = str_replace($fromFormats,$toFormats,$styleAttributeValue);
|
||||
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
|
||||
switch ($styleAttributeValue) {
|
||||
case 'Short Date' :
|
||||
$styleAttributeValue = 'dd/mm/yyyy';
|
||||
@ -524,7 +524,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Protection' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
}
|
||||
break;
|
||||
@ -538,7 +538,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$worksheetID = 0;
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
foreach ($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
|
||||
if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
|
||||
@ -546,13 +546,13 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
continue;
|
||||
}
|
||||
|
||||
// echo '<h3>Worksheet: ',$worksheet_ss['Name'],'<h3>';
|
||||
// echo '<h3>Worksheet: ', $worksheet_ss['Name'],'<h3>';
|
||||
//
|
||||
// Create new Worksheet
|
||||
$objPHPExcel->createSheet();
|
||||
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||
if (isset($worksheet_ss['Name'])) {
|
||||
$worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'],$this->_charSet);
|
||||
$worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet);
|
||||
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
|
||||
// formula cells... during the load, all formulae should be correct, and we're simply bringing
|
||||
// the worksheet name in line with the formula, not the reverse
|
||||
@ -561,7 +561,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
$columnID = 'A';
|
||||
if (isset($worksheet->Table->Column)) {
|
||||
foreach($worksheet->Table->Column as $columnData) {
|
||||
foreach ($worksheet->Table->Column as $columnData) {
|
||||
$columnData_ss = $columnData->attributes($namespaces['ss']);
|
||||
if (isset($columnData_ss['Index'])) {
|
||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
|
||||
@ -578,7 +578,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$rowID = 1;
|
||||
if (isset($worksheet->Table->Row)) {
|
||||
$additionalMergedCells = 0;
|
||||
foreach($worksheet->Table->Row as $rowData) {
|
||||
foreach ($worksheet->Table->Row as $rowData) {
|
||||
$rowHasData = false;
|
||||
$row_ss = $rowData->attributes($namespaces['ss']);
|
||||
if (isset($row_ss['Index'])) {
|
||||
@ -587,7 +587,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
// echo '<b>Row '.$rowID.'</b><br />';
|
||||
|
||||
$columnID = 'A';
|
||||
foreach($rowData->Cell as $cell) {
|
||||
foreach ($rowData->Cell as $cell) {
|
||||
|
||||
$cell_ss = $cell->attributes($namespaces['ss']);
|
||||
if (isset($cell_ss['Index'])) {
|
||||
@ -643,7 +643,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
const TYPE_ERROR = 'e';
|
||||
*/
|
||||
case 'String' :
|
||||
$cellValue = self::_convertStringEncoding($cellValue,$this->_charSet);
|
||||
$cellValue = self::_convertStringEncoding($cellValue, $this->_charSet);
|
||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
break;
|
||||
case 'Number' :
|
||||
@ -673,31 +673,31 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
|
||||
if (substr($cellDataFormula,0,3) == 'of:') {
|
||||
$cellDataFormula = substr($cellDataFormula,3);
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
// echo 'Before: ', $cellDataFormula,'<br />';
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
$value = str_replace(array('[.','.',']'),'',$value);
|
||||
$value = str_replace(array('[.','.',']'),'', $value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
// echo 'Before: ', $cellDataFormula,'<br />';
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
// the formula
|
||||
$cellReferences = array_reverse($cellReferences);
|
||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||
// then modify the formula to use that new reference
|
||||
foreach($cellReferences as $cellReference) {
|
||||
foreach ($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $rowID;
|
||||
@ -709,20 +709,20 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]');
|
||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||
$value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0]));
|
||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
// echo 'After: ',$cellDataFormula,'<br />';
|
||||
$cellDataFormula = implode('"', $temp);
|
||||
// echo 'After: ', $cellDataFormula,'<br />';
|
||||
}
|
||||
|
||||
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
|
||||
//
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type);
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type);
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'Formula result is '.$cellValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
|
||||
@ -736,15 +736,15 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$author = 'unknown';
|
||||
if (isset($commentAttributes->Author)) {
|
||||
$author = (string)$commentAttributes->Author;
|
||||
// echo 'Author: ',$author,'<br />';
|
||||
// echo 'Author: ', $author,'<br />';
|
||||
}
|
||||
$node = $cell->Comment->Data->asXML();
|
||||
// $annotation = str_replace('html:','',substr($node,49,-10));
|
||||
// echo $annotation,'<br />';
|
||||
$annotation = strip_tags($node);
|
||||
// echo 'Annotation: ',$annotation,'<br />';
|
||||
// echo 'Annotation: ', $annotation,'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
->setAuthor(self::_convertStringEncoding($author ,$this->_charSet))
|
||||
->setAuthor(self::_convertStringEncoding($author , $this->_charSet))
|
||||
->setText($this->_parseRichText($annotation) );
|
||||
}
|
||||
|
||||
@ -790,9 +790,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
|
||||
|
||||
protected static function _convertStringEncoding($string,$charset) {
|
||||
protected static function _convertStringEncoding($string, $charset) {
|
||||
if ($charset != 'UTF-8') {
|
||||
return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset);
|
||||
return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8', $charset);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
@ -801,7 +801,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
protected function _parseRichText($is = '') {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
$value->createText(self::_convertStringEncoding($is,$this->_charSet));
|
||||
$value->createText(self::_convertStringEncoding($is, $this->_charSet));
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
@ -217,13 +217,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$row = $xml->getAttribute('r');
|
||||
$tmpInfo['totalRows'] = $row;
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$currCells = 0;
|
||||
} elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$currCells++;
|
||||
}
|
||||
}
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$xml->close();
|
||||
|
||||
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
||||
@ -267,7 +267,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
} // function _castToString()
|
||||
|
||||
|
||||
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
|
||||
private function _castToFormula($c, $r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas, $castBaseType) {
|
||||
// echo 'Formula', PHP_EOL;
|
||||
// echo '$c->f is ', $c->f, PHP_EOL;
|
||||
$cellDataType = 'f';
|
||||
@ -381,7 +381,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
|
||||
$themeColours = array();
|
||||
foreach ($colourScheme as $k => $xmlColour) {
|
||||
$themePos = array_search($k,$themeOrderArray);
|
||||
$themePos = array_search($k, $themeOrderArray);
|
||||
if ($themePos === false) {
|
||||
$themePos = $themeOrderAdditional++;
|
||||
}
|
||||
@ -393,7 +393,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$themeColours[$themePos] = $xmlColourData['val'];
|
||||
}
|
||||
}
|
||||
self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName,$colourSchemeName,$themeColours);
|
||||
self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -443,9 +443,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$attributeType = $cellDataOfficeChildren->getName();
|
||||
$attributeValue = (string) $cellDataOfficeChildren->{$attributeType};
|
||||
$attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue,$attributeType);
|
||||
$attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue, $attributeType);
|
||||
$attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType);
|
||||
$docProps->setCustomProperty($propertyName,$attributeValue,$attributeType);
|
||||
$docProps->setCustomProperty($propertyName, $attributeValue, $attributeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -453,7 +453,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
//Ribbon
|
||||
case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility":
|
||||
$customUI = $rel['Target'];
|
||||
if(!is_null($customUI)){
|
||||
if (!is_null($customUI)) {
|
||||
$this->_readRibbon($excel, $customUI, $zip);
|
||||
}
|
||||
break;
|
||||
@ -478,7 +478,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$worksheets = array();
|
||||
$macros = $customUI = NULL;
|
||||
foreach ($relsWorkbook->Relationship as $ele) {
|
||||
switch($ele['Type']){
|
||||
switch ($ele['Type']) {
|
||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
|
||||
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
||||
break;
|
||||
@ -489,14 +489,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($macros)){
|
||||
if (!is_null($macros)) {
|
||||
$macrosCode = $this->_getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin
|
||||
if($macrosCode !== false){
|
||||
if ($macrosCode !== false) {
|
||||
$excel->setMacrosCode($macrosCode);
|
||||
$excel->setHasMacros(true);
|
||||
//short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir
|
||||
$Certificate = $this->_getFromZipArchive($zip, 'xl/vbaProjectSignature.bin');
|
||||
if($Certificate !== false)
|
||||
if ($Certificate !== false)
|
||||
$excel->setMacrosCertificate($Certificate);
|
||||
}
|
||||
}
|
||||
@ -865,7 +865,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$value = self::_castToBool($c);
|
||||
} else {
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
||||
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToBool');
|
||||
if (isset($c->f['t'])) {
|
||||
$att = array();
|
||||
$att = $c->f;
|
||||
@ -885,7 +885,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$value = self::_castToError($c);
|
||||
} else {
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError');
|
||||
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToError');
|
||||
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
|
||||
}
|
||||
|
||||
@ -899,7 +899,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
} else {
|
||||
// echo 'Treat as Formula', PHP_EOL;
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString');
|
||||
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToString');
|
||||
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
|
||||
}
|
||||
|
||||
@ -1207,8 +1207,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) {
|
||||
// Uppercase coordinate
|
||||
$range = strtoupper($dataValidation["sqref"]);
|
||||
$rangeSet = explode(' ',$range);
|
||||
foreach($rangeSet as $range) {
|
||||
$rangeSet = explode(' ', $range);
|
||||
foreach ($rangeSet as $range) {
|
||||
$stRange = $docSheet->shrinkRangeToFit($range);
|
||||
|
||||
// Extract all cell references in $range
|
||||
@ -1307,7 +1307,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
|
||||
// Loop through contents
|
||||
foreach ($commentsFile->commentList->comment as $comment) {
|
||||
if(!empty($comment['authorId']))
|
||||
if (!empty($comment['authorId']))
|
||||
$docSheet->getComment( (string)$comment['ref'] )->setAuthor( $authors[(string)$comment['authorId']] );
|
||||
$docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) );
|
||||
}
|
||||
@ -1526,7 +1526,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
|
||||
}
|
||||
$objDrawing->setWorksheet($docSheet);
|
||||
} elseif(($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
|
||||
} elseif (($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
|
||||
$fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
|
||||
$fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff);
|
||||
$fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
|
||||
@ -1561,7 +1561,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
if (($spos = strpos($extractedRange,'!')) !== false) {
|
||||
$extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos));
|
||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||
} else {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
@ -1611,7 +1611,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
case '_xlnm.Print_Area':
|
||||
$rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma?
|
||||
$newRangeSets = array();
|
||||
foreach($rangeSets as $rangeSet) {
|
||||
foreach ($rangeSets as $rangeSet) {
|
||||
$range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark?
|
||||
$rangeSet = isset($range[1]) ? $range[1] : $range[0];
|
||||
if (strpos($rangeSet, ':') === FALSE) {
|
||||
@ -1619,7 +1619,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
}
|
||||
$newRangeSets[] = str_replace('$', '', $rangeSet);
|
||||
}
|
||||
$docSheet->getPageSetup()->setPrintArea(implode(',',$newRangeSets));
|
||||
$docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1640,7 +1640,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
if (($spos = strpos($extractedRange,'!')) !== false) {
|
||||
$extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos));
|
||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||
} else {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
@ -1731,12 +1731,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
|
||||
|
||||
// echo 'Chart ',$chartEntryRef,'<br />';
|
||||
// echo 'Chart ', $chartEntryRef,'<br />';
|
||||
// var_dump($charts[$chartEntryRef]);
|
||||
//
|
||||
if (isset($charts[$chartEntryRef])) {
|
||||
$chartPositionRef = $charts[$chartEntryRef]['sheet'].'!'.$charts[$chartEntryRef]['id'];
|
||||
// echo 'Position Ref ',$chartPositionRef,'<br />';
|
||||
// echo 'Position Ref ', $chartPositionRef,'<br />';
|
||||
if (isset($chartDetails[$chartPositionRef])) {
|
||||
// var_dump($chartDetails[$chartPositionRef]);
|
||||
|
||||
@ -1767,7 +1767,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (isset($color["rgb"])) {
|
||||
return (string)$color["rgb"];
|
||||
} else if (isset($color["indexed"])) {
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
|
||||
} else if (isset($color["theme"])) {
|
||||
if (self::$_theme !== NULL) {
|
||||
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]);
|
||||
@ -1832,7 +1832,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (isset($style->fill)) {
|
||||
if ($style->fill->gradientFill) {
|
||||
$gradientFill = $style->fill->gradientFill[0];
|
||||
if(!empty($gradientFill["type"])) {
|
||||
if (!empty($gradientFill["type"])) {
|
||||
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
||||
}
|
||||
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
|
||||
@ -1934,7 +1934,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (isset($is->t)) {
|
||||
$value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) );
|
||||
} else {
|
||||
if(is_object($is->r)) {
|
||||
if (is_object($is->r)) {
|
||||
foreach ($is->r as $run) {
|
||||
if (!isset($run->rPr)) {
|
||||
$objText = $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) );
|
||||
|
@ -51,95 +51,95 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _getAttribute()
|
||||
|
||||
|
||||
private static function _readColor($color,$background=false) {
|
||||
private static function _readColor($color, $background=false) {
|
||||
if (isset($color["rgb"])) {
|
||||
return (string)$color["rgb"];
|
||||
} else if (isset($color["indexed"])) {
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function readChart($chartElements,$chartName) {
|
||||
public static function readChart($chartElements, $chartName) {
|
||||
$namespacesChartMeta = $chartElements->getNamespaces(true);
|
||||
$chartElementsC = $chartElements->children($namespacesChartMeta['c']);
|
||||
|
||||
$XaxisLabel = $YaxisLabel = $legend = $title = NULL;
|
||||
$dispBlanksAs = $plotVisOnly = NULL;
|
||||
|
||||
foreach($chartElementsC as $chartElementKey => $chartElement) {
|
||||
foreach ($chartElementsC as $chartElementKey => $chartElement) {
|
||||
switch ($chartElementKey) {
|
||||
case "chart":
|
||||
foreach($chartElement as $chartDetailsKey => $chartDetails) {
|
||||
foreach ($chartElement as $chartDetailsKey => $chartDetails) {
|
||||
$chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
|
||||
switch ($chartDetailsKey) {
|
||||
case "plotArea":
|
||||
$plotAreaLayout = $XaxisLable = $YaxisLable = null;
|
||||
$plotSeries = $plotAttributes = array();
|
||||
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
switch ($chartDetailKey) {
|
||||
case "layout":
|
||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'plotArea');
|
||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea');
|
||||
break;
|
||||
case "catAx":
|
||||
if (isset($chartDetail->title)) {
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
|
||||
}
|
||||
break;
|
||||
case "dateAx":
|
||||
if (isset($chartDetail->title)) {
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
|
||||
}
|
||||
break;
|
||||
case "valAx":
|
||||
if (isset($chartDetail->title)) {
|
||||
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
||||
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
|
||||
}
|
||||
break;
|
||||
case "barChart":
|
||||
case "bar3DChart":
|
||||
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotDirection($barDirection);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "lineChart":
|
||||
case "line3DChart":
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "areaChart":
|
||||
case "area3DChart":
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "doughnutChart":
|
||||
case "pieChart":
|
||||
case "pie3DChart":
|
||||
$explosion = isset($chartDetail->ser->explosion);
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($explosion);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "scatterChart":
|
||||
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($scatterStyle);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "bubbleChart":
|
||||
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($bubbleScale);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "radarChart":
|
||||
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($radarStyle);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
@ -147,13 +147,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
case "surfaceChart":
|
||||
case "surface3DChart":
|
||||
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($wireFrame);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "stockChart":
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotAttributes = self::_readChartAttributes($plotAreaLayout);
|
||||
break;
|
||||
}
|
||||
@ -161,8 +161,8 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
if ($plotAreaLayout == NULL) {
|
||||
$plotAreaLayout = new PHPExcel_Chart_Layout();
|
||||
}
|
||||
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries);
|
||||
self::_setChartAttributes($plotAreaLayout,$plotAttributes);
|
||||
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
|
||||
self::_setChartAttributes($plotAreaLayout, $plotAttributes);
|
||||
break;
|
||||
case "plotVisOnly":
|
||||
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string');
|
||||
@ -171,13 +171,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
|
||||
break;
|
||||
case "title":
|
||||
$title = self::_chartTitle($chartDetails,$namespacesChartMeta,'title');
|
||||
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title');
|
||||
break;
|
||||
case "legend":
|
||||
$legendPos = 'r';
|
||||
$legendLayout = null;
|
||||
$legendOverlay = false;
|
||||
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
switch ($chartDetailKey) {
|
||||
case "legendPos":
|
||||
$legendPos = self::_getAttribute($chartDetail, 'val', 'string');
|
||||
@ -186,7 +186,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
|
||||
break;
|
||||
case "layout":
|
||||
$legendLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'legend');
|
||||
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -196,20 +196,20 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
}
|
||||
}
|
||||
}
|
||||
$chart = new PHPExcel_Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel);
|
||||
$chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
|
||||
|
||||
return $chart;
|
||||
} // function readChart()
|
||||
|
||||
|
||||
private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) {
|
||||
private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) {
|
||||
$caption = array();
|
||||
$titleLayout = null;
|
||||
foreach($titleDetails as $titleDetailKey => $chartDetail) {
|
||||
foreach ($titleDetails as $titleDetailKey => $chartDetail) {
|
||||
switch ($titleDetailKey) {
|
||||
case "tx":
|
||||
$titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']);
|
||||
foreach($titleDetails as $titleKey => $titleDetail) {
|
||||
foreach ($titleDetails as $titleKey => $titleDetail) {
|
||||
switch ($titleKey) {
|
||||
case "p":
|
||||
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
|
||||
@ -218,7 +218,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
}
|
||||
break;
|
||||
case "layout":
|
||||
$titleLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta);
|
||||
$titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _chartTitle()
|
||||
|
||||
|
||||
private static function _chartLayoutDetails($chartDetail,$namespacesChartMeta) {
|
||||
private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) {
|
||||
if (!isset($chartDetail->manualLayout)) {
|
||||
return null;
|
||||
}
|
||||
@ -236,7 +236,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
return null;
|
||||
}
|
||||
$layout = array();
|
||||
foreach($details as $detailKey => $detail) {
|
||||
foreach ($details as $detailKey => $detail) {
|
||||
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
|
||||
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
|
||||
}
|
||||
@ -244,20 +244,20 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _chartLayoutDetails()
|
||||
|
||||
|
||||
private static function _chartDataSeries($chartDetail,$namespacesChartMeta,$plotType) {
|
||||
private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) {
|
||||
$multiSeriesType = NULL;
|
||||
$smoothLine = false;
|
||||
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
|
||||
|
||||
$seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']);
|
||||
foreach($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
|
||||
foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
|
||||
switch ($seriesDetailKey) {
|
||||
case "grouping":
|
||||
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string');
|
||||
break;
|
||||
case "ser":
|
||||
$marker = NULL;
|
||||
foreach($seriesDetails as $seriesKey => $seriesDetail) {
|
||||
foreach ($seriesDetails as $seriesKey => $seriesDetail) {
|
||||
switch ($seriesKey) {
|
||||
case "idx":
|
||||
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer');
|
||||
@ -267,7 +267,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$plotOrder[$seriesIndex] = $seriesOrder;
|
||||
break;
|
||||
case "tx":
|
||||
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
||||
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
|
||||
break;
|
||||
case "marker":
|
||||
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string');
|
||||
@ -276,22 +276,22 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean');
|
||||
break;
|
||||
case "cat":
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
|
||||
break;
|
||||
case "val":
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
|
||||
break;
|
||||
case "xVal":
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
|
||||
break;
|
||||
case "yVal":
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new PHPExcel_Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine);
|
||||
return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
|
||||
} // function _chartDataSeries()
|
||||
|
||||
|
||||
@ -300,35 +300,35 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$seriesSource = (string) $seriesDetail->strRef->f;
|
||||
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s');
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
} elseif (isset($seriesDetail->numRef)) {
|
||||
$seriesSource = (string) $seriesDetail->numRef->f;
|
||||
$seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||
return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
} elseif (isset($seriesDetail->multiLvlStrRef)) {
|
||||
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s');
|
||||
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
} elseif (isset($seriesDetail->multiLvlNumRef)) {
|
||||
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s');
|
||||
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
}
|
||||
return null;
|
||||
} // function _chartDataSeriesValueSet()
|
||||
|
||||
|
||||
private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') {
|
||||
private static function _chartDataSeriesValues($seriesValueSet, $dataType='n') {
|
||||
$seriesVal = array();
|
||||
$formatCode = '';
|
||||
$pointCount = 0;
|
||||
|
||||
foreach($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
||||
foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
||||
switch ($seriesValueIdx) {
|
||||
case 'ptCount':
|
||||
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
||||
@ -358,13 +358,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _chartDataSeriesValues()
|
||||
|
||||
|
||||
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') {
|
||||
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType='n') {
|
||||
$seriesVal = array();
|
||||
$formatCode = '';
|
||||
$pointCount = 0;
|
||||
|
||||
foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
|
||||
foreach($seriesLevel as $seriesValueIdx => $seriesValue) {
|
||||
foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
|
||||
foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
|
||||
switch ($seriesValueIdx) {
|
||||
case 'ptCount':
|
||||
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
||||
@ -393,7 +393,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
private static function _parseRichText($titleDetailPart = null) {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||
if (isset($titleDetailElement->t)) {
|
||||
$objText = $value->createTextRun( (string) $titleDetailElement->t );
|
||||
}
|
||||
@ -426,7 +426,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
if (!is_null($baseline)) {
|
||||
if ($baseline > 0) {
|
||||
$objText->getFont()->setSuperScript(true);
|
||||
} elseif($baseline < 0) {
|
||||
} elseif ($baseline < 0) {
|
||||
$objText->getFont()->setSubScript(true);
|
||||
}
|
||||
}
|
||||
@ -435,7 +435,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
if (!is_null($underscore)) {
|
||||
if ($underscore == 'sng') {
|
||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
||||
} elseif($underscore == 'dbl') {
|
||||
} elseif ($underscore == 'dbl') {
|
||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
|
||||
} else {
|
||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
|
||||
@ -485,10 +485,10 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
return $plotAttributes;
|
||||
}
|
||||
|
||||
private static function _setChartAttributes($plotArea,$plotAttributes)
|
||||
private static function _setChartAttributes($plotArea, $plotAttributes)
|
||||
{
|
||||
foreach($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||
switch($plotAttributeKey) {
|
||||
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||
switch ($plotAttributeKey) {
|
||||
case 'showLegendKey' :
|
||||
$plotArea->setShowLegendKey($plotAttributeValue);
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ class PHPExcel_Reader_Excel2007_Theme
|
||||
* Create a new PHPExcel_Theme
|
||||
*
|
||||
*/
|
||||
public function __construct($themeName,$colourSchemeName,$colourMap)
|
||||
public function __construct($themeName, $colourSchemeName, $colourMap)
|
||||
{
|
||||
// Initialise values
|
||||
$this->_themeName = $themeName;
|
||||
|
@ -676,7 +676,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if (!$this->_readDataOnly) {
|
||||
foreach ($this->_objFonts as $objFont) {
|
||||
if (isset($objFont->colorIndex)) {
|
||||
$color = self::_readColor($objFont->colorIndex,$this->_palette,$this->_version);
|
||||
$color = self::_readColor($objFont->colorIndex, $this->_palette, $this->_version);
|
||||
$objFont->getColor()->setRGB($color['rgb']);
|
||||
}
|
||||
}
|
||||
@ -686,12 +686,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$fill = $objStyle->getFill();
|
||||
|
||||
if (isset($fill->startcolorIndex)) {
|
||||
$startColor = self::_readColor($fill->startcolorIndex,$this->_palette,$this->_version);
|
||||
$startColor = self::_readColor($fill->startcolorIndex, $this->_palette, $this->_version);
|
||||
$fill->getStartColor()->setRGB($startColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($fill->endcolorIndex)) {
|
||||
$endColor = self::_readColor($fill->endcolorIndex,$this->_palette,$this->_version);
|
||||
$endColor = self::_readColor($fill->endcolorIndex, $this->_palette, $this->_version);
|
||||
$fill->getEndColor()->setRGB($endColor['rgb']);
|
||||
}
|
||||
|
||||
@ -703,27 +703,27 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$diagonal = $objStyle->getBorders()->getDiagonal();
|
||||
|
||||
if (isset($top->colorIndex)) {
|
||||
$borderTopColor = self::_readColor($top->colorIndex,$this->_palette,$this->_version);
|
||||
$borderTopColor = self::_readColor($top->colorIndex, $this->_palette, $this->_version);
|
||||
$top->getColor()->setRGB($borderTopColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($right->colorIndex)) {
|
||||
$borderRightColor = self::_readColor($right->colorIndex,$this->_palette,$this->_version);
|
||||
$borderRightColor = self::_readColor($right->colorIndex, $this->_palette, $this->_version);
|
||||
$right->getColor()->setRGB($borderRightColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($bottom->colorIndex)) {
|
||||
$borderBottomColor = self::_readColor($bottom->colorIndex,$this->_palette,$this->_version);
|
||||
$borderBottomColor = self::_readColor($bottom->colorIndex, $this->_palette, $this->_version);
|
||||
$bottom->getColor()->setRGB($borderBottomColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($left->colorIndex)) {
|
||||
$borderLeftColor = self::_readColor($left->colorIndex,$this->_palette,$this->_version);
|
||||
$borderLeftColor = self::_readColor($left->colorIndex, $this->_palette, $this->_version);
|
||||
$left->getColor()->setRGB($borderLeftColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($diagonal->colorIndex)) {
|
||||
$borderDiagonalColor = self::_readColor($diagonal->colorIndex,$this->_palette,$this->_version);
|
||||
$borderDiagonalColor = self::_readColor($diagonal->colorIndex, $this->_palette, $this->_version);
|
||||
$diagonal->getColor()->setRGB($borderDiagonalColor['rgb']);
|
||||
}
|
||||
}
|
||||
@ -863,7 +863,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
|
||||
// treat OBJ records
|
||||
foreach ($this->_objs as $n => $obj) {
|
||||
// echo '<hr /><b>Object</b> reference is ',$n,'<br />';
|
||||
// echo '<hr /><b>Object</b> reference is ', $n,'<br />';
|
||||
// var_dump($obj);
|
||||
// echo '<br />';
|
||||
|
||||
@ -896,7 +896,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
case 0x19:
|
||||
// Note
|
||||
// echo 'Cell Annotation Object<br />';
|
||||
// echo 'Object ID is ',$obj['idObjID'],'<br />';
|
||||
// echo 'Object ID is ', $obj['idObjID'],'<br />';
|
||||
//
|
||||
if (isset($this->_cellNotes[$obj['idObjID']])) {
|
||||
$cellNote = $this->_cellNotes[$obj['idObjID']];
|
||||
@ -969,7 +969,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
|
||||
if (!empty($this->_cellNotes)) {
|
||||
foreach($this->_cellNotes as $note => $noteDetails) {
|
||||
foreach ($this->_cellNotes as $note => $noteDetails) {
|
||||
if (!isset($noteDetails['objTextData'])) {
|
||||
if (isset($this->_textObjects[$note])) {
|
||||
$textObject = $this->_textObjects[$note];
|
||||
@ -978,10 +978,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$noteDetails['objTextData']['text'] = '';
|
||||
}
|
||||
}
|
||||
// echo '<b>Cell annotation ',$note,'</b><br />';
|
||||
// echo '<b>Cell annotation ', $note,'</b><br />';
|
||||
// var_dump($noteDetails);
|
||||
// echo '<br />';
|
||||
$cellAddress = str_replace('$','',$noteDetails['cellRef']);
|
||||
$cellAddress = str_replace('$','', $noteDetails['cellRef']);
|
||||
$this->_phpSheet->getComment( $cellAddress )
|
||||
->setAuthor( $noteDetails['author'] )
|
||||
->setText($this->_parseRichText($noteDetails['objTextData']['text']) );
|
||||
@ -1353,21 +1353,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// offset: 8; size: 16
|
||||
// offset: 24; size: 4; section count
|
||||
$secCount = self::_GetInt4d($this->_documentSummaryInformation, 24);
|
||||
// echo '$secCount = ',$secCount,'<br />';
|
||||
// echo '$secCount = ', $secCount,'<br />';
|
||||
|
||||
// offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
|
||||
// offset: 44; size: 4; first section offset
|
||||
$secOffset = self::_GetInt4d($this->_documentSummaryInformation, 44);
|
||||
// echo '$secOffset = ',$secOffset,'<br />';
|
||||
// echo '$secOffset = ', $secOffset,'<br />';
|
||||
|
||||
// section header
|
||||
// offset: $secOffset; size: 4; section length
|
||||
$secLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset);
|
||||
// echo '$secLength = ',$secLength,'<br />';
|
||||
// echo '$secLength = ', $secLength,'<br />';
|
||||
|
||||
// offset: $secOffset+4; size: 4; property count
|
||||
$countProperties = self::_GetInt4d($this->_documentSummaryInformation, $secOffset+4);
|
||||
// echo '$countProperties = ',$countProperties,'<br />';
|
||||
// echo '$countProperties = ', $countProperties,'<br />';
|
||||
|
||||
// initialize code page (used to resolve string values)
|
||||
$codePage = 'CP1252';
|
||||
@ -1375,17 +1375,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// offset: ($secOffset+8); size: var
|
||||
// loop through property decarations and properties
|
||||
for ($i = 0; $i < $countProperties; ++$i) {
|
||||
// echo 'Property ',$i,'<br />';
|
||||
// echo 'Property ', $i,'<br />';
|
||||
// offset: ($secOffset+8) + (8 * $i); size: 4; property ID
|
||||
$id = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+8) + (8 * $i));
|
||||
// echo 'ID is ',$id,'<br />';
|
||||
// echo 'ID is ', $id,'<br />';
|
||||
|
||||
// Use value of property id as appropriate
|
||||
// offset: 60 + 8 * $i; size: 4; offset from beginning of section (48)
|
||||
$offset = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+12) + (8 * $i));
|
||||
|
||||
$type = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + $offset);
|
||||
// echo 'Type is ',$type,', ';
|
||||
// echo 'Type is ', $type,', ';
|
||||
|
||||
// initialize property value
|
||||
$value = null;
|
||||
@ -1531,9 +1531,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$noteObjID = self::_GetInt2d($recordData, 6);
|
||||
$noteAuthor = self::_readUnicodeStringLong(substr($recordData, 8));
|
||||
$noteAuthor = $noteAuthor['value'];
|
||||
// echo 'Note Address=',$cellAddress,'<br />';
|
||||
// echo 'Note Object ID=',$noteObjID,'<br />';
|
||||
// echo 'Note Author=',$noteAuthor,'<hr />';
|
||||
// echo 'Note Address=', $cellAddress,'<br />';
|
||||
// echo 'Note Object ID=', $noteObjID,'<br />';
|
||||
// echo 'Note Author=', $noteAuthor,'<hr />';
|
||||
//
|
||||
$this->_cellNotes[$noteObjID] = array('cellRef' => $cellAddress,
|
||||
'objectID' => $noteObjID,
|
||||
@ -1549,13 +1549,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$extension = true;
|
||||
$cellAddress = array_pop(array_keys($this->_phpSheet->getComments()));
|
||||
}
|
||||
// echo 'Note Address=',$cellAddress,'<br />';
|
||||
// echo 'Note Address=', $cellAddress,'<br />';
|
||||
|
||||
$cellAddress = str_replace('$','',$cellAddress);
|
||||
$cellAddress = str_replace('$','', $cellAddress);
|
||||
$noteLength = self::_GetInt2d($recordData, 4);
|
||||
$noteText = trim(substr($recordData, 6));
|
||||
// echo 'Note Length=',$noteLength,'<br />';
|
||||
// echo 'Note Text=',$noteText,'<br />';
|
||||
// echo 'Note Length=', $noteLength,'<br />';
|
||||
// echo 'Note Text=', $noteText,'<br />';
|
||||
|
||||
if ($extension) {
|
||||
// Concatenate this extension with the currently set comment for the cell
|
||||
@ -1601,8 +1601,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$text = $this->_getSplicedRecordData();
|
||||
|
||||
$this->_textObjects[$this->textObjRef] = array(
|
||||
'text' => substr($text["recordData"],$text["spliceOffsets"][0]+1,$cchText),
|
||||
'format' => substr($text["recordData"],$text["spliceOffsets"][1],$cbRuns),
|
||||
'text' => substr($text["recordData"], $text["spliceOffsets"][0]+1, $cchText),
|
||||
'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns),
|
||||
'alignment' => $grbitOpts,
|
||||
'rotation' => $rot
|
||||
);
|
||||
@ -4294,7 +4294,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
/**
|
||||
* Read PLV Record(Created by Excel2007 or upper)
|
||||
*/
|
||||
private function _readPageLayoutView(){
|
||||
private function _readPageLayoutView() {
|
||||
$length = self::_GetInt2d($this->_data, $this->_pos + 2);
|
||||
$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);
|
||||
|
||||
@ -4564,7 +4564,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false);
|
||||
$nullOffset = strpos($url, 0x00);
|
||||
if ($nullOffset)
|
||||
$url = substr($url,0,$nullOffset);
|
||||
$url = substr($url,0, $nullOffset);
|
||||
$url .= $hasText ? '#' : '';
|
||||
$offset += $us;
|
||||
break;
|
||||
@ -4858,7 +4858,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
case 0x14:
|
||||
// offset: 16; size: 2; color index for sheet tab
|
||||
$colorIndex = self::_GetInt2d($recordData, 16);
|
||||
$color = self::_readColor($colorIndex,$this->_palette,$this->_version);
|
||||
$color = self::_readColor($colorIndex, $this->_palette, $this->_version);
|
||||
$this->_phpSheet->getTabColor()->setRGB($color['rgb']);
|
||||
break;
|
||||
|
||||
@ -6807,7 +6807,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
* @param array $palette Color palette
|
||||
* @return array RGB color value, example: array('rgb' => 'FF0000')
|
||||
*/
|
||||
private static function _readColor($color,$palette,$version)
|
||||
private static function _readColor($color, $palette, $version)
|
||||
{
|
||||
if ($color <= 0x07 || $color >= 0x40) {
|
||||
// special built-in color
|
||||
|
@ -257,13 +257,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$officeDocXML = $officeXML->{'document-meta'};
|
||||
$officeDocMetaXML = $officeDocXML->meta;
|
||||
|
||||
foreach($officeDocMetaXML as $officePropertyData) {
|
||||
foreach ($officeDocMetaXML as $officePropertyData) {
|
||||
|
||||
$officePropertyDC = array();
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||
}
|
||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
@ -290,7 +290,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
if (isset($namespacesMeta['meta'])) {
|
||||
$officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
|
||||
}
|
||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
$attributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
@ -307,7 +307,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$docProps->setModified($creationDate);
|
||||
break;
|
||||
case 'user-defined' :
|
||||
list(,$attrName) = explode(':',$attributes['name']);
|
||||
list(, $attrName) = explode(':', $attributes['name']);
|
||||
switch ($attrName) {
|
||||
case 'publisher' :
|
||||
$docProps->setCompany(trim($propertyValue));
|
||||
@ -324,7 +324,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
}
|
||||
} elseif (isset($gnmXML->Summary)) {
|
||||
foreach($gnmXML->Summary->Item as $summaryItem) {
|
||||
foreach ($gnmXML->Summary->Item as $summaryItem) {
|
||||
$propertyName = $summaryItem->name;
|
||||
$propertyValue = $summaryItem->{'val-string'};
|
||||
switch ($propertyName) {
|
||||
@ -355,9 +355,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
|
||||
$worksheetID = 0;
|
||||
foreach($gnmXML->Sheets->Sheet as $sheet) {
|
||||
foreach ($gnmXML->Sheets->Sheet as $sheet) {
|
||||
$worksheetName = (string) $sheet->Name;
|
||||
// echo '<b>Worksheet: ',$worksheetName,'</b><br />';
|
||||
// echo '<b>Worksheet: ', $worksheetName,'</b><br />';
|
||||
if ((isset($this->_loadSheetsOnly)) && (!in_array($worksheetName, $this->_loadSheetsOnly))) {
|
||||
continue;
|
||||
}
|
||||
@ -374,15 +374,15 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
|
||||
if (isset($sheet->PrintInformation->Margins)) {
|
||||
foreach($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
|
||||
foreach ($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
|
||||
$marginAttributes = $margin->attributes();
|
||||
$marginSize = 72 / 100; // Default
|
||||
switch($marginAttributes['PrefUnit']) {
|
||||
switch ($marginAttributes['PrefUnit']) {
|
||||
case 'mm' :
|
||||
$marginSize = intval($marginAttributes['Points']) / 100;
|
||||
break;
|
||||
}
|
||||
switch($key) {
|
||||
switch ($key) {
|
||||
case 'top' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
|
||||
break;
|
||||
@ -406,7 +406,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
}
|
||||
|
||||
foreach($sheet->Cells->Cell as $cell) {
|
||||
foreach ($sheet->Cells->Cell as $cell) {
|
||||
$cellAttributes = $cell->attributes();
|
||||
$row = (int) $cellAttributes->Row + 1;
|
||||
$column = (int) $cellAttributes->Col;
|
||||
@ -425,9 +425,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
$ValueType = $cellAttributes->ValueType;
|
||||
$ExprID = (string) $cellAttributes->ExprID;
|
||||
// echo 'Cell ',$column,$row,'<br />';
|
||||
// echo 'Type is ',$ValueType,'<br />';
|
||||
// echo 'Value is ',$cell,'<br />';
|
||||
// echo 'Cell ', $column, $row,'<br />';
|
||||
// echo 'Type is ', $ValueType,'<br />';
|
||||
// echo 'Value is ', $cell,'<br />';
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
if ($ExprID > '') {
|
||||
if (((string) $cell) > '') {
|
||||
@ -436,7 +436,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
'row' => $cellAttributes->Row,
|
||||
'formula' => (string) $cell
|
||||
);
|
||||
// echo 'NEW EXPRESSION ',$ExprID,'<br />';
|
||||
// echo 'NEW EXPRESSION ', $ExprID,'<br />';
|
||||
} else {
|
||||
$expression = $this->_expressions[$ExprID];
|
||||
|
||||
@ -446,12 +446,12 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$cellAttributes->Row - $expression['row'],
|
||||
$worksheetName
|
||||
);
|
||||
// echo 'SHARED EXPRESSION ',$ExprID,'<br />';
|
||||
// echo 'New Value is ',$cell,'<br />';
|
||||
// echo 'SHARED EXPRESSION ', $ExprID,'<br />';
|
||||
// echo 'New Value is ', $cell,'<br />';
|
||||
}
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
} else {
|
||||
switch($ValueType) {
|
||||
switch ($ValueType) {
|
||||
case '10' : // NULL
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
break;
|
||||
@ -474,11 +474,11 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
case '80' : // Array
|
||||
}
|
||||
}
|
||||
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell,$type);
|
||||
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
|
||||
}
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
|
||||
foreach($sheet->Objects->children('gnm',TRUE) as $key => $comment) {
|
||||
foreach ($sheet->Objects->children('gnm',TRUE) as $key => $comment) {
|
||||
$commentAttributes = $comment->attributes();
|
||||
// Only comment objects are handled at the moment
|
||||
if ($commentAttributes->Text) {
|
||||
@ -488,9 +488,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
}
|
||||
}
|
||||
// echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'<br />';
|
||||
// echo '$maxCol=', $maxCol,'; $maxRow=', $maxRow,'<br />';
|
||||
//
|
||||
foreach($sheet->Styles->StyleRegion as $styleRegion) {
|
||||
foreach ($sheet->Styles->StyleRegion as $styleRegion) {
|
||||
$styleAttributes = $styleRegion->attributes();
|
||||
if (($styleAttributes['startRow'] <= $maxRow) &&
|
||||
($styleAttributes['startCol'] <= $maxCol)) {
|
||||
@ -516,7 +516,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
|
||||
// If _readDataOnly is false, we set all formatting information
|
||||
if (!$this->_readDataOnly) {
|
||||
switch($styleAttributes['HAlign']) {
|
||||
switch ($styleAttributes['HAlign']) {
|
||||
case '1' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
break;
|
||||
@ -538,7 +538,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
break;
|
||||
}
|
||||
|
||||
switch($styleAttributes['VAlign']) {
|
||||
switch ($styleAttributes['VAlign']) {
|
||||
case '1' :
|
||||
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
|
||||
break;
|
||||
@ -565,7 +565,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
|
||||
$RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]);
|
||||
$styleArray['fill']['endcolor']['rgb'] = $RGB2;
|
||||
switch($shade) {
|
||||
switch ($shade) {
|
||||
case '1' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
|
||||
break;
|
||||
@ -637,7 +637,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False;
|
||||
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False;
|
||||
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False;
|
||||
switch($fontAttributes['Underline']) {
|
||||
switch ($fontAttributes['Underline']) {
|
||||
case '1' :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
|
||||
break;
|
||||
@ -654,7 +654,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
|
||||
break;
|
||||
}
|
||||
switch($fontAttributes['Script']) {
|
||||
switch ($fontAttributes['Script']) {
|
||||
case '1' :
|
||||
$styleArray['font']['superScript'] = True;
|
||||
break;
|
||||
@ -704,7 +704,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$columnAttributes = $sheet->Cols->attributes();
|
||||
$defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
|
||||
$c = 0;
|
||||
foreach($sheet->Cols->ColInfo as $columnOverride) {
|
||||
foreach ($sheet->Cols->ColInfo as $columnOverride) {
|
||||
$columnAttributes = $columnOverride->attributes();
|
||||
$column = $columnAttributes['No'];
|
||||
$columnWidth = $columnAttributes['Unit'] / 5.4;
|
||||
@ -734,7 +734,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$defaultHeight = $rowAttributes['DefaultSizePts'];
|
||||
$r = 0;
|
||||
|
||||
foreach($sheet->Rows->RowInfo as $rowOverride) {
|
||||
foreach ($sheet->Rows->RowInfo as $rowOverride) {
|
||||
$rowAttributes = $rowOverride->attributes();
|
||||
$row = $rowAttributes['No'];
|
||||
$rowHeight = $rowAttributes['Unit'];
|
||||
@ -760,7 +760,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
// Handle Merged Cells in this worksheet
|
||||
if (isset($sheet->MergedRegions)) {
|
||||
foreach($sheet->MergedRegions->Merge as $mergeCells) {
|
||||
foreach ($sheet->MergedRegions->Merge as $mergeCells) {
|
||||
if (strpos($mergeCells,':') !== FALSE) {
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
|
||||
}
|
||||
@ -772,14 +772,14 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
// Loop through definedNames (global named ranges)
|
||||
if (isset($gnmXML->Names)) {
|
||||
foreach($gnmXML->Names->Name as $namedRange) {
|
||||
foreach ($gnmXML->Names->Name as $namedRange) {
|
||||
$name = (string) $namedRange->name;
|
||||
$range = (string) $namedRange->value;
|
||||
if (stripos($range, '#REF!') !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$range = explode('!',$range);
|
||||
$range = explode('!', $range);
|
||||
$range[0] = trim($range[0],"'");;
|
||||
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
|
||||
$extractedRange = str_replace('$', '', $range[1]);
|
||||
@ -861,12 +861,12 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
|
||||
private static function _parseGnumericColour($gnmColour) {
|
||||
list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour);
|
||||
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
|
||||
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$RGB = $gnmR.$gnmG.$gnmB;
|
||||
// echo 'Excel Colour: ',$RGB,'<br />';
|
||||
// echo 'Excel Colour: ', $RGB,'<br />';
|
||||
return $RGB;
|
||||
}
|
||||
|
||||
|
@ -89,12 +89,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$stat = $zip->statName('mimetype');
|
||||
if ($stat && ($stat['size'] <= 255)) {
|
||||
$mimeType = $zip->getFromName($stat['name']);
|
||||
} elseif($stat = $zip->statName('META-INF/manifest.xml')) {
|
||||
} elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
|
||||
$xml = simplexml_load_string($this->securityScan($zip->getFromName('META-INF/manifest.xml')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$namespacesContent = $xml->getNamespaces(true);
|
||||
if (isset($namespacesContent['manifest'])) {
|
||||
$manifest = $xml->children($namespacesContent['manifest']);
|
||||
foreach($manifest as $manifestDataSet) {
|
||||
foreach ($manifest as $manifestDataSet) {
|
||||
$manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']);
|
||||
if ($manifestAttributes->{'full-path'} == '/') {
|
||||
$mimeType = (string) $manifestAttributes->{'media-type'};
|
||||
@ -222,7 +222,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$rowspan = $xml->getAttribute('table:number-rows-repeated');
|
||||
$rowspan = empty($rowspan) ? 1 : $rowspan;
|
||||
$tmpInfo['totalRows'] += $rowspan;
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$currCells = 0;
|
||||
// Step into the row
|
||||
$xml->read();
|
||||
@ -243,14 +243,14 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
} while ($xml->name != 'table:table');
|
||||
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
||||
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||
$worksheetInfo[] = $tmpInfo;
|
||||
}
|
||||
}
|
||||
|
||||
// foreach($workbookData->table as $worksheetDataSet) {
|
||||
// foreach ($workbookData->table as $worksheetDataSet) {
|
||||
// $worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
||||
// $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
||||
//
|
||||
@ -309,7 +309,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
|
||||
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||
foreach($styleList as $style) {
|
||||
foreach ($styleList as $style) {
|
||||
if ($styleAttributeValue == strtolower($style)) {
|
||||
$styleAttributeValue = $style;
|
||||
return true;
|
||||
@ -353,12 +353,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
$officeProperty = $xml->children($namespacesMeta['office']);
|
||||
foreach($officeProperty as $officePropertyData) {
|
||||
foreach ($officeProperty as $officePropertyData) {
|
||||
$officePropertyDC = array();
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||
}
|
||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
@ -385,7 +385,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
|
||||
}
|
||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
@ -404,7 +404,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
foreach ($propertyValueAttributes as $key => $value) {
|
||||
if ($key == 'name') {
|
||||
$propertyValueName = (string) $value;
|
||||
} elseif($key == 'value-type') {
|
||||
} elseif ($key == 'value-type') {
|
||||
switch ($value) {
|
||||
case 'date' :
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date');
|
||||
@ -423,7 +423,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
}
|
||||
}
|
||||
$docProps->setCustomProperty($propertyValueName,$propertyValue,$propertyValueType);
|
||||
$docProps->setCustomProperty($propertyValueName, $propertyValue, $propertyValueType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -438,10 +438,10 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// echo '</pre><hr />';
|
||||
|
||||
$workbook = $xml->children($namespacesContent['office']);
|
||||
foreach($workbook->body->spreadsheet as $workbookData) {
|
||||
foreach ($workbook->body->spreadsheet as $workbookData) {
|
||||
$workbookData = $workbookData->children($namespacesContent['table']);
|
||||
$worksheetID = 0;
|
||||
foreach($workbookData->table as $worksheetDataSet) {
|
||||
foreach ($workbookData->table as $worksheetDataSet) {
|
||||
$worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
||||
// print_r($worksheetData);
|
||||
// echo '<br />';
|
||||
@ -466,7 +466,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
|
||||
$rowID = 1;
|
||||
foreach($worksheetData as $key => $rowData) {
|
||||
foreach ($worksheetData as $key => $rowData) {
|
||||
// echo '<b>'.$key.'</b><br />';
|
||||
switch ($key) {
|
||||
case 'table-header-rows':
|
||||
@ -479,7 +479,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ?
|
||||
$rowDataTableAttributes['number-rows-repeated'] : 1;
|
||||
$columnID = 'A';
|
||||
foreach($rowData as $key => $cellData) {
|
||||
foreach ($rowData as $key => $cellData) {
|
||||
if ($this->getReadFilter() !== NULL) {
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
continue;
|
||||
@ -514,16 +514,16 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// echo 'Cell has comment<br />';
|
||||
$annotationText = $cellDataOffice->annotation->children($namespacesContent['text']);
|
||||
$textArray = array();
|
||||
foreach($annotationText as $t) {
|
||||
foreach ($annotationText as $t) {
|
||||
if (isset($t->span)) {
|
||||
foreach($t->span as $text) {
|
||||
foreach ($t->span as $text) {
|
||||
$textArray[] = (string)$text;
|
||||
}
|
||||
} else {
|
||||
$textArray[] = (string) $t;
|
||||
}
|
||||
}
|
||||
$text = implode("\n",$textArray);
|
||||
$text = implode("\n", $textArray);
|
||||
// echo $text,'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
// ->setAuthor( $author )
|
||||
@ -596,8 +596,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
|
||||
$dateObj->setTimeZone($timezoneObj);
|
||||
list($year,$month,$day,$hour,$minute,$second) = explode(' ',$dateObj->format('Y m d H i s'));
|
||||
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second);
|
||||
list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
|
||||
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
|
||||
if ($dataValue != floor($dataValue)) {
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
||||
} else {
|
||||
@ -623,21 +623,21 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
|
||||
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$tKey = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($tKey = !$tKey) {
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3',$value); // Cell range reference in another sheet
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2',$value); // Cell reference in another sheet
|
||||
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2',$value); // Cell range reference
|
||||
$value = preg_replace('/\[\.([^\.]+)\]/Ui','$1',$value); // Simple cell reference
|
||||
$value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces);
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3', $value); // Cell range reference in another sheet
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2', $value); // Cell reference in another sheet
|
||||
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2', $value); // Cell range reference
|
||||
$value = preg_replace('/\[\.([^\.]+)\]/Ui','$1', $value); // Simple cell reference
|
||||
$value = PHPExcel_Calculation::_translateSeparator(';',',', $value, $inBraces);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
$cellDataFormula = implode('"', $temp);
|
||||
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
|
||||
}
|
||||
|
||||
@ -651,7 +651,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) {
|
||||
for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) {
|
||||
$rID = $rowID + $rowAdjust;
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type);
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'Forumla result is '.$dataValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
|
||||
|
@ -167,8 +167,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
$dataType = array_shift($rowData);
|
||||
if ($dataType == 'C') {
|
||||
// Read cell value data
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' :
|
||||
$columnIndex = substr($rowDatum,1) - 1;
|
||||
@ -256,9 +256,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
// Read shared styles
|
||||
if ($dataType == 'P') {
|
||||
$formatArray = array();
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats,$toFormats,substr($rowDatum,1));
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1));
|
||||
break;
|
||||
case 'E' :
|
||||
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
|
||||
@ -290,8 +290,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
} elseif ($dataType == 'C') {
|
||||
$hasCalculatedValue = false;
|
||||
$cellData = $cellDataFormula = '';
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
break;
|
||||
@ -302,19 +302,19 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
break;
|
||||
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only count/replace in alternate array entries
|
||||
if ($key = !$key) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
// the formula
|
||||
$cellReferences = array_reverse($cellReferences);
|
||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||
// then modify the formula to use that new reference
|
||||
foreach($cellReferences as $cellReference) {
|
||||
foreach ($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $row;
|
||||
@ -327,13 +327,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
|
||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||
|
||||
$value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0]));
|
||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
$cellDataFormula = implode('"', $temp);
|
||||
$hasCalculatedValue = true;
|
||||
break;
|
||||
}
|
||||
@ -351,8 +351,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
} elseif ($dataType == 'F') {
|
||||
$formatStyle = $columnWidth = $styleSettings = '';
|
||||
$styleData = array();
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
break;
|
||||
@ -361,7 +361,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
break;
|
||||
case 'P' : $formatStyle = $rowDatum;
|
||||
break;
|
||||
case 'W' : list($startCol,$endCol,$columnWidth) = explode(' ',substr($rowDatum,1));
|
||||
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1));
|
||||
break;
|
||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||
@ -407,8 +407,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
break;
|
||||
|
@ -416,7 +416,7 @@ class PHPExcel_ReferenceHelper
|
||||
}
|
||||
|
||||
// Loop through cells, bottom-up, and change cell coordinates
|
||||
if($remove) {
|
||||
if ($remove) {
|
||||
// It's faster to reverse and pop than to use unshift, especially with large cell collections
|
||||
$aCellCollection = array_reverse($aCellCollection);
|
||||
}
|
||||
@ -548,7 +548,7 @@ class PHPExcel_ReferenceHelper
|
||||
if (count($autoFilterColumns) > 0) {
|
||||
sscanf($pBefore,'%[A-Z]%d', $column, $row);
|
||||
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||
if ($columnIndex <= $rangeEnd[0]) {
|
||||
if ($pNumCols < 0) {
|
||||
// If we're actually deleting any columns that fall within the autofilter range,
|
||||
@ -556,7 +556,7 @@ class PHPExcel_ReferenceHelper
|
||||
$deleteColumn = $columnIndex + $pNumCols - 1;
|
||||
$deleteCount = abs($pNumCols);
|
||||
for ($i = 1; $i <= $deleteCount; ++$i) {
|
||||
if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn),$autoFilterColumns)) {
|
||||
if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn), $autoFilterColumns)) {
|
||||
$autoFilter->clearColumn(PHPExcel_Cell::stringFromColumnIndex($deleteColumn));
|
||||
}
|
||||
++$deleteColumn;
|
||||
@ -586,7 +586,7 @@ class PHPExcel_ReferenceHelper
|
||||
$toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1);
|
||||
$endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]);
|
||||
do {
|
||||
$autoFilter->shiftColumn($startColID,$toColID);
|
||||
$autoFilter->shiftColumn($startColID, $toColID);
|
||||
++$startColID;
|
||||
++$toColID;
|
||||
} while ($startColID != $endColID);
|
||||
@ -644,9 +644,9 @@ class PHPExcel_ReferenceHelper
|
||||
*/
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
||||
// Update cell references in the formula
|
||||
$formulaBlocks = explode('"',$pFormula);
|
||||
$formulaBlocks = explode('"', $pFormula);
|
||||
$i = false;
|
||||
foreach($formulaBlocks as &$formulaBlock) {
|
||||
foreach ($formulaBlocks as &$formulaBlock) {
|
||||
// Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode)
|
||||
if ($i = !$i) {
|
||||
$adjustCount = 0;
|
||||
@ -654,11 +654,11 @@ class PHPExcel_ReferenceHelper
|
||||
// Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = substr($this->updateCellReference('$A'.$match[3],$pBefore,$pNumCols,$pNumRows),2);
|
||||
$modified4 = substr($this->updateCellReference('$A'.$match[4],$pBefore,$pNumCols,$pNumRows),2);
|
||||
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows),2);
|
||||
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows),2);
|
||||
|
||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
@ -679,11 +679,11 @@ class PHPExcel_ReferenceHelper
|
||||
// Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = substr($this->updateCellReference($match[3].'$1',$pBefore,$pNumCols,$pNumRows),0,-2);
|
||||
$modified4 = substr($this->updateCellReference($match[4].'$1',$pBefore,$pNumCols,$pNumRows),0,-2);
|
||||
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
||||
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
||||
|
||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
@ -704,17 +704,17 @@ class PHPExcel_ReferenceHelper
|
||||
// Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||
$modified4 = $this->updateCellReference($match[4],$pBefore,$pNumCols,$pNumRows);
|
||||
$modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
|
||||
$modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows);
|
||||
|
||||
if ($match[3].$match[4] !== $modified3.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$toString .= $modified3.':'.$modified4;
|
||||
list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
|
||||
$row = trim($row,'$') + 10000000;
|
||||
@ -731,16 +731,16 @@ class PHPExcel_ReferenceHelper
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3];
|
||||
|
||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||
$modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
|
||||
if ($match[3] !== $modified3) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$toString .= $modified3;
|
||||
list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
|
||||
$row = trim($row,'$') + 10000000;
|
||||
@ -761,14 +761,14 @@ class PHPExcel_ReferenceHelper
|
||||
ksort($cellTokens);
|
||||
ksort($newCellTokens);
|
||||
} // Update cell references in the formula
|
||||
$formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock));
|
||||
$formulaBlock = str_replace('\\','',preg_replace($cellTokens, $newCellTokens, $formulaBlock));
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($formulaBlock);
|
||||
|
||||
// Then rebuild the formula string
|
||||
return implode('"',$formulaBlocks);
|
||||
return implode('"', $formulaBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -846,7 +846,7 @@ class PHPExcel_ReferenceHelper
|
||||
if (ctype_alpha($range[$i][$j])) {
|
||||
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
|
||||
$range[$i][$j] = $r[0];
|
||||
} elseif(ctype_digit($range[$i][$j])) {
|
||||
} elseif (ctype_digit($range[$i][$j])) {
|
||||
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
|
||||
$range[$i][$j] = $r[1];
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@ class PHPExcel_Shared_Date
|
||||
$seconds = round($time) - ($hours * 3600) - ($minutes * 60);
|
||||
|
||||
$dateObj = date_create('1-Jan-1970+'.$days.' days');
|
||||
$dateObj->setTime($hours,$minutes,$seconds);
|
||||
$dateObj->setTime($hours, $minutes, $seconds);
|
||||
|
||||
return $dateObj;
|
||||
}
|
||||
@ -188,8 +188,8 @@ class PHPExcel_Shared_Date
|
||||
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
||||
);
|
||||
} elseif (is_numeric($dateValue)) {
|
||||
$retValue = self::FormattedPHPToExcel( date('Y',$dateValue), date('m',$dateValue), date('d',$dateValue),
|
||||
date('H',$dateValue), date('i',$dateValue), date('s',$dateValue)
|
||||
$retValue = self::FormattedPHPToExcel( date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue),
|
||||
date('H', $dateValue), date('i', $dateValue), date('s', $dateValue)
|
||||
);
|
||||
}
|
||||
date_default_timezone_set($saveTimeZone);
|
||||
@ -327,7 +327,7 @@ class PHPExcel_Shared_Date
|
||||
// we don't want to test for any of our characters within the quoted blocks
|
||||
if (strpos($pFormatCode, '"') !== false) {
|
||||
$segMatcher = false;
|
||||
foreach(explode('"', $pFormatCode) as $subVal) {
|
||||
foreach (explode('"', $pFormatCode) as $subVal) {
|
||||
// Only test in alternate array entries (the non-quoted blocks)
|
||||
if (($segMatcher = !$segMatcher) &&
|
||||
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i', $subVal))) {
|
||||
@ -376,7 +376,7 @@ class PHPExcel_Shared_Date
|
||||
public static function monthStringToNumber($month)
|
||||
{
|
||||
$monthIndex = 1;
|
||||
foreach(self::$monthNames as $shortMonthName => $longMonthName) {
|
||||
foreach (self::$monthNames as $shortMonthName => $longMonthName) {
|
||||
if (($month === $longMonthName) || ($month === $shortMonthName)) {
|
||||
return $monthIndex;
|
||||
}
|
||||
|
@ -181,10 +181,10 @@ class PHPExcel_Shared_Drawing
|
||||
// Load the image into a string
|
||||
$file = fopen($p_sFile,"rb");
|
||||
$read = fread($file,10);
|
||||
while(!feof($file)&&($read<>""))
|
||||
while (!feof($file)&&($read<>""))
|
||||
$read .= fread($file,1024);
|
||||
|
||||
$temp = unpack("H*",$read);
|
||||
$temp = unpack("H*", $read);
|
||||
$hex = $temp[1];
|
||||
$header = substr($hex,0,108);
|
||||
|
||||
@ -210,7 +210,7 @@ class PHPExcel_Shared_Drawing
|
||||
$y = 1;
|
||||
|
||||
// Create newimage
|
||||
$image = imagecreatetruecolor($width,$height);
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
|
||||
// Grab the body from the image
|
||||
$body = substr($hex,108);
|
||||
@ -255,8 +255,8 @@ class PHPExcel_Shared_Drawing
|
||||
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
|
||||
|
||||
// Calculate and draw the pixel
|
||||
$color = imagecolorallocate($image,$r,$g,$b);
|
||||
imagesetpixel($image,$x,$height-$y,$color);
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
imagesetpixel($image, $x, $height-$y, $color);
|
||||
|
||||
// Raise the horizontal position
|
||||
$x++;
|
||||
|
@ -111,7 +111,7 @@ class PHPExcel_Shared_File
|
||||
// Found something?
|
||||
if ($returnValue == '' || ($returnValue === NULL)) {
|
||||
$pathArray = explode('/' , $pFilename);
|
||||
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||
for ($i = 0; $i < count($pathArray); ++$i) {
|
||||
if ($pathArray[$i] == '..' && $i > 0) {
|
||||
unset($pathArray[$i]);
|
||||
|
@ -763,7 +763,7 @@ class EigenvalueDecomposition {
|
||||
for ($j = $nn-1; $j >= $low; --$j) {
|
||||
for ($i = $low; $i <= $high; ++$i) {
|
||||
$z = 0.0;
|
||||
for ($k = $low; $k <= min($j,$high); ++$k) {
|
||||
for ($k = $low; $k <= min($j, $high); ++$k) {
|
||||
$z = $z + $this->V[$i][$k] * $this->H[$k][$j];
|
||||
}
|
||||
$this->V[$i][$j] = $z;
|
||||
|
@ -82,7 +82,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
$LUrowi = $this->LU[$i];
|
||||
// Most of the time is spent in the following dot product.
|
||||
$kmax = min($i,$j);
|
||||
$kmax = min($i, $j);
|
||||
$s = 0.0;
|
||||
for ($k = 0; $k < $kmax; ++$k) {
|
||||
$s += $LUrowi[$k] * $LUcolj[$k];
|
||||
|
@ -68,7 +68,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
//Rectangular matrix - m x n initialized from 2D array
|
||||
case 'array':
|
||||
$this->m = count($args[0]);
|
||||
@ -173,7 +173,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
//A($i0...; $j0...)
|
||||
case 'integer,integer':
|
||||
list($i0, $j0) = $args;
|
||||
@ -426,7 +426,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -462,7 +462,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -512,7 +512,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -548,7 +548,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -599,7 +599,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -636,7 +636,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -687,7 +687,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -743,7 +743,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -780,7 +780,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -817,7 +817,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -853,7 +853,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
if ($this->n == $B->m) {
|
||||
@ -944,7 +944,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -969,7 +969,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
$this->A[$i][$j] = pow($this->A[$i][$j],$value);
|
||||
$this->A[$i][$j] = pow($this->A[$i][$j], $value);
|
||||
} else {
|
||||
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
@ -994,7 +994,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
case 'array':
|
||||
|
@ -52,7 +52,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
|
||||
* @return Structure to access R and the Householder vectors and compute Q.
|
||||
*/
|
||||
public function __construct($A) {
|
||||
if($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||
// Initialize.
|
||||
$this->QR = $A->getArrayCopy();
|
||||
$this->m = $A->getRowDimension();
|
||||
@ -175,7 +175,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
|
||||
/*
|
||||
for($i = 0; $i < count($Q); ++$i) {
|
||||
for($j = 0; $j < count($Q); ++$j) {
|
||||
if(! isset($Q[$i][$j]) ) {
|
||||
if (! isset($Q[$i][$j]) ) {
|
||||
$Q[$i][$j] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class SingularValueDecomposition {
|
||||
|
||||
// Reduce A to bidiagonal form, storing the diagonal elements
|
||||
// in s and the super-diagonal elements in e.
|
||||
for ($k = 0; $k < max($nct,$nrt); ++$k) {
|
||||
for ($k = 0; $k < max($nct, $nrt); ++$k) {
|
||||
|
||||
if ($k < $nct) {
|
||||
// Compute the transformation for the k-th column and
|
||||
@ -291,7 +291,7 @@ class SingularValueDecomposition {
|
||||
$f = $e[$p-2];
|
||||
$e[$p-2] = 0.0;
|
||||
for ($j = $p - 2; $j >= $k; --$j) {
|
||||
$t = hypo($this->s[$j],$f);
|
||||
$t = hypo($this->s[$j], $f);
|
||||
$cs = $this->s[$j] / $t;
|
||||
$sn = $f / $t;
|
||||
$this->s[$j] = $t;
|
||||
@ -353,7 +353,7 @@ class SingularValueDecomposition {
|
||||
$g = $sk * $ek;
|
||||
// Chase zeros.
|
||||
for ($j = $k; $j < $p-1; ++$j) {
|
||||
$t = hypo($f,$g);
|
||||
$t = hypo($f, $g);
|
||||
$cs = $f/$t;
|
||||
$sn = $g/$t;
|
||||
if ($j != $k) {
|
||||
@ -370,7 +370,7 @@ class SingularValueDecomposition {
|
||||
$this->V[$i][$j] = $t;
|
||||
}
|
||||
}
|
||||
$t = hypo($f,$g);
|
||||
$t = hypo($f, $g);
|
||||
$cs = $f/$t;
|
||||
$sn = $g/$t;
|
||||
$this->s[$j] = $t;
|
||||
|
@ -473,8 +473,8 @@ class PHPExcel_Shared_OLE
|
||||
// days from 1-1-1601 until the beggining of UNIX era
|
||||
$days = 134774;
|
||||
// calculate seconds
|
||||
$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
|
||||
date("m",$date),date("d",$date),date("Y",$date));
|
||||
$big_date = $days*24*3600 + gmmktime(date("H", $date),date("i", $date),date("s", $date),
|
||||
date("m", $date),date("d", $date),date("Y", $date));
|
||||
// multiply just to make MS happy
|
||||
$big_date *= 10000000;
|
||||
|
||||
|
@ -204,7 +204,7 @@ class PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
if ( !is_array($to_save) || (empty($to_save)) ) {
|
||||
return 0xFFFFFFFF;
|
||||
} elseif( count($to_save) == 1 ) {
|
||||
} elseif ( count($to_save) == 1 ) {
|
||||
$cnt = count($raList);
|
||||
// If the first entry, it's the root... Don't clone it!
|
||||
$raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
|
||||
|
@ -271,7 +271,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
//if (isset($raList[$i]->_PPS_FILE)) {
|
||||
// $iLen = 0;
|
||||
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
|
||||
// while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
||||
// while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
||||
// $iLen += strlen($sBuff);
|
||||
// fwrite($FILE, $sBuff);
|
||||
// }
|
||||
@ -337,7 +337,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
$sRes .= $raList[$i]->_data;
|
||||
//}
|
||||
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
|
||||
$sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
||||
$sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
||||
}
|
||||
// Set for PPS
|
||||
$raList[$i]->_StartBlock = $iSmBlk;
|
||||
|
@ -76,7 +76,7 @@ class PHPExcel_Shared_OLERead {
|
||||
public function read($sFileName)
|
||||
{
|
||||
// Check if file exists and is readable
|
||||
if(!is_readable($sFileName)) {
|
||||
if (!is_readable($sFileName)) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ class PHPExcel_Shared_OLERead {
|
||||
|
||||
$size = self::_GetInt4d($d, self::SIZE_POS);
|
||||
|
||||
$name = str_replace("\x00", "", substr($d,0,$nameSize));
|
||||
$name = str_replace("\x00", "", substr($d,0, $nameSize));
|
||||
|
||||
|
||||
$this->props[] = array (
|
||||
|
@ -1837,13 +1837,13 @@
|
||||
$v_memory_limit = trim($v_memory_limit);
|
||||
$last = strtolower(substr($v_memory_limit, -1));
|
||||
|
||||
if($last == 'g')
|
||||
if ($last == 'g')
|
||||
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
|
||||
$v_memory_limit = $v_memory_limit*1073741824;
|
||||
if($last == 'm')
|
||||
if ($last == 'm')
|
||||
//$v_memory_limit = $v_memory_limit*1024*1024;
|
||||
$v_memory_limit = $v_memory_limit*1048576;
|
||||
if($last == 'k')
|
||||
if ($last == 'k')
|
||||
$v_memory_limit = $v_memory_limit*1024;
|
||||
|
||||
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
|
||||
@ -2412,7 +2412,7 @@
|
||||
$v_offset = @ftell($this->zip_fd);
|
||||
|
||||
// ----- Create the Central Dir files header
|
||||
for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
|
||||
for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
|
||||
{
|
||||
// ----- Create the file header
|
||||
if ($v_header_list[$i]['status'] == 'ok') {
|
||||
|
@ -330,10 +330,10 @@ class PHPExcel_Shared_String
|
||||
}
|
||||
|
||||
public static function buildCharacterSets() {
|
||||
if(empty(self::$_controlCharacters)) {
|
||||
if (empty(self::$_controlCharacters)) {
|
||||
self::_buildControlCharacters();
|
||||
}
|
||||
if(empty(self::$_SYLKCharacters)) {
|
||||
if (empty(self::$_SYLKCharacters)) {
|
||||
self::_buildSYLKCharacters();
|
||||
}
|
||||
}
|
||||
@ -436,19 +436,18 @@ class PHPExcel_Shared_String
|
||||
// character count
|
||||
$ln = self::CountCharacters($value, 'UTF-8');
|
||||
// option flags
|
||||
if(empty($arrcRuns)){
|
||||
if (empty($arrcRuns)) {
|
||||
$opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
|
||||
0x0001 : 0x0000;
|
||||
$data = pack('CC', $ln, $opt);
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$data = pack('vC', $ln, 0x09);
|
||||
$data .= pack('v', count($arrcRuns));
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
foreach ($arrcRuns as $cRun){
|
||||
foreach ($arrcRuns as $cRun) {
|
||||
$data .= pack('v', $cRun['strlen']);
|
||||
$data .= pack('v', $cRun['fontidx']);
|
||||
}
|
||||
@ -500,9 +499,9 @@ class PHPExcel_Shared_String
|
||||
return mb_convert_encoding($value, $to, $from);
|
||||
}
|
||||
|
||||
if($from == 'UTF-16LE'){
|
||||
if ($from == 'UTF-16LE') {
|
||||
return self::utf16_decode($value, false);
|
||||
}else if($from == 'UTF-16BE'){
|
||||
} else if ($from == 'UTF-16BE') {
|
||||
return self::utf16_decode($value);
|
||||
}
|
||||
// else, no conversion
|
||||
@ -525,15 +524,15 @@ class PHPExcel_Shared_String
|
||||
* @author vadik56
|
||||
*/
|
||||
public static function utf16_decode($str, $bom_be = TRUE) {
|
||||
if( strlen($str) < 2 ) return $str;
|
||||
if ( strlen($str) < 2 ) return $str;
|
||||
$c0 = ord($str{0});
|
||||
$c1 = ord($str{1});
|
||||
if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
|
||||
elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
|
||||
if ( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
|
||||
elseif ( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
|
||||
$len = strlen($str);
|
||||
$newstr = '';
|
||||
for($i=0;$i<$len;$i+=2) {
|
||||
if( $bom_be ) { $val = ord($str{$i}) << 4; $val += ord($str{$i+1}); }
|
||||
if ( $bom_be ) { $val = ord($str{$i}) << 4; $val += ord($str{$i+1}); }
|
||||
else { $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
|
||||
$newstr .= ($val == 0x228) ? "\n" : chr($val);
|
||||
}
|
||||
@ -649,8 +648,8 @@ class PHPExcel_Shared_String
|
||||
{
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
$characters = self::mb_str_split($pValue);
|
||||
foreach($characters as &$character) {
|
||||
if(self::mb_is_upper($character)) {
|
||||
foreach ($characters as &$character) {
|
||||
if (self::mb_is_upper($character)) {
|
||||
$character = mb_strtolower($character, 'UTF-8');
|
||||
} else {
|
||||
$character = mb_strtoupper($character, 'UTF-8');
|
||||
|
@ -129,7 +129,7 @@ class PHPExcel_Shared_TimeZone
|
||||
|
||||
$objTimezone = new DateTimeZone($timezone);
|
||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||
$transitions = $objTimezone->getTransitions($timestamp,$timestamp);
|
||||
$transitions = $objTimezone->getTransitions($timestamp, $timestamp);
|
||||
} else {
|
||||
$transitions = self::_getTimezoneTransitions($objTimezone, $timestamp);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||
public function writeRawData($text)
|
||||
{
|
||||
if (is_array($text)) {
|
||||
$text = implode("\n",$text);
|
||||
$text = implode("\n", $text);
|
||||
}
|
||||
|
||||
if (method_exists($this, 'writeRaw')) {
|
||||
|
@ -174,7 +174,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getSlope($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_slope,$dp);
|
||||
return round($this->_slope, $dp);
|
||||
}
|
||||
return $this->_slope;
|
||||
} // function getSlope()
|
||||
@ -188,7 +188,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getSlopeSE($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_slopeSE,$dp);
|
||||
return round($this->_slopeSE, $dp);
|
||||
}
|
||||
return $this->_slopeSE;
|
||||
} // function getSlopeSE()
|
||||
@ -202,7 +202,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getIntersect($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_intersect,$dp);
|
||||
return round($this->_intersect, $dp);
|
||||
}
|
||||
return $this->_intersect;
|
||||
} // function getIntersect()
|
||||
@ -216,7 +216,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getIntersectSE($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_intersectSE,$dp);
|
||||
return round($this->_intersectSE, $dp);
|
||||
}
|
||||
return $this->_intersectSE;
|
||||
} // function getIntersectSE()
|
||||
@ -230,7 +230,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getGoodnessOfFit($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_goodnessOfFit,$dp);
|
||||
return round($this->_goodnessOfFit, $dp);
|
||||
}
|
||||
return $this->_goodnessOfFit;
|
||||
} // function getGoodnessOfFit()
|
||||
@ -238,7 +238,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getGoodnessOfFitPercent($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_goodnessOfFit * 100,$dp);
|
||||
return round($this->_goodnessOfFit * 100, $dp);
|
||||
}
|
||||
return $this->_goodnessOfFit * 100;
|
||||
} // function getGoodnessOfFitPercent()
|
||||
@ -252,7 +252,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getStdevOfResiduals($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_stdevOfResiduals,$dp);
|
||||
return round($this->_stdevOfResiduals, $dp);
|
||||
}
|
||||
return $this->_stdevOfResiduals;
|
||||
} // function getStdevOfResiduals()
|
||||
@ -260,7 +260,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getSSRegression($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_SSRegression,$dp);
|
||||
return round($this->_SSRegression, $dp);
|
||||
}
|
||||
return $this->_SSRegression;
|
||||
} // function getSSRegression()
|
||||
@ -268,7 +268,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getSSResiduals($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_SSResiduals,$dp);
|
||||
return round($this->_SSResiduals, $dp);
|
||||
}
|
||||
return $this->_SSResiduals;
|
||||
} // function getSSResiduals()
|
||||
@ -276,7 +276,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getDFResiduals($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_DFResiduals,$dp);
|
||||
return round($this->_DFResiduals, $dp);
|
||||
}
|
||||
return $this->_DFResiduals;
|
||||
} // function getDFResiduals()
|
||||
@ -284,7 +284,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getF($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_F,$dp);
|
||||
return round($this->_F, $dp);
|
||||
}
|
||||
return $this->_F;
|
||||
} // function getF()
|
||||
@ -292,7 +292,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getCovariance($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_covariance,$dp);
|
||||
return round($this->_covariance, $dp);
|
||||
}
|
||||
return $this->_covariance;
|
||||
} // function getCovariance()
|
||||
@ -300,7 +300,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getCorrelation($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_correlation,$dp);
|
||||
return round($this->_correlation, $dp);
|
||||
}
|
||||
return $this->_correlation;
|
||||
} // function getCorrelation()
|
||||
@ -311,9 +311,9 @@ class PHPExcel_Best_Fit
|
||||
} // function getYBestFitValues()
|
||||
|
||||
|
||||
protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) {
|
||||
protected function _calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) {
|
||||
$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
|
||||
foreach($this->_xValues as $xKey => $xValue) {
|
||||
foreach ($this->_xValues as $xKey => $xValue) {
|
||||
$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||
|
||||
$SSres += ($this->_yValues[$xKey] - $bestFitY) * ($this->_yValues[$xKey] - $bestFitY);
|
||||
@ -398,7 +398,7 @@ class PHPExcel_Best_Fit
|
||||
$this->_intersect = 0;
|
||||
}
|
||||
|
||||
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum,$meanX,$meanY,$const);
|
||||
$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const);
|
||||
} // function _leastSquareFit()
|
||||
|
||||
|
||||
@ -416,7 +416,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
// Define X Values if necessary
|
||||
if ($nX == 0) {
|
||||
$xValues = range(1,$nY);
|
||||
$xValues = range(1, $nY);
|
||||
$nX = $nY;
|
||||
} elseif ($nY != $nX) {
|
||||
// Ensure both arrays of points are the same size
|
||||
|
@ -91,7 +91,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
**/
|
||||
public function getSlope($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round(exp($this->_slope),$dp);
|
||||
return round(exp($this->_slope), $dp);
|
||||
}
|
||||
return exp($this->_slope);
|
||||
} // function getSlope()
|
||||
@ -105,7 +105,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
**/
|
||||
public function getIntersect($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round(exp($this->_intersect),$dp);
|
||||
return round(exp($this->_intersect), $dp);
|
||||
}
|
||||
return exp($this->_intersect);
|
||||
} // function getIntersect()
|
||||
@ -119,7 +119,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _exponential_regression($yValues, $xValues, $const) {
|
||||
foreach($yValues as &$value) {
|
||||
foreach ($yValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
|
@ -91,7 +91,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _linear_regression($yValues, $xValues, $const) {
|
||||
$this->_leastSquareFit($yValues, $xValues,$const);
|
||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||
} // function _linear_regression()
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _logarithmic_regression($yValues, $xValues, $const) {
|
||||
foreach($xValues as &$value) {
|
||||
foreach ($xValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
|
@ -75,7 +75,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
public function getValueOfYForX($xValue) {
|
||||
$retVal = $this->getIntersect();
|
||||
$slope = $this->getSlope();
|
||||
foreach($slope as $key => $value) {
|
||||
foreach ($slope as $key => $value) {
|
||||
if ($value != 0.0) {
|
||||
$retVal += $value * pow($xValue, $key + 1);
|
||||
}
|
||||
@ -106,7 +106,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
$intersect = $this->getIntersect($dp);
|
||||
|
||||
$equation = 'Y = '.$intersect;
|
||||
foreach($slope as $key => $value) {
|
||||
foreach ($slope as $key => $value) {
|
||||
if ($value != 0.0) {
|
||||
$equation .= ' + '.$value.' * X';
|
||||
if ($key > 0) {
|
||||
@ -127,8 +127,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
public function getSlope($dp=0) {
|
||||
if ($dp != 0) {
|
||||
$coefficients = array();
|
||||
foreach($this->_slope as $coefficient) {
|
||||
$coefficients[] = round($coefficient,$dp);
|
||||
foreach ($this->_slope as $coefficient) {
|
||||
$coefficients[] = round($coefficient, $dp);
|
||||
}
|
||||
return $coefficients;
|
||||
}
|
||||
@ -137,7 +137,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
|
||||
|
||||
public function getCoefficients($dp=0) {
|
||||
return array_merge(array($this->getIntersect($dp)),$this->getSlope($dp));
|
||||
return array_merge(array($this->getIntersect($dp)), $this->getSlope($dp));
|
||||
} // function getCoefficients()
|
||||
|
||||
|
||||
@ -191,8 +191,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
$this->_intersect = array_shift($coefficients);
|
||||
$this->_slope = $coefficients;
|
||||
|
||||
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum);
|
||||
foreach($this->_xValues as $xKey => $xValue) {
|
||||
$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum);
|
||||
foreach ($this->_xValues as $xKey => $xValue) {
|
||||
$this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||
}
|
||||
} // function _polynomial_regression()
|
||||
|
@ -54,7 +54,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @return float Y-Value
|
||||
**/
|
||||
public function getValueOfYForX($xValue) {
|
||||
return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope());
|
||||
return $this->getIntersect() * pow(($xValue - $this->_Xoffset), $this->getSlope());
|
||||
} // function getValueOfYForX()
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
**/
|
||||
public function getIntersect($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round(exp($this->_intersect),$dp);
|
||||
return round(exp($this->_intersect), $dp);
|
||||
}
|
||||
return exp($this->_intersect);
|
||||
} // function getIntersect()
|
||||
@ -105,7 +105,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _power_regression($yValues, $xValues, $const) {
|
||||
foreach($xValues as &$value) {
|
||||
foreach ($xValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
@ -113,7 +113,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
foreach($yValues as &$value) {
|
||||
foreach ($yValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
|
@ -91,7 +91,7 @@ class trendClass
|
||||
|
||||
// Define X Values if necessary
|
||||
if ($nX == 0) {
|
||||
$xValues = range(1,$nY);
|
||||
$xValues = range(1, $nY);
|
||||
$nX = $nY;
|
||||
} elseif ($nY != $nX) {
|
||||
// Ensure both arrays of points are the same size
|
||||
@ -108,7 +108,7 @@ class trendClass
|
||||
case self::TREND_POWER :
|
||||
if (!isset(self::$_trendCache[$key])) {
|
||||
$className = 'PHPExcel_'.$trendType.'_Best_Fit';
|
||||
self::$_trendCache[$key] = new $className($yValues,$xValues,$const);
|
||||
self::$_trendCache[$key] = new $className($yValues, $xValues, $const);
|
||||
}
|
||||
return self::$_trendCache[$key];
|
||||
break;
|
||||
@ -119,7 +119,7 @@ class trendClass
|
||||
case self::TREND_POLYNOMIAL_6 :
|
||||
if (!isset(self::$_trendCache[$key])) {
|
||||
$order = substr($trendType,-1);
|
||||
self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
||||
self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
|
||||
}
|
||||
return self::$_trendCache[$key];
|
||||
break;
|
||||
@ -127,15 +127,15 @@ class trendClass
|
||||
case self::TREND_BEST_FIT_NO_POLY :
|
||||
// If the request is to determine the best fit regression, then we test each trend line in turn
|
||||
// Start by generating an instance of each available trend method
|
||||
foreach(self::$_trendTypes as $trendMethod) {
|
||||
foreach (self::$_trendTypes as $trendMethod) {
|
||||
$className = 'PHPExcel_'.$trendMethod.'BestFit';
|
||||
$bestFit[$trendMethod] = new $className($yValues,$xValues,$const);
|
||||
$bestFit[$trendMethod] = new $className($yValues, $xValues, $const);
|
||||
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
|
||||
}
|
||||
if ($trendType != self::TREND_BEST_FIT_NO_POLY) {
|
||||
foreach(self::$_trendTypePolyOrders as $trendMethod) {
|
||||
foreach (self::$_trendTypePolyOrders as $trendMethod) {
|
||||
$order = substr($trendMethod,-1);
|
||||
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
||||
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
|
||||
if ($bestFit[$trendMethod]->getError()) {
|
||||
unset($bestFit[$trendMethod]);
|
||||
} else {
|
||||
|
@ -378,7 +378,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function disconnectCells() {
|
||||
if ( $this->_cellCollection !== NULL){
|
||||
if ( $this->_cellCollection !== NULL) {
|
||||
$this->_cellCollection->unsetWorksheetCells();
|
||||
$this->_cellCollection = NULL;
|
||||
}
|
||||
@ -620,7 +620,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
public function getChartNames()
|
||||
{
|
||||
$chartNames = array();
|
||||
foreach($this->_chartCollection as $chart) {
|
||||
foreach ($this->_chartCollection as $chart) {
|
||||
$chartNames[] = $chart->getName();
|
||||
}
|
||||
return $chartNames;
|
||||
@ -639,7 +639,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
if ($chartCount == 0) {
|
||||
return false;
|
||||
}
|
||||
foreach($this->_chartCollection as $index => $chart) {
|
||||
foreach ($this->_chartCollection as $index => $chart) {
|
||||
if ($chart->getName() == $chartName) {
|
||||
return $this->_chartCollection[$index];
|
||||
}
|
||||
@ -858,7 +858,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
}
|
||||
|
||||
$altTitle = $pValue . ' ' . $i;
|
||||
return $this->setTitle($altTitle,$updateFormulaCellReferences);
|
||||
return $this->setTitle($altTitle, $updateFormulaCellReferences);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1314,7 +1314,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
return NULL;
|
||||
$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
|
||||
|
||||
$this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow);
|
||||
$this->_cachedHighestRow = max($this->_cachedHighestRow, $pRow);
|
||||
}
|
||||
return $this->_rowDimensions[$pRow];
|
||||
}
|
||||
@ -1571,7 +1571,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
*/
|
||||
public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
|
||||
{
|
||||
foreach($pCellStyle as $cellStyle) {
|
||||
foreach ($pCellStyle as $cellStyle) {
|
||||
if (!($cellStyle instanceof PHPExcel_Style_Conditional)) {
|
||||
throw new PHPExcel_Exception('Style is not a conditional style');
|
||||
}
|
||||
@ -1899,7 +1899,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
|
||||
if (is_string($pValue)) {
|
||||
$this->_autoFilter->setRange($pValue);
|
||||
} elseif(is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
|
||||
} elseif (is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
|
||||
$this->_autoFilter = $pValue;
|
||||
}
|
||||
return $this;
|
||||
@ -2406,7 +2406,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
// Loop through $source
|
||||
foreach ($source as $rowData) {
|
||||
$currentColumn = $startColumn;
|
||||
foreach($rowData as $cellValue) {
|
||||
foreach ($rowData as $cellValue) {
|
||||
if ($strictNullComparison) {
|
||||
if ($cellValue !== $nullValue) {
|
||||
// Set cell value
|
||||
@ -2600,7 +2600,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
|
||||
// Loop through row dimensions
|
||||
foreach ($this->_rowDimensions as $dimension) {
|
||||
$highestRow = max($highestRow,$dimension->getRowIndex());
|
||||
$highestRow = max($highestRow, $dimension->getRowIndex());
|
||||
}
|
||||
|
||||
// Cache values
|
||||
@ -2779,7 +2779,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
$maxRow = $this->getHighestRow();
|
||||
$maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
|
||||
|
||||
$rangeBlocks = explode(' ',$range);
|
||||
$rangeBlocks = explode(' ', $range);
|
||||
foreach ($rangeBlocks as &$rangeSet) {
|
||||
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet);
|
||||
|
||||
@ -2790,7 +2790,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
$rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
|
||||
}
|
||||
unset($rangeSet);
|
||||
$stRange = implode(' ',$rangeBlocks);
|
||||
$stRange = implode(' ', $rangeBlocks);
|
||||
|
||||
return $stRange;
|
||||
}
|
||||
@ -2876,7 +2876,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
* @return objWorksheet
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function setCodeName($pValue=null){
|
||||
public function setCodeName($pValue=null) {
|
||||
// Is this a 'rename' or not?
|
||||
if ($this->getCodeName() == $pValue) {
|
||||
return $this;
|
||||
@ -2912,7 +2912,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
|
||||
$pValue = $pValue . '_' . $i;// ok, we have a valid name
|
||||
//codeName is'nt used in formula : no need to call for an update
|
||||
//return $this->setTitle($altTitle,$updateFormulaCellReferences);
|
||||
//return $this->setTitle($altTitle, $updateFormulaCellReferences);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2924,14 +2924,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCodeName(){
|
||||
public function getCodeName() {
|
||||
return $this->_codeName;
|
||||
}
|
||||
/**
|
||||
* Sheet has a code name ?
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasCodeName(){
|
||||
public function hasCodeName() {
|
||||
return !(is_null($this->_codeName));
|
||||
}
|
||||
}
|
||||
|
@ -112,12 +112,12 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
// Uppercase coordinate
|
||||
$cellAddress = explode('!',strtoupper($pRange));
|
||||
if (count($cellAddress) > 1) {
|
||||
list($worksheet,$pRange) = $cellAddress;
|
||||
list($worksheet, $pRange) = $cellAddress;
|
||||
}
|
||||
|
||||
if (strpos($pRange,':') !== FALSE) {
|
||||
$this->_range = $pRange;
|
||||
} elseif(empty($pRange)) {
|
||||
} elseif (empty($pRange)) {
|
||||
$this->_range = '';
|
||||
} else {
|
||||
throw new PHPExcel_Exception('Autofilter must be set on a range of cells.');
|
||||
@ -128,8 +128,8 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$this->_columns = array();
|
||||
} else {
|
||||
// Discard any column rules that are no longer valid within this range
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
foreach($this->_columns as $key => $value) {
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
foreach ($this->_columns as $key => $value) {
|
||||
$colIndex = PHPExcel_Cell::columnIndexFromString($key);
|
||||
if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
|
||||
unset($this->_columns[$key]);
|
||||
@ -163,7 +163,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
}
|
||||
|
||||
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) {
|
||||
throw new PHPExcel_Exception("Column is outside of current autofilter range.");
|
||||
}
|
||||
@ -207,7 +207,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function getColumnByOffset($pColumnOffset = 0) {
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
|
||||
|
||||
return $this->getColumn($pColumn);
|
||||
@ -225,7 +225,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
{
|
||||
if ((is_string($pColumn)) && (!empty($pColumn))) {
|
||||
$column = $pColumn;
|
||||
} elseif(is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
} elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
$column = $pColumn->getColumnIndex();
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Column is not within the autofilter range.");
|
||||
@ -234,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
|
||||
if (is_string($pColumn)) {
|
||||
$this->_columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this);
|
||||
} elseif(is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
} elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
$pColumn->setParent($this);
|
||||
$this->_columns[$column] = $pColumn;
|
||||
}
|
||||
@ -271,7 +271,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @param string $toColumn Column name (e.g. B)
|
||||
* @return PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function shiftColumn($fromColumn=NULL,$toColumn=NULL) {
|
||||
public function shiftColumn($fromColumn=NULL, $toColumn=NULL) {
|
||||
$fromColumn = strtoupper($fromColumn);
|
||||
$toColumn = strtoupper($toColumn);
|
||||
|
||||
@ -296,14 +296,14 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @param mixed[] $dataSet
|
||||
* @return boolean
|
||||
*/
|
||||
private static function _filterTestInSimpleDataSet($cellValue,$dataSet)
|
||||
private static function _filterTestInSimpleDataSet($cellValue, $dataSet)
|
||||
{
|
||||
$dataSetValues = $dataSet['filterValues'];
|
||||
$blanks = $dataSet['blanks'];
|
||||
if (($cellValue == '') || ($cellValue === NULL)) {
|
||||
return $blanks;
|
||||
}
|
||||
return in_array($cellValue,$dataSetValues);
|
||||
return in_array($cellValue, $dataSetValues);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -313,7 +313,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @param mixed[] $dataSet
|
||||
* @return boolean
|
||||
*/
|
||||
private static function _filterTestInDateGroupSet($cellValue,$dataSet)
|
||||
private static function _filterTestInDateGroupSet($cellValue, $dataSet)
|
||||
{
|
||||
$dateSet = $dataSet['filterValues'];
|
||||
$blanks = $dataSet['blanks'];
|
||||
@ -325,18 +325,18 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$dateValue = PHPExcel_Shared_Date::ExcelToPHP($cellValue);
|
||||
if ($cellValue < 1) {
|
||||
// Just the time part
|
||||
$dtVal = date('His',$dateValue);
|
||||
$dtVal = date('His', $dateValue);
|
||||
$dateSet = $dateSet['time'];
|
||||
} elseif($cellValue == floor($cellValue)) {
|
||||
} elseif ($cellValue == floor($cellValue)) {
|
||||
// Just the date part
|
||||
$dtVal = date('Ymd',$dateValue);
|
||||
$dtVal = date('Ymd', $dateValue);
|
||||
$dateSet = $dateSet['date'];
|
||||
} else {
|
||||
// date and time parts
|
||||
$dtVal = date('YmdHis',$dateValue);
|
||||
$dtVal = date('YmdHis', $dateValue);
|
||||
$dateSet = $dateSet['dateTime'];
|
||||
}
|
||||
foreach($dateSet as $dateValue) {
|
||||
foreach ($dateSet as $dateValue) {
|
||||
// Use of substr to extract value at the appropriate group level
|
||||
if (substr($dtVal,0,strlen($dateValue)) == $dateValue)
|
||||
return TRUE;
|
||||
@ -366,7 +366,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
}
|
||||
}
|
||||
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||
foreach($dataSet as $rule) {
|
||||
foreach ($dataSet as $rule) {
|
||||
if (is_numeric($rule['value'])) {
|
||||
// Numeric values are tested using the appropriate operator
|
||||
switch ($rule['operator']) {
|
||||
@ -389,7 +389,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$retVal = ($cellValue <= $rule['value']);
|
||||
break;
|
||||
}
|
||||
} elseif($rule['value'] == '') {
|
||||
} elseif ($rule['value'] == '') {
|
||||
switch ($rule['operator']) {
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL :
|
||||
$retVal = (($cellValue == '') || ($cellValue === NULL));
|
||||
@ -403,7 +403,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
}
|
||||
} else {
|
||||
// String values are always tested for equality, factoring in for wildcards (hence a regexp test)
|
||||
$retVal = preg_match('/^'.$rule['value'].'$/i',$cellValue);
|
||||
$retVal = preg_match('/^'.$rule['value'].'$/i', $cellValue);
|
||||
}
|
||||
// If there are multiple conditions, then we need to test both using the appropriate join operator
|
||||
switch ($join) {
|
||||
@ -439,7 +439,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
|
||||
if (is_numeric($cellValue)) {
|
||||
$dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue));
|
||||
if (in_array($dateValue,$monthSet)) {
|
||||
if (in_array($dateValue, $monthSet)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -474,28 +474,28 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
// Calculate start/end dates for the required date range based on current date
|
||||
switch ($dynamicRuleType) {
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK :
|
||||
$baseDate = strtotime('-7 days',$baseDate);
|
||||
$baseDate = strtotime('-7 days', $baseDate);
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK :
|
||||
$baseDate = strtotime('-7 days',$baseDate);
|
||||
$baseDate = strtotime('-7 days', $baseDate);
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH :
|
||||
$baseDate = strtotime('-1 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('-1 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH :
|
||||
$baseDate = strtotime('+1 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('+1 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER :
|
||||
$baseDate = strtotime('-3 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('-3 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
|
||||
$baseDate = strtotime('+3 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('+3 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR :
|
||||
$baseDate = strtotime('-1 year',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('-1 year',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR :
|
||||
$baseDate = strtotime('+1 year',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('+1 year',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -503,40 +503,40 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate);
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,31,12,date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,31,12,date('Y', $baseDate)));
|
||||
++$maxVal;
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate)));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
|
||||
$thisMonth = date('m',$baseDate);
|
||||
$thisMonth = date('m', $baseDate);
|
||||
$thisQuarter = floor(--$thisMonth / 3);
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),(1+$thisQuarter)*3,date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t', $baseDate),(1+$thisQuarter)*3,date('Y', $baseDate)));
|
||||
++$maxVal;
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y',$baseDate)));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),date('m',$baseDate),date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t', $baseDate),date('m', $baseDate),date('Y', $baseDate)));
|
||||
++$maxVal;
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK :
|
||||
$dayOfWeek = date('w',$baseDate);
|
||||
$dayOfWeek = date('w', $baseDate);
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate) - $dayOfWeek;
|
||||
$maxVal = $val + 7;
|
||||
break;
|
||||
@ -577,7 +577,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
);
|
||||
}
|
||||
|
||||
private function _calculateTopTenValue($columnID,$startRow,$endRow,$ruleType,$ruleValue) {
|
||||
private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) {
|
||||
$range = $columnID.$startRow.':'.$columnID.$endRow;
|
||||
$dataValues = PHPExcel_Calculation_Functions::flattenArray(
|
||||
$this->_workSheet->rangeToArray($range,NULL,TRUE,FALSE)
|
||||
@ -590,7 +590,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
sort($dataValues);
|
||||
}
|
||||
|
||||
return array_pop(array_slice($dataValues,0,$ruleValue));
|
||||
return array_pop(array_slice($dataValues,0, $ruleValue));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -601,20 +601,20 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function showHideRows()
|
||||
{
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
|
||||
// The heading row should always be visible
|
||||
// echo 'AutoFilter Heading Row ',$rangeStart[1],' is always SHOWN',PHP_EOL;
|
||||
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
|
||||
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE);
|
||||
|
||||
$columnFilterTests = array();
|
||||
foreach($this->_columns as $columnID => $filterColumn) {
|
||||
foreach ($this->_columns as $columnID => $filterColumn) {
|
||||
$rules = $filterColumn->getRules();
|
||||
switch ($filterColumn->getFilterType()) {
|
||||
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER :
|
||||
$ruleValues = array();
|
||||
// Build a list of the filter value selections
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
$ruleType = $rule->getRuleType();
|
||||
$ruleValues[] = $rule->getValue();
|
||||
}
|
||||
@ -638,26 +638,26 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
'time' => array(),
|
||||
'dateTime' => array(),
|
||||
);
|
||||
foreach($ruleDataSet as $ruleValue) {
|
||||
foreach ($ruleDataSet as $ruleValue) {
|
||||
$date = $time = '';
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== ''))
|
||||
$date .= sprintf('%04d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
|
||||
$date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != ''))
|
||||
$date .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
|
||||
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== ''))
|
||||
$date .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
|
||||
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== ''))
|
||||
$time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
|
||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== ''))
|
||||
$time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
|
||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== ''))
|
||||
$time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
|
||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
|
||||
$dateTime = $date . $time;
|
||||
$arguments['date'][] = $date;
|
||||
$arguments['time'][] = $time;
|
||||
@ -679,13 +679,13 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$customRuleForBlanks = FALSE;
|
||||
$ruleValues = array();
|
||||
// Build a list of the filter value selections
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
$ruleType = $rule->getRuleType();
|
||||
$ruleValue = $rule->getValue();
|
||||
if (!is_numeric($ruleValue)) {
|
||||
// Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards
|
||||
$ruleValue = preg_quote($ruleValue);
|
||||
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace,$ruleValue);
|
||||
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
|
||||
if (trim($ruleValue) == '') {
|
||||
$customRuleForBlanks = TRUE;
|
||||
$ruleValue = trim($ruleValue);
|
||||
@ -706,7 +706,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
|
||||
$ruleValues = array();
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
// We should only ever have one Dynamic Filter Rule anyway
|
||||
$dynamicRuleType = $rule->getGrouping();
|
||||
if (($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ||
|
||||
@ -714,7 +714,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
// Number (Average) based
|
||||
// Calculate the average
|
||||
$averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
|
||||
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL,$this->_workSheet->getCell('A1'));
|
||||
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL, $this->_workSheet->getCell('A1'));
|
||||
// Set above/below rule based on greaterThan or LessTan
|
||||
$operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
|
||||
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
|
||||
@ -757,7 +757,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER :
|
||||
$ruleValues = array();
|
||||
$dataRowCount = $rangeEnd[1] - $rangeStart[1];
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
// We should only ever have one Dynamic Filter Rule anyway
|
||||
$toptenRuleType = $rule->getGrouping();
|
||||
$ruleValue = $rule->getValue();
|
||||
@ -769,7 +769,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
if ($ruleValue < 1) $ruleValue = 1;
|
||||
if ($ruleValue > 500) $ruleValue = 500;
|
||||
|
||||
$maxVal = $this->_calculateTopTenValue($columnID,$rangeStart[1]+1,$rangeEnd[1],$toptenRuleType,$ruleValue);
|
||||
$maxVal = $this->_calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
|
||||
|
||||
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
|
||||
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
|
||||
@ -795,16 +795,16 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
//
|
||||
// Execute the column tests for each row in the autoFilter range to determine show/hide,
|
||||
for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
|
||||
// echo 'Testing Row = ',$row,PHP_EOL;
|
||||
// echo 'Testing Row = ', $row,PHP_EOL;
|
||||
$result = TRUE;
|
||||
foreach($columnFilterTests as $columnID => $columnFilterTest) {
|
||||
// echo 'Testing cell ',$columnID.$row,PHP_EOL;
|
||||
foreach ($columnFilterTests as $columnID => $columnFilterTest) {
|
||||
// echo 'Testing cell ', $columnID.$row,PHP_EOL;
|
||||
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
|
||||
// echo 'Value is ',$cellValue,PHP_EOL;
|
||||
// echo 'Value is ', $cellValue,PHP_EOL;
|
||||
// Execute the filter test
|
||||
$result = $result &&
|
||||
call_user_func_array(
|
||||
array('PHPExcel_Worksheet_AutoFilter',$columnFilterTest['method']),
|
||||
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
|
||||
array(
|
||||
$cellValue,
|
||||
$columnFilterTest['arguments']
|
||||
|
@ -322,7 +322,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
public function setValue($pValue = '') {
|
||||
if (is_array($pValue)) {
|
||||
$grouping = -1;
|
||||
foreach($pValue as $key => $value) {
|
||||
foreach ($pValue as $key => $value) {
|
||||
// Validate array entries
|
||||
if (!in_array($key,self::$_dateTimeGroups)) {
|
||||
// Remove any invalid entries from the value array
|
||||
|
@ -575,7 +575,7 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
return $this->_printArea;
|
||||
}
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if (isset($printAreas[$index-1])) {
|
||||
return $printAreas[$index-1];
|
||||
}
|
||||
@ -595,7 +595,7 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
return !is_null($this->_printArea);
|
||||
}
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
return isset($printAreas[$index-1]);
|
||||
}
|
||||
|
||||
@ -612,10 +612,10 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
$this->_printArea = NULL;
|
||||
} else {
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if (isset($printAreas[$index-1])) {
|
||||
unset($printAreas[$index-1]);
|
||||
$this->_printArea = implode(',',$printAreas);
|
||||
$this->_printArea = implode(',', $printAreas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,29 +656,29 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
$this->_printArea = $value;
|
||||
} else {
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
if($index < 0) {
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if ($index < 0) {
|
||||
$index = count($printAreas) - abs($index) + 1;
|
||||
}
|
||||
if (($index <= 0) || ($index > count($printAreas))) {
|
||||
throw new PHPExcel_Exception('Invalid index for setting print range.');
|
||||
}
|
||||
$printAreas[$index-1] = $value;
|
||||
$this->_printArea = implode(',',$printAreas);
|
||||
$this->_printArea = implode(',', $printAreas);
|
||||
}
|
||||
} elseif($method == self::SETPRINTRANGE_INSERT) {
|
||||
} elseif ($method == self::SETPRINTRANGE_INSERT) {
|
||||
if ($index == 0) {
|
||||
$this->_printArea .= ($this->_printArea == '') ? $value : ','.$value;
|
||||
} else {
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
if($index < 0) {
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if ($index < 0) {
|
||||
$index = abs($index) - 1;
|
||||
}
|
||||
if ($index > count($printAreas)) {
|
||||
throw new PHPExcel_Exception('Invalid index for setting print range.');
|
||||
}
|
||||
$printAreas = array_merge(array_slice($printAreas,0,$index),array($value),array_slice($printAreas,$index));
|
||||
$this->_printArea = implode(',',$printAreas);
|
||||
$printAreas = array_merge(array_slice($printAreas,0, $index),array($value),array_slice($printAreas, $index));
|
||||
$this->_printArea = implode(',', $printAreas);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception('Invalid method for setting print range.');
|
||||
|
@ -98,7 +98,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
|
||||
|
||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
||||
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||
|
||||
@ -124,9 +124,9 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
$maxRow = $sheet->getHighestDataRow();
|
||||
|
||||
// Write rows to file
|
||||
for($row = 1; $row <= $maxRow; ++$row) {
|
||||
for ($row = 1; $row <= $maxRow; ++$row) {
|
||||
// Convert the row to an array...
|
||||
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row,'', $this->_preCalculateFormulas);
|
||||
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row, '', $this->_preCalculateFormulas);
|
||||
// ... and write to the file
|
||||
$this->_writeLine($fileHandle, $cellsArray[0]);
|
||||
}
|
||||
@ -143,7 +143,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter() {
|
||||
public function getDelimiter()
|
||||
{
|
||||
return $this->_delimiter;
|
||||
}
|
||||
|
||||
@ -153,7 +154,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setDelimiter($pValue = ',') {
|
||||
public function setDelimiter($pValue = ',')
|
||||
{
|
||||
$this->_delimiter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -163,7 +165,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnclosure() {
|
||||
public function getEnclosure()
|
||||
{
|
||||
return $this->_enclosure;
|
||||
}
|
||||
|
||||
@ -173,7 +176,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setEnclosure($pValue = '"') {
|
||||
public function setEnclosure($pValue = '"')
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = null;
|
||||
}
|
||||
@ -186,7 +190,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineEnding() {
|
||||
public function getLineEnding()
|
||||
{
|
||||
return $this->_lineEnding;
|
||||
}
|
||||
|
||||
@ -196,7 +201,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setLineEnding($pValue = PHP_EOL) {
|
||||
public function setLineEnding($pValue = PHP_EOL)
|
||||
{
|
||||
$this->_lineEnding = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -206,7 +212,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUseBOM() {
|
||||
public function getUseBOM()
|
||||
{
|
||||
return $this->_useBOM;
|
||||
}
|
||||
|
||||
@ -216,7 +223,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setUseBOM($pValue = false) {
|
||||
public function setUseBOM($pValue = false)
|
||||
{
|
||||
$this->_useBOM = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -226,7 +234,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getExcelCompatibility() {
|
||||
public function getExcelCompatibility()
|
||||
{
|
||||
return $this->_excelCompatibility;
|
||||
}
|
||||
|
||||
@ -237,7 +246,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* Note that this overrides other settings such as useBOM, enclosure and delimiter
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setExcelCompatibility($pValue = false) {
|
||||
public function setExcelCompatibility($pValue = false)
|
||||
{
|
||||
$this->_excelCompatibility = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -247,7 +257,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
public function getSheetIndex()
|
||||
{
|
||||
return $this->_sheetIndex;
|
||||
}
|
||||
|
||||
@ -257,7 +268,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param int $pValue Sheet index
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
public function setSheetIndex($pValue = 0)
|
||||
{
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -269,7 +281,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param array $pValues Array containing values in a row
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeLine($pFileHandle = null, $pValues = null) {
|
||||
private function _writeLine($pFileHandle = null, $pValues = null)
|
||||
{
|
||||
if (is_array($pValues)) {
|
||||
// No leading delimiter
|
||||
$writeDelimiter = false;
|
||||
@ -301,5 +314,4 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -125,18 +125,18 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
// Assign PHPExcel
|
||||
$this->setPHPExcel($pPHPExcel);
|
||||
|
||||
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
|
||||
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
|
||||
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
|
||||
'rels' => 'PHPExcel_Writer_Excel2007_Rels',
|
||||
'theme' => 'PHPExcel_Writer_Excel2007_Theme',
|
||||
'style' => 'PHPExcel_Writer_Excel2007_Style',
|
||||
'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
|
||||
'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
|
||||
'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
|
||||
'comments' => 'PHPExcel_Writer_Excel2007_Comments',
|
||||
'chart' => 'PHPExcel_Writer_Excel2007_Chart',
|
||||
'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA',
|
||||
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
|
||||
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
|
||||
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
|
||||
'rels' => 'PHPExcel_Writer_Excel2007_Rels',
|
||||
'theme' => 'PHPExcel_Writer_Excel2007_Theme',
|
||||
'style' => 'PHPExcel_Writer_Excel2007_Style',
|
||||
'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
|
||||
'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
|
||||
'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
|
||||
'comments' => 'PHPExcel_Writer_Excel2007_Comments',
|
||||
'chart' => 'PHPExcel_Writer_Excel2007_Chart',
|
||||
'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA',
|
||||
'relsribbonobjects' => 'PHPExcel_Writer_Excel2007_RelsRibbon'
|
||||
);
|
||||
|
||||
@ -163,7 +163,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @param string $pPartName Writer part name
|
||||
* @return PHPExcel_Writer_Excel2007_WriterPart
|
||||
*/
|
||||
public function getWriterPart($pPartName = '') {
|
||||
public function getWriterPart($pPartName = '')
|
||||
{
|
||||
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
|
||||
return $this->_writerParts[strtolower($pPartName)];
|
||||
} else {
|
||||
@ -179,7 +180,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*/
|
||||
public function save($pFilename = null)
|
||||
{
|
||||
if ($this->_spreadSheet !== NULL) {
|
||||
if ($this->_spreadSheet !== null) {
|
||||
// garbage collect
|
||||
$this->_spreadSheet->garbageCollect();
|
||||
|
||||
@ -193,7 +194,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog();
|
||||
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE);
|
||||
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(false);
|
||||
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
|
||||
@ -204,15 +205,15 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
// Create styles dictionaries
|
||||
$this->_styleHashTable->addFromSource( $this->getWriterPart('Style')->allStyles($this->_spreadSheet) );
|
||||
$this->_stylesConditionalHashTable->addFromSource( $this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet) );
|
||||
$this->_fillHashTable->addFromSource( $this->getWriterPart('Style')->allFills($this->_spreadSheet) );
|
||||
$this->_fontHashTable->addFromSource( $this->getWriterPart('Style')->allFonts($this->_spreadSheet) );
|
||||
$this->_bordersHashTable->addFromSource( $this->getWriterPart('Style')->allBorders($this->_spreadSheet) );
|
||||
$this->_numFmtHashTable->addFromSource( $this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet) );
|
||||
$this->_styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->_spreadSheet));
|
||||
$this->_stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet));
|
||||
$this->_fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->_spreadSheet));
|
||||
$this->_fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->_spreadSheet));
|
||||
$this->_bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->_spreadSheet));
|
||||
$this->_numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet));
|
||||
|
||||
// Create drawing dictionary
|
||||
$this->_drawingHashTable->addFromSource( $this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet) );
|
||||
$this->_drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet));
|
||||
|
||||
// Create new ZIP file and open it for writing
|
||||
$zipClass = PHPExcel_Settings::getZipClass();
|
||||
@ -235,60 +236,58 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
// Add [Content_Types].xml to ZIP file
|
||||
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts));
|
||||
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts));
|
||||
|
||||
//if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
|
||||
if($this->_spreadSheet->hasMacros()){
|
||||
if ($this->_spreadSheet->hasMacros()) {
|
||||
$macrosCode=$this->_spreadSheet->getMacrosCode();
|
||||
if(!is_null($macrosCode)){// we have the code ?
|
||||
if (!is_null($macrosCode)) {// we have the code ?
|
||||
$objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin
|
||||
if($this->_spreadSheet->hasMacrosCertificate()){//signed macros ?
|
||||
if ($this->_spreadSheet->hasMacrosCertificate()) {//signed macros ?
|
||||
// Yes : add the certificate file and the related rels file
|
||||
$objZip->addFromString('xl/vbaProjectSignature.bin', $this->_spreadSheet->getMacrosCertificate());
|
||||
$objZip->addFromString('xl/_rels/vbaProject.bin.rels',
|
||||
$this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
|
||||
}
|
||||
}
|
||||
}
|
||||
//a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
|
||||
if($this->_spreadSheet->hasRibbon()){
|
||||
if ($this->_spreadSheet->hasRibbon()) {
|
||||
$tmpRibbonTarget=$this->_spreadSheet->getRibbonXMLData('target');
|
||||
$objZip->addFromString($tmpRibbonTarget, $this->_spreadSheet->getRibbonXMLData('data'));
|
||||
if($this->_spreadSheet->hasRibbonBinObjects()){
|
||||
if ($this->_spreadSheet->hasRibbonBinObjects()) {
|
||||
$tmpRootPath=dirname($tmpRibbonTarget).'/';
|
||||
$ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write
|
||||
foreach($ribbonBinObjects as $aPath=>$aContent){
|
||||
foreach ($ribbonBinObjects as $aPath=>$aContent) {
|
||||
$objZip->addFromString($tmpRootPath.$aPath, $aContent);
|
||||
}
|
||||
//the rels for files
|
||||
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels',
|
||||
$this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
|
||||
}
|
||||
}
|
||||
|
||||
// Add relationships to ZIP file
|
||||
$objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet));
|
||||
|
||||
// Add document properties to ZIP file
|
||||
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
|
||||
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet);
|
||||
if ($customPropertiesPart !== NULL) {
|
||||
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
|
||||
if ($customPropertiesPart !== null) {
|
||||
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
|
||||
}
|
||||
|
||||
// Add theme to ZIP file
|
||||
$objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet));
|
||||
|
||||
// Add string table to ZIP file
|
||||
$objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable));
|
||||
$objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable));
|
||||
|
||||
// Add styles to ZIP file
|
||||
$objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet));
|
||||
|
||||
// Add workbook to ZIP file
|
||||
$objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet, $this->_preCalculateFormulas));
|
||||
$objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet, $this->_preCalculateFormulas));
|
||||
|
||||
$chartCount = 0;
|
||||
// Add worksheets
|
||||
@ -297,7 +296,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
if ($this->_includeCharts) {
|
||||
$charts = $this->_spreadSheet->getSheet($i)->getChartCollection();
|
||||
if (count($charts) > 0) {
|
||||
foreach($charts as $chart) {
|
||||
foreach ($charts as $chart) {
|
||||
$objZip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart));
|
||||
$chartCount++;
|
||||
}
|
||||
@ -308,9 +307,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
$chartRef1 = $chartRef2 = 0;
|
||||
// Add worksheet relationships (drawings, ...)
|
||||
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
|
||||
|
||||
// Add relationships
|
||||
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
|
||||
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
|
||||
|
||||
$drawings = $this->_spreadSheet->getSheet($i)->getDrawingCollection();
|
||||
$drawingCount = count($drawings);
|
||||
@ -321,10 +319,10 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
// Add drawing and image relationship parts
|
||||
if (($drawingCount > 0) || ($chartCount > 0)) {
|
||||
// Drawing relationships
|
||||
$objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i),$chartRef1, $this->_includeCharts));
|
||||
$objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i), $chartRef1, $this->_includeCharts));
|
||||
|
||||
// Drawings
|
||||
$objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i),$chartRef2,$this->_includeCharts));
|
||||
$objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i), $chartRef2, $this->_includeCharts));
|
||||
}
|
||||
|
||||
// Add comment relationship parts
|
||||
@ -409,7 +407,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @return PHPExcel
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function getPHPExcel() {
|
||||
public function getPHPExcel()
|
||||
{
|
||||
if ($this->_spreadSheet !== null) {
|
||||
return $this->_spreadSheet;
|
||||
} else {
|
||||
@ -424,7 +423,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
* @return PHPExcel_Writer_Excel2007
|
||||
*/
|
||||
public function setPHPExcel(PHPExcel $pPHPExcel = null) {
|
||||
public function setPHPExcel(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$this->_spreadSheet = $pPHPExcel;
|
||||
return $this;
|
||||
}
|
||||
@ -434,7 +434,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getStringTable() {
|
||||
public function getStringTable()
|
||||
{
|
||||
return $this->_stringTable;
|
||||
}
|
||||
|
||||
@ -443,7 +444,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getStyleHashTable() {
|
||||
public function getStyleHashTable()
|
||||
{
|
||||
return $this->_styleHashTable;
|
||||
}
|
||||
|
||||
@ -452,7 +454,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getStylesConditionalHashTable() {
|
||||
public function getStylesConditionalHashTable()
|
||||
{
|
||||
return $this->_stylesConditionalHashTable;
|
||||
}
|
||||
|
||||
@ -461,7 +464,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getFillHashTable() {
|
||||
public function getFillHashTable()
|
||||
{
|
||||
return $this->_fillHashTable;
|
||||
}
|
||||
|
||||
@ -470,7 +474,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getFontHashTable() {
|
||||
public function getFontHashTable()
|
||||
{
|
||||
return $this->_fontHashTable;
|
||||
}
|
||||
|
||||
@ -479,7 +484,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getBordersHashTable() {
|
||||
public function getBordersHashTable()
|
||||
{
|
||||
return $this->_bordersHashTable;
|
||||
}
|
||||
|
||||
@ -488,7 +494,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getNumFmtHashTable() {
|
||||
public function getNumFmtHashTable()
|
||||
{
|
||||
return $this->_numFmtHashTable;
|
||||
}
|
||||
|
||||
@ -497,7 +504,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getDrawingHashTable() {
|
||||
public function getDrawingHashTable()
|
||||
{
|
||||
return $this->_drawingHashTable;
|
||||
}
|
||||
|
||||
@ -506,7 +514,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getOffice2003Compatibility() {
|
||||
public function getOffice2003Compatibility()
|
||||
{
|
||||
return $this->_office2003compatibility;
|
||||
}
|
||||
|
||||
@ -516,9 +525,9 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @param boolean $pValue Office2003 compatibility?
|
||||
* @return PHPExcel_Writer_Excel2007
|
||||
*/
|
||||
public function setOffice2003Compatibility($pValue = false) {
|
||||
public function setOffice2003Compatibility($pValue = false)
|
||||
{
|
||||
$this->_office2003compatibility = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Comments cache
|
||||
$comments = $pWorksheet->getComments();
|
||||
@ -133,7 +133,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Comments cache
|
||||
$comments = $pWorksheet->getComments();
|
||||
|
@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE)
|
||||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -54,87 +54,59 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Types
|
||||
$objWriter->startElement('Types');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
|
||||
|
||||
// Theme
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
|
||||
|
||||
// Styles
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
|
||||
|
||||
// Rels
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
|
||||
|
||||
// XML
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'xml', 'application/xml'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
|
||||
|
||||
// VML
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
|
||||
|
||||
// Workbook
|
||||
if($pPHPExcel->hasMacros()){ //Macros in workbook ?
|
||||
if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
|
||||
// Yes : not standard content but "macroEnabled"
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml');
|
||||
//... and define a new type for the VBA project
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'bin', 'application/vnd.ms-office.vbaProject'
|
||||
);
|
||||
if($pPHPExcel->hasMacrosCertificate()){// signed macros ?
|
||||
$this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
|
||||
if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
|
||||
// Yes : add needed information
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature');
|
||||
}
|
||||
}else{// no macros in workbook, so standard type
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
|
||||
);
|
||||
} else {// no macros in workbook, so standard type
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
|
||||
}
|
||||
|
||||
// DocProps
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
|
||||
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
|
||||
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (!empty($customPropertyList)) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
|
||||
}
|
||||
|
||||
// Worksheets
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml');
|
||||
}
|
||||
|
||||
// Shared strings
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
|
||||
|
||||
// Add worksheet relationship content types
|
||||
$chart = 1;
|
||||
@ -145,17 +117,13 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
|
||||
// We need a drawing relationship for the worksheet if we have either drawings or charts
|
||||
if (($drawingCount > 0) || ($chartCount > 0)) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
|
||||
}
|
||||
|
||||
// If we have charts, then we need a chart relationship for every individual chart
|
||||
if ($chartCount > 0) {
|
||||
for ($c = 0; $c < $chartCount; ++$c) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,9 +131,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
// Comments
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,33 +154,27 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
}
|
||||
|
||||
if (!isset( $aMediaContentTypes[$extension]) ) {
|
||||
$aMediaContentTypes[$extension] = $mimeType;
|
||||
$aMediaContentTypes[$extension] = $mimeType;
|
||||
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, $extension, $mimeType
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
|
||||
}
|
||||
}
|
||||
if($pPHPExcel->hasRibbonBinObjects()){//Some additional objects in the ribbon ?
|
||||
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
|
||||
//we need to write "Extension" but not already write for media content
|
||||
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
|
||||
foreach($tabRibbonTypes as $aRibbonType){
|
||||
foreach ($tabRibbonTypes as $aRibbonType) {
|
||||
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, $aRibbonType, $mimeType
|
||||
);
|
||||
}
|
||||
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
|
||||
}
|
||||
}
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
|
||||
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
|
||||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) {
|
||||
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() );
|
||||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
|
||||
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType($image->getPath());
|
||||
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,8 +216,8 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
if ($pPartname != '' && $pContentType != '') {
|
||||
// Write content type
|
||||
$objWriter->startElement('Default');
|
||||
$objWriter->writeAttribute('Extension', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->writeAttribute('Extension', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
|
||||
@ -277,8 +237,8 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
if ($pPartname != '' && $pContentType != '') {
|
||||
// Write content type
|
||||
$objWriter->startElement('Override');
|
||||
$objWriter->writeAttribute('PartName', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->writeAttribute('PartName', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
|
||||
|
@ -35,7 +35,7 @@
|
||||
*/
|
||||
class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Write docProps/app.xml to XML format
|
||||
*
|
||||
* @param PHPExcel $pPHPExcel
|
||||
@ -53,78 +53,78 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Properties
|
||||
$objWriter->startElement('Properties');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
|
||||
// Application
|
||||
$objWriter->writeElement('Application', 'Microsoft Excel');
|
||||
// Application
|
||||
$objWriter->writeElement('Application', 'Microsoft Excel');
|
||||
|
||||
// DocSecurity
|
||||
$objWriter->writeElement('DocSecurity', '0');
|
||||
// DocSecurity
|
||||
$objWriter->writeElement('DocSecurity', '0');
|
||||
|
||||
// ScaleCrop
|
||||
$objWriter->writeElement('ScaleCrop', 'false');
|
||||
// ScaleCrop
|
||||
$objWriter->writeElement('ScaleCrop', 'false');
|
||||
|
||||
// HeadingPairs
|
||||
$objWriter->startElement('HeadingPairs');
|
||||
// HeadingPairs
|
||||
$objWriter->startElement('HeadingPairs');
|
||||
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', '2');
|
||||
$objWriter->writeAttribute('baseType', 'variant');
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', '2');
|
||||
$objWriter->writeAttribute('baseType', 'variant');
|
||||
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:lpstr', 'Worksheets');
|
||||
$objWriter->endElement();
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:lpstr', 'Worksheets');
|
||||
$objWriter->endElement();
|
||||
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount());
|
||||
$objWriter->endElement();
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// TitlesOfParts
|
||||
$objWriter->startElement('TitlesOfParts');
|
||||
// TitlesOfParts
|
||||
$objWriter->startElement('TitlesOfParts');
|
||||
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', $pPHPExcel->getSheetCount());
|
||||
$objWriter->writeAttribute('baseType', 'lpstr');
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', $pPHPExcel->getSheetCount());
|
||||
$objWriter->writeAttribute('baseType', 'lpstr');
|
||||
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle());
|
||||
}
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// Company
|
||||
$objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany());
|
||||
// Company
|
||||
$objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany());
|
||||
|
||||
// Company
|
||||
$objWriter->writeElement('Manager', $pPHPExcel->getProperties()->getManager());
|
||||
// Company
|
||||
$objWriter->writeElement('Manager', $pPHPExcel->getProperties()->getManager());
|
||||
|
||||
// LinksUpToDate
|
||||
$objWriter->writeElement('LinksUpToDate', 'false');
|
||||
// LinksUpToDate
|
||||
$objWriter->writeElement('LinksUpToDate', 'false');
|
||||
|
||||
// SharedDoc
|
||||
$objWriter->writeElement('SharedDoc', 'false');
|
||||
// SharedDoc
|
||||
$objWriter->writeElement('SharedDoc', 'false');
|
||||
|
||||
// HyperlinksChanged
|
||||
$objWriter->writeElement('HyperlinksChanged', 'false');
|
||||
// HyperlinksChanged
|
||||
$objWriter->writeElement('HyperlinksChanged', 'false');
|
||||
|
||||
// AppVersion
|
||||
$objWriter->writeElement('AppVersion', '12.0000');
|
||||
// AppVersion
|
||||
$objWriter->writeElement('AppVersion', '12.0000');
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -150,48 +150,48 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// cp:coreProperties
|
||||
$objWriter->startElement('cp:coreProperties');
|
||||
$objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
|
||||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
|
||||
$objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
|
||||
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
$objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
|
||||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
|
||||
$objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
|
||||
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
|
||||
// dc:creator
|
||||
$objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
|
||||
// dc:creator
|
||||
$objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
|
||||
|
||||
// cp:lastModifiedBy
|
||||
$objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
|
||||
// cp:lastModifiedBy
|
||||
$objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
|
||||
|
||||
// dcterms:created
|
||||
$objWriter->startElement('dcterms:created');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
|
||||
$objWriter->endElement();
|
||||
// dcterms:created
|
||||
$objWriter->startElement('dcterms:created');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// dcterms:modified
|
||||
$objWriter->startElement('dcterms:modified');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
|
||||
$objWriter->endElement();
|
||||
// dcterms:modified
|
||||
$objWriter->startElement('dcterms:modified');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// dc:title
|
||||
$objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
|
||||
// dc:title
|
||||
$objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
|
||||
|
||||
// dc:description
|
||||
$objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
|
||||
// dc:description
|
||||
$objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
|
||||
|
||||
// dc:subject
|
||||
$objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
|
||||
// dc:subject
|
||||
$objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
|
||||
|
||||
// cp:keywords
|
||||
$objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
|
||||
// cp:keywords
|
||||
$objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
|
||||
|
||||
// cp:category
|
||||
$objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
|
||||
// cp:category
|
||||
$objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -222,51 +222,50 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// cp:coreProperties
|
||||
$objWriter->startElement('Properties');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
|
||||
|
||||
foreach($customPropertyList as $key => $customProperty) {
|
||||
$propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
||||
$propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
||||
foreach ($customPropertyList as $key => $customProperty) {
|
||||
$propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
||||
$propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
||||
|
||||
$objWriter->startElement('property');
|
||||
$objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
|
||||
$objWriter->writeAttribute('pid', $key+2);
|
||||
$objWriter->writeAttribute('name', $customProperty);
|
||||
$objWriter->startElement('property');
|
||||
$objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
|
||||
$objWriter->writeAttribute('pid', $key+2);
|
||||
$objWriter->writeAttribute('name', $customProperty);
|
||||
|
||||
switch($propertyType) {
|
||||
case 'i' :
|
||||
$objWriter->writeElement('vt:i4', $propertyValue);
|
||||
break;
|
||||
case 'f' :
|
||||
$objWriter->writeElement('vt:r8', $propertyValue);
|
||||
break;
|
||||
case 'b' :
|
||||
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
||||
break;
|
||||
case 'd' :
|
||||
$objWriter->startElement('vt:filetime');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
||||
$objWriter->endElement();
|
||||
break;
|
||||
default :
|
||||
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
||||
break;
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
switch ($propertyType) {
|
||||
case 'i' :
|
||||
$objWriter->writeElement('vt:i4', $propertyValue);
|
||||
break;
|
||||
case 'f' :
|
||||
$objWriter->writeElement('vt:r8', $propertyValue);
|
||||
break;
|
||||
case 'b' :
|
||||
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
||||
break;
|
||||
case 'd' :
|
||||
$objWriter->startElement('vt:filetime');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
||||
$objWriter->endElement();
|
||||
break;
|
||||
default :
|
||||
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
||||
break;
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
// Return
|
||||
return $objWriter->getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// xdr:wsDr
|
||||
$objWriter->startElement('xdr:wsDr');
|
||||
@ -397,7 +397,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Header/footer images
|
||||
$images = $pWorksheet->getHeaderFooter()->getImages();
|
||||
|
@ -53,7 +53,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
@ -95,7 +95,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
'xl/workbook.xml'
|
||||
);
|
||||
// a custom UI in workbook ?
|
||||
if($pPHPExcel->hasRibbon()){
|
||||
if ($pPHPExcel->hasRibbon()) {
|
||||
$this->_writeRelationShip(
|
||||
$objWriter,
|
||||
5,
|
||||
@ -128,7 +128,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
@ -170,7 +170,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
// Relationships for vbaProject if needed
|
||||
// id : just after the last sheet
|
||||
if($pPHPExcel->hasMacros()){
|
||||
if ($pPHPExcel->hasMacros()) {
|
||||
$this->_writeRelationShip(
|
||||
$objWriter,
|
||||
($i + 1 + 3),
|
||||
@ -210,7 +210,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
@ -238,7 +238,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
// $charts = $pWorksheet->getChartCollection();
|
||||
// echo 'Chart Rels: ' , count($charts) , '<br />';
|
||||
// if (count($charts) > 0) {
|
||||
// foreach($charts as $chart) {
|
||||
// foreach ($charts as $chart) {
|
||||
// $this->_writeRelationship(
|
||||
// $objWriter,
|
||||
// ++$d,
|
||||
@ -319,7 +319,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
@ -383,7 +383,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
|
@ -42,7 +42,7 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null){
|
||||
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null) {
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
@ -52,14 +52,14 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
$localRels=$pPHPExcel->getRibbonBinObjects('names');
|
||||
if(is_array($localRels)){
|
||||
foreach($localRels as $aId=>$aTarget){
|
||||
if (is_array($localRels)) {
|
||||
foreach ($localRels as $aId=>$aTarget) {
|
||||
$objWriter->startElement('Relationship');
|
||||
$objWriter->writeAttribute('Id', $aId);
|
||||
$objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image');
|
||||
|
@ -42,7 +42,7 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeVBARelationships(PHPExcel $pPHPExcel = null){
|
||||
public function writeVBARelationships(PHPExcel $pPHPExcel = null) {
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
@ -52,7 +52,7 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
|
@ -104,7 +104,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// String table
|
||||
$objWriter->startElement('sst');
|
||||
@ -254,7 +254,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
|
||||
// Underline
|
||||
$underlineType = $element->getFont()->getUnderline();
|
||||
switch($underlineType) {
|
||||
switch ($underlineType) {
|
||||
case 'single' :
|
||||
$underlineType = 'sng';
|
||||
break;
|
||||
|
@ -53,111 +53,111 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// styleSheet
|
||||
$objWriter->startElement('styleSheet');
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||
|
||||
// numFmts
|
||||
$objWriter->startElement('numFmts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count());
|
||||
// numFmts
|
||||
$objWriter->startElement('numFmts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count());
|
||||
|
||||
// numFmt
|
||||
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
|
||||
$this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
|
||||
}
|
||||
// numFmt
|
||||
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
|
||||
$this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// fonts
|
||||
$objWriter->startElement('fonts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count());
|
||||
// fonts
|
||||
$objWriter->startElement('fonts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count());
|
||||
|
||||
// font
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
|
||||
$this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
|
||||
}
|
||||
// font
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
|
||||
$this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// fills
|
||||
$objWriter->startElement('fills');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count());
|
||||
// fills
|
||||
$objWriter->startElement('fills');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count());
|
||||
|
||||
// fill
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
|
||||
$this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
|
||||
}
|
||||
// fill
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
|
||||
$this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// borders
|
||||
$objWriter->startElement('borders');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count());
|
||||
// borders
|
||||
$objWriter->startElement('borders');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count());
|
||||
|
||||
// border
|
||||
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
|
||||
$this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
|
||||
}
|
||||
// border
|
||||
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
|
||||
$this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// cellStyleXfs
|
||||
$objWriter->startElement('cellStyleXfs');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
// cellStyleXfs
|
||||
$objWriter->startElement('cellStyleXfs');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
|
||||
// xf
|
||||
$objWriter->startElement('xf');
|
||||
$objWriter->writeAttribute('numFmtId', 0);
|
||||
$objWriter->writeAttribute('fontId', 0);
|
||||
$objWriter->writeAttribute('fillId', 0);
|
||||
$objWriter->writeAttribute('borderId', 0);
|
||||
$objWriter->endElement();
|
||||
// xf
|
||||
$objWriter->startElement('xf');
|
||||
$objWriter->writeAttribute('numFmtId', 0);
|
||||
$objWriter->writeAttribute('fontId', 0);
|
||||
$objWriter->writeAttribute('fillId', 0);
|
||||
$objWriter->writeAttribute('borderId', 0);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// cellXfs
|
||||
$objWriter->startElement('cellXfs');
|
||||
$objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection()));
|
||||
// cellXfs
|
||||
$objWriter->startElement('cellXfs');
|
||||
$objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection()));
|
||||
|
||||
// xf
|
||||
foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
|
||||
$this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
|
||||
}
|
||||
// xf
|
||||
foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
|
||||
$this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// cellStyles
|
||||
$objWriter->startElement('cellStyles');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
// cellStyles
|
||||
$objWriter->startElement('cellStyles');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
|
||||
// cellStyle
|
||||
$objWriter->startElement('cellStyle');
|
||||
$objWriter->writeAttribute('name', 'Normal');
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('builtinId', 0);
|
||||
$objWriter->endElement();
|
||||
// cellStyle
|
||||
$objWriter->startElement('cellStyle');
|
||||
$objWriter->writeAttribute('name', 'Normal');
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('builtinId', 0);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// dxfs
|
||||
$objWriter->startElement('dxfs');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count());
|
||||
// dxfs
|
||||
$objWriter->startElement('dxfs');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count());
|
||||
|
||||
// dxf
|
||||
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
|
||||
$this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
|
||||
}
|
||||
// dxf
|
||||
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
|
||||
$this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// tableStyles
|
||||
$objWriter->startElement('tableStyles');
|
||||
$objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9');
|
||||
$objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1');
|
||||
$objWriter->endElement();
|
||||
// tableStyles
|
||||
$objWriter->startElement('tableStyles');
|
||||
$objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9');
|
||||
$objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -179,7 +179,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
|
||||
// Gradient fill
|
||||
$this->_writeGradientFill($objWriter, $pFill);
|
||||
} elseif($pFill->getFillType() !== NULL) {
|
||||
} elseif ($pFill->getFillType() !== null) {
|
||||
// Pattern fill
|
||||
$this->_writePatternFill($objWriter, $pFill);
|
||||
}
|
||||
@ -197,34 +197,34 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// fill
|
||||
$objWriter->startElement('fill');
|
||||
|
||||
// gradientFill
|
||||
$objWriter->startElement('gradientFill');
|
||||
$objWriter->writeAttribute('type', $pFill->getFillType());
|
||||
$objWriter->writeAttribute('degree', $pFill->getRotation());
|
||||
// gradientFill
|
||||
$objWriter->startElement('gradientFill');
|
||||
$objWriter->writeAttribute('type', $pFill->getFillType());
|
||||
$objWriter->writeAttribute('degree', $pFill->getRotation());
|
||||
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '0');
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '0');
|
||||
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '1');
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '1');
|
||||
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -241,28 +241,28 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// fill
|
||||
$objWriter->startElement('fill');
|
||||
|
||||
// patternFill
|
||||
$objWriter->startElement('patternFill');
|
||||
$objWriter->writeAttribute('patternType', $pFill->getFillType());
|
||||
// patternFill
|
||||
$objWriter->startElement('patternFill');
|
||||
$objWriter->writeAttribute('patternType', $pFill->getFillType());
|
||||
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// fgColor
|
||||
if ($pFill->getStartColor()->getARGB()) {
|
||||
$objWriter->startElement('fgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// bgColor
|
||||
if ($pFill->getEndColor()->getARGB()) {
|
||||
$objWriter->startElement('bgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// fgColor
|
||||
if ($pFill->getStartColor()->getARGB()) {
|
||||
$objWriter->startElement('fgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// bgColor
|
||||
if ($pFill->getEndColor()->getARGB()) {
|
||||
$objWriter->startElement('bgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -278,71 +278,71 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
{
|
||||
// font
|
||||
$objWriter->startElement('font');
|
||||
// Weird! The order of these elements actually makes a difference when opening Excel2007
|
||||
// files in Excel2003 with the compatibility pack. It's not documented behaviour,
|
||||
// and makes for a real WTF!
|
||||
// Weird! The order of these elements actually makes a difference when opening Excel2007
|
||||
// files in Excel2003 with the compatibility pack. It's not documented behaviour,
|
||||
// and makes for a real WTF!
|
||||
|
||||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
|
||||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
|
||||
// formatting style dialog
|
||||
if ($pFont->getBold() !== NULL) {
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
|
||||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
|
||||
// formatting style dialog
|
||||
if ($pFont->getBold() !== null) {
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Italic
|
||||
if ($pFont->getItalic() !== NULL) {
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Italic
|
||||
if ($pFont->getItalic() !== null) {
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Strikethrough
|
||||
if ($pFont->getStrikethrough() !== NULL) {
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Strikethrough
|
||||
if ($pFont->getStrikethrough() !== null) {
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Underline
|
||||
if ($pFont->getUnderline() !== NULL) {
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Underline
|
||||
if ($pFont->getUnderline() !== null) {
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Superscript / subscript
|
||||
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
|
||||
$objWriter->startElement('vertAlign');
|
||||
if ($pFont->getSuperScript() === TRUE) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($pFont->getSubScript() === TRUE) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
// Superscript / subscript
|
||||
if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) {
|
||||
$objWriter->startElement('vertAlign');
|
||||
if ($pFont->getSuperScript() === true) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($pFont->getSubScript() === true) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Size
|
||||
if ($pFont->getSize() !== NULL) {
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Size
|
||||
if ($pFont->getSize() !== null) {
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Foreground color
|
||||
if ($pFont->getColor()->getARGB() !== NULL) {
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Foreground color
|
||||
if ($pFont->getColor()->getARGB() !== null) {
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Name
|
||||
if ($pFont->getName() !== NULL) {
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Name
|
||||
if ($pFont->getName() !== null) {
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -358,28 +358,28 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
{
|
||||
// Write border
|
||||
$objWriter->startElement('border');
|
||||
// Diagonal?
|
||||
switch ($pBorders->getDiagonalDirection()) {
|
||||
case PHPExcel_Style_Borders::DIAGONAL_UP:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'false');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_DOWN:
|
||||
$objWriter->writeAttribute('diagonalUp', 'false');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_BOTH:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
}
|
||||
// Diagonal?
|
||||
switch ($pBorders->getDiagonalDirection()) {
|
||||
case PHPExcel_Style_Borders::DIAGONAL_UP:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'false');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_DOWN:
|
||||
$objWriter->writeAttribute('diagonalUp', 'false');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_BOTH:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
}
|
||||
|
||||
// BorderPr
|
||||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
|
||||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
|
||||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
|
||||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
|
||||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
|
||||
// BorderPr
|
||||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
|
||||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
|
||||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
|
||||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
|
||||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -395,66 +395,66 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
{
|
||||
// xf
|
||||
$objWriter->startElement('xf');
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
|
||||
if ($pStyle->getQuotePrefix()) {
|
||||
$objWriter->writeAttribute('quotePrefix', 1);
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
|
||||
if ($pStyle->getQuotePrefix()) {
|
||||
$objWriter->writeAttribute('quotePrefix', 1);
|
||||
}
|
||||
|
||||
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
|
||||
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
|
||||
} else {
|
||||
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
|
||||
$objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
|
||||
|
||||
// Apply styles?
|
||||
$objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('applyProtection', 'true');
|
||||
}
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
|
||||
$objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
|
||||
|
||||
if ($pStyle->getAlignment()->getIndent() > 0) {
|
||||
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getReadorder() > 0) {
|
||||
$objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder());
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// protection
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
|
||||
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
|
||||
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
|
||||
} else {
|
||||
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
|
||||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
|
||||
$objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
|
||||
|
||||
// Apply styles?
|
||||
$objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('applyProtection', 'true');
|
||||
}
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
|
||||
$objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
|
||||
|
||||
if ($pStyle->getAlignment()->getIndent() > 0) {
|
||||
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getReadorder() > 0) {
|
||||
$objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder());
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// protection
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -471,55 +471,54 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// dxf
|
||||
$objWriter->startElement('dxf');
|
||||
|
||||
// font
|
||||
$this->_writeFont($objWriter, $pStyle->getFont());
|
||||
// font
|
||||
$this->_writeFont($objWriter, $pStyle->getFont());
|
||||
|
||||
// numFmt
|
||||
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
|
||||
// numFmt
|
||||
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
|
||||
|
||||
// fill
|
||||
$this->_writeFill($objWriter, $pStyle->getFill());
|
||||
// fill
|
||||
$this->_writeFill($objWriter, $pStyle->getFill());
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getVertical() !== NULL) {
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
}
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== null) {
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getVertical() !== null) {
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
}
|
||||
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// border
|
||||
$this->_writeBorder($objWriter, $pStyle->getBorders());
|
||||
|
||||
// protection
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) ||
|
||||
($pStyle->getProtection()->getHidden() !== NULL)) {
|
||||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) &&
|
||||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if (($pStyle->getProtection()->getHidden() !== NULL) &&
|
||||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== null) {
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// border
|
||||
$this->_writeBorder($objWriter, $pStyle->getBorders());
|
||||
|
||||
// protection
|
||||
if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) {
|
||||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if (($pStyle->getProtection()->getLocked() !== null) &&
|
||||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if (($pStyle->getProtection()->getHidden() !== null) &&
|
||||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -537,12 +536,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// Write BorderPr
|
||||
if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) {
|
||||
$objWriter->startElement($pName);
|
||||
$objWriter->writeAttribute('style', $pBorder->getBorderStyle());
|
||||
$objWriter->writeAttribute('style', $pBorder->getBorderStyle());
|
||||
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -562,10 +561,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$formatCode = $pNumberFormat->getFormatCode();
|
||||
|
||||
// numFmt
|
||||
if ($formatCode !== NULL) {
|
||||
if ($formatCode !== null) {
|
||||
$objWriter->startElement('numFmt');
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
@ -579,9 +578,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
*/
|
||||
public function allStyles(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$aStyles = $pPHPExcel->getCellXfCollection();
|
||||
|
||||
return $aStyles;
|
||||
return $pPHPExcel->getCellXfCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -594,7 +591,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allConditionalStyles(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of all styles
|
||||
$aStyles = array();
|
||||
$aStyles = array();
|
||||
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
@ -618,7 +615,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allFills(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique fills
|
||||
$aFills = array();
|
||||
$aFills = array();
|
||||
|
||||
// Two first fills are predefined
|
||||
$fill0 = new PHPExcel_Style_Fill();
|
||||
@ -629,7 +626,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125);
|
||||
$aFills[] = $fill1;
|
||||
// The remaining fills
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
foreach ($aStyles as $style) {
|
||||
if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) {
|
||||
$aFills[ $style->getFill()->getHashCode() ] = $style->getFill();
|
||||
@ -649,8 +646,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allFonts(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique fonts
|
||||
$aFonts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aFonts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
|
||||
foreach ($aStyles as $style) {
|
||||
if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) {
|
||||
@ -671,8 +668,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allBorders(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique borders
|
||||
$aBorders = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aBorders = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
|
||||
foreach ($aStyles as $style) {
|
||||
if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) {
|
||||
@ -693,8 +690,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allNumberFormats(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique number formats
|
||||
$aNumFmts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aNumFmts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
|
||||
foreach ($aStyles as $style) {
|
||||
if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) {
|
||||
|
@ -41,37 +41,37 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
*
|
||||
*/
|
||||
private static $_majorFonts = array(
|
||||
'Jpan' => 'MS Pゴシック',
|
||||
'Hang' => '맑은 고딕',
|
||||
'Hans' => '宋体',
|
||||
'Hant' => '新細明體',
|
||||
'Arab' => 'Times New Roman',
|
||||
'Hebr' => 'Times New Roman',
|
||||
'Thai' => 'Tahoma',
|
||||
'Ethi' => 'Nyala',
|
||||
'Beng' => 'Vrinda',
|
||||
'Gujr' => 'Shruti',
|
||||
'Khmr' => 'MoolBoran',
|
||||
'Knda' => 'Tunga',
|
||||
'Guru' => 'Raavi',
|
||||
'Cans' => 'Euphemia',
|
||||
'Cher' => 'Plantagenet Cherokee',
|
||||
'Yiii' => 'Microsoft Yi Baiti',
|
||||
'Tibt' => 'Microsoft Himalaya',
|
||||
'Thaa' => 'MV Boli',
|
||||
'Deva' => 'Mangal',
|
||||
'Telu' => 'Gautami',
|
||||
'Taml' => 'Latha',
|
||||
'Syrc' => 'Estrangelo Edessa',
|
||||
'Orya' => 'Kalinga',
|
||||
'Mlym' => 'Kartika',
|
||||
'Laoo' => 'DokChampa',
|
||||
'Sinh' => 'Iskoola Pota',
|
||||
'Mong' => 'Mongolian Baiti',
|
||||
'Viet' => 'Times New Roman',
|
||||
'Uigh' => 'Microsoft Uighur',
|
||||
'Geor' => 'Sylfaen',
|
||||
);
|
||||
'Jpan' => 'MS Pゴシック',
|
||||
'Hang' => '맑은 고딕',
|
||||
'Hans' => '宋体',
|
||||
'Hant' => '新細明體',
|
||||
'Arab' => 'Times New Roman',
|
||||
'Hebr' => 'Times New Roman',
|
||||
'Thai' => 'Tahoma',
|
||||
'Ethi' => 'Nyala',
|
||||
'Beng' => 'Vrinda',
|
||||
'Gujr' => 'Shruti',
|
||||
'Khmr' => 'MoolBoran',
|
||||
'Knda' => 'Tunga',
|
||||
'Guru' => 'Raavi',
|
||||
'Cans' => 'Euphemia',
|
||||
'Cher' => 'Plantagenet Cherokee',
|
||||
'Yiii' => 'Microsoft Yi Baiti',
|
||||
'Tibt' => 'Microsoft Himalaya',
|
||||
'Thaa' => 'MV Boli',
|
||||
'Deva' => 'Mangal',
|
||||
'Telu' => 'Gautami',
|
||||
'Taml' => 'Latha',
|
||||
'Syrc' => 'Estrangelo Edessa',
|
||||
'Orya' => 'Kalinga',
|
||||
'Mlym' => 'Kartika',
|
||||
'Laoo' => 'DokChampa',
|
||||
'Sinh' => 'Iskoola Pota',
|
||||
'Mong' => 'Mongolian Baiti',
|
||||
'Viet' => 'Times New Roman',
|
||||
'Uigh' => 'Microsoft Uighur',
|
||||
'Geor' => 'Sylfaen',
|
||||
);
|
||||
|
||||
/**
|
||||
* Map of Minor fonts to write
|
||||
@ -79,55 +79,55 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
*
|
||||
*/
|
||||
private static $_minorFonts = array(
|
||||
'Jpan' => 'MS Pゴシック',
|
||||
'Hang' => '맑은 고딕',
|
||||
'Hans' => '宋体',
|
||||
'Hant' => '新細明體',
|
||||
'Arab' => 'Arial',
|
||||
'Hebr' => 'Arial',
|
||||
'Thai' => 'Tahoma',
|
||||
'Ethi' => 'Nyala',
|
||||
'Beng' => 'Vrinda',
|
||||
'Gujr' => 'Shruti',
|
||||
'Khmr' => 'DaunPenh',
|
||||
'Knda' => 'Tunga',
|
||||
'Guru' => 'Raavi',
|
||||
'Cans' => 'Euphemia',
|
||||
'Cher' => 'Plantagenet Cherokee',
|
||||
'Yiii' => 'Microsoft Yi Baiti',
|
||||
'Tibt' => 'Microsoft Himalaya',
|
||||
'Thaa' => 'MV Boli',
|
||||
'Deva' => 'Mangal',
|
||||
'Telu' => 'Gautami',
|
||||
'Taml' => 'Latha',
|
||||
'Syrc' => 'Estrangelo Edessa',
|
||||
'Orya' => 'Kalinga',
|
||||
'Mlym' => 'Kartika',
|
||||
'Laoo' => 'DokChampa',
|
||||
'Sinh' => 'Iskoola Pota',
|
||||
'Mong' => 'Mongolian Baiti',
|
||||
'Viet' => 'Arial',
|
||||
'Uigh' => 'Microsoft Uighur',
|
||||
'Geor' => 'Sylfaen',
|
||||
);
|
||||
'Jpan' => 'MS Pゴシック',
|
||||
'Hang' => '맑은 고딕',
|
||||
'Hans' => '宋体',
|
||||
'Hant' => '新細明體',
|
||||
'Arab' => 'Arial',
|
||||
'Hebr' => 'Arial',
|
||||
'Thai' => 'Tahoma',
|
||||
'Ethi' => 'Nyala',
|
||||
'Beng' => 'Vrinda',
|
||||
'Gujr' => 'Shruti',
|
||||
'Khmr' => 'DaunPenh',
|
||||
'Knda' => 'Tunga',
|
||||
'Guru' => 'Raavi',
|
||||
'Cans' => 'Euphemia',
|
||||
'Cher' => 'Plantagenet Cherokee',
|
||||
'Yiii' => 'Microsoft Yi Baiti',
|
||||
'Tibt' => 'Microsoft Himalaya',
|
||||
'Thaa' => 'MV Boli',
|
||||
'Deva' => 'Mangal',
|
||||
'Telu' => 'Gautami',
|
||||
'Taml' => 'Latha',
|
||||
'Syrc' => 'Estrangelo Edessa',
|
||||
'Orya' => 'Kalinga',
|
||||
'Mlym' => 'Kartika',
|
||||
'Laoo' => 'DokChampa',
|
||||
'Sinh' => 'Iskoola Pota',
|
||||
'Mong' => 'Mongolian Baiti',
|
||||
'Viet' => 'Arial',
|
||||
'Uigh' => 'Microsoft Uighur',
|
||||
'Geor' => 'Sylfaen',
|
||||
);
|
||||
|
||||
/**
|
||||
* Map of core colours
|
||||
* @static array of string
|
||||
*
|
||||
*/
|
||||
private static $_colourScheme = array(
|
||||
'dk2' => '1F497D',
|
||||
'lt2' => 'EEECE1',
|
||||
'accent1' => '4F81BD',
|
||||
'accent2' => 'C0504D',
|
||||
'accent3' => '9BBB59',
|
||||
'accent4' => '8064A2',
|
||||
'accent5' => '4BACC6',
|
||||
'accent6' => 'F79646',
|
||||
'hlink' => '0000FF',
|
||||
'folHlink' => '800080',
|
||||
);
|
||||
private static $_colourScheme = array(
|
||||
'dk2' => '1F497D',
|
||||
'lt2' => 'EEECE1',
|
||||
'accent1' => '4F81BD',
|
||||
'accent2' => 'C0504D',
|
||||
'accent3' => '9BBB59',
|
||||
'accent4' => '8064A2',
|
||||
'accent5' => '4BACC6',
|
||||
'accent6' => 'F79646',
|
||||
'hlink' => '0000FF',
|
||||
'folHlink' => '800080',
|
||||
);
|
||||
|
||||
/**
|
||||
* Write theme to XML format
|
||||
@ -147,7 +147,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// a:theme
|
||||
$objWriter->startElement('a:theme');
|
||||
@ -839,13 +839,12 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$objWriter->writeAttribute('typeface', '');
|
||||
$objWriter->endElement();
|
||||
|
||||
foreach($fontSet as $fontScript => $typeface) {
|
||||
foreach ($fontSet as $fontScript => $typeface) {
|
||||
$objWriter->startElement('a:font');
|
||||
$objWriter->writeAttribute('script', $fontScript);
|
||||
$objWriter->writeAttribute('typeface', $typeface);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -857,7 +856,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
*/
|
||||
private function _writeColourScheme($objWriter)
|
||||
{
|
||||
foreach(self::$_colourScheme as $colourName => $colourValue) {
|
||||
foreach (self::$_colourScheme as $colourName => $colourValue) {
|
||||
$objWriter->startElement('a:'.$colourName);
|
||||
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
@ -866,6 +865,5 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE)
|
||||
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -54,7 +54,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// workbook
|
||||
$objWriter->startElement('workbook');
|
||||
@ -62,28 +62,28 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
||||
|
||||
// fileVersion
|
||||
$this->_writeFileVersion($objWriter);
|
||||
// fileVersion
|
||||
$this->_writeFileVersion($objWriter);
|
||||
|
||||
// workbookPr
|
||||
$this->_writeWorkbookPr($objWriter);
|
||||
// workbookPr
|
||||
$this->_writeWorkbookPr($objWriter);
|
||||
|
||||
// workbookProtection
|
||||
$this->_writeWorkbookProtection($objWriter, $pPHPExcel);
|
||||
// workbookProtection
|
||||
$this->_writeWorkbookProtection($objWriter, $pPHPExcel);
|
||||
|
||||
// bookViews
|
||||
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
|
||||
$this->_writeBookViews($objWriter, $pPHPExcel);
|
||||
}
|
||||
// bookViews
|
||||
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
|
||||
$this->_writeBookViews($objWriter, $pPHPExcel);
|
||||
}
|
||||
|
||||
// sheets
|
||||
$this->_writeSheets($objWriter, $pPHPExcel);
|
||||
// sheets
|
||||
$this->_writeSheets($objWriter, $pPHPExcel);
|
||||
|
||||
// definedNames
|
||||
$this->_writeDefinedNames($objWriter, $pPHPExcel);
|
||||
// definedNames
|
||||
$this->_writeDefinedNames($objWriter, $pPHPExcel);
|
||||
|
||||
// calcPr
|
||||
$this->_writeCalcPr($objWriter,$recalcRequired);
|
||||
// calcPr
|
||||
$this->_writeCalcPr($objWriter, $recalcRequired);
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -138,20 +138,20 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
// bookViews
|
||||
$objWriter->startElement('bookViews');
|
||||
|
||||
// workbookView
|
||||
$objWriter->startElement('workbookView');
|
||||
// workbookView
|
||||
$objWriter->startElement('workbookView');
|
||||
|
||||
$objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
|
||||
$objWriter->writeAttribute('autoFilterDateGrouping', '1');
|
||||
$objWriter->writeAttribute('firstSheet', '0');
|
||||
$objWriter->writeAttribute('minimized', '0');
|
||||
$objWriter->writeAttribute('showHorizontalScroll', '1');
|
||||
$objWriter->writeAttribute('showSheetTabs', '1');
|
||||
$objWriter->writeAttribute('showVerticalScroll', '1');
|
||||
$objWriter->writeAttribute('tabRatio', '600');
|
||||
$objWriter->writeAttribute('visibility', 'visible');
|
||||
$objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
|
||||
$objWriter->writeAttribute('autoFilterDateGrouping', '1');
|
||||
$objWriter->writeAttribute('firstSheet', '0');
|
||||
$objWriter->writeAttribute('minimized', '0');
|
||||
$objWriter->writeAttribute('showHorizontalScroll', '1');
|
||||
$objWriter->writeAttribute('showSheetTabs', '1');
|
||||
$objWriter->writeAttribute('showVerticalScroll', '1');
|
||||
$objWriter->writeAttribute('tabRatio', '600');
|
||||
$objWriter->writeAttribute('visibility', 'visible');
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -167,16 +167,16 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
{
|
||||
if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
|
||||
$objWriter->startElement('workbookProtection');
|
||||
$objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
|
||||
|
||||
if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') {
|
||||
$objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
|
||||
$objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
|
||||
}
|
||||
|
||||
if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') {
|
||||
$objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
|
||||
$objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
@ -190,18 +190,18 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
* @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE)
|
||||
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true)
|
||||
{
|
||||
$objWriter->startElement('calcPr');
|
||||
|
||||
// Set the calcid to a higher value than Excel itself will use, otherwise Excel will always recalc
|
||||
// If MS Excel does do a recalc, then users opening a file in MS Excel will be prompted to save on exit
|
||||
// because the file has changed
|
||||
$objWriter->writeAttribute('calcId', '999999');
|
||||
$objWriter->writeAttribute('calcMode', 'auto');
|
||||
$objWriter->writeAttribute('calcId', '999999');
|
||||
$objWriter->writeAttribute('calcMode', 'auto');
|
||||
// fullCalcOnLoad isn't needed if we've recalculating for the save
|
||||
$objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0);
|
||||
$objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1);
|
||||
$objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0);
|
||||
$objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1);
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -247,12 +247,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
if ($pSheetname != '') {
|
||||
// Write sheet
|
||||
$objWriter->startElement('sheet');
|
||||
$objWriter->writeAttribute('name', $pSheetname);
|
||||
$objWriter->writeAttribute('sheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('name', $pSheetname);
|
||||
$objWriter->writeAttribute('sheetId', $pSheetId);
|
||||
if ($sheetState != 'visible' && $sheetState != '') {
|
||||
$objWriter->writeAttribute('state', $sheetState);
|
||||
}
|
||||
$objWriter->writeAttribute('r:id', 'rId' . $pRelId);
|
||||
$objWriter->writeAttribute('r:id', 'rId' . $pRelId);
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
|
||||
@ -320,9 +320,9 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
{
|
||||
// definedName for named range
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', $pNamedRange->getName());
|
||||
$objWriter->writeAttribute('name', $pNamedRange->getName());
|
||||
if ($pNamedRange->getLocalOnly()) {
|
||||
$objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
|
||||
$objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
|
||||
}
|
||||
|
||||
// Create absolute coordinate and write as raw text
|
||||
@ -354,16 +354,16 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
|
||||
if (!empty($autoFilterRange)) {
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('hidden', '1');
|
||||
$objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('hidden', '1');
|
||||
|
||||
// Create absolute coordinate and write as raw text
|
||||
$range = PHPExcel_Cell::splitRange($autoFilterRange);
|
||||
$range = $range[0];
|
||||
// Strip any worksheet ref so we can make the cell ref absolute
|
||||
if (strpos($range[0],'!') !== false) {
|
||||
list($ws,$range[0]) = explode('!',$range[0]);
|
||||
list($ws, $range[0]) = explode('!', $range[0]);
|
||||
}
|
||||
|
||||
$range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]);
|
||||
@ -389,8 +389,8 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
// definedName for PrintTitles
|
||||
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Titles');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Titles');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
|
||||
// Setting string
|
||||
$settingString = '';
|
||||
@ -432,8 +432,8 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
// definedName for PrintArea
|
||||
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Area');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Area');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
|
||||
// Setting string
|
||||
$settingString = '';
|
||||
|
@ -56,7 +56,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Worksheet
|
||||
$objWriter->startElement('worksheet');
|
||||
@ -148,8 +148,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// sheetPr
|
||||
$objWriter->startElement('sheetPr');
|
||||
//$objWriter->writeAttribute('codeName', $pSheet->getTitle());
|
||||
if($pSheet->getParent()->hasMacros()){//if the workbook have macros, we need to have codeName for the sheet
|
||||
if($pSheet->hasCodeName()==false){
|
||||
if ($pSheet->getParent()->hasMacros()) {//if the workbook have macros, we need to have codeName for the sheet
|
||||
if ($pSheet->hasCodeName()==false) {
|
||||
$pSheet->setCodeName($pSheet->getTitle());
|
||||
}
|
||||
$objWriter->writeAttribute('codeName', $pSheet->getCodeName());
|
||||
@ -758,15 +758,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$range = $range[0];
|
||||
// Strip any worksheet ref
|
||||
if (strpos($range[0],'!') !== false) {
|
||||
list($ws,$range[0]) = explode('!',$range[0]);
|
||||
list($ws, $range[0]) = explode('!', $range[0]);
|
||||
}
|
||||
$range = implode(':', $range);
|
||||
|
||||
$objWriter->writeAttribute('ref', str_replace('$','',$range));
|
||||
$objWriter->writeAttribute('ref', str_replace('$','', $range));
|
||||
|
||||
$columns = $pSheet->getAutoFilter()->getColumns();
|
||||
if (count($columns > 0)) {
|
||||
foreach($columns as $columnID => $column) {
|
||||
foreach ($columns as $columnID => $column) {
|
||||
$rules = $column->getRules();
|
||||
if (count($rules > 0)) {
|
||||
$objWriter->startElement('filterColumn');
|
||||
@ -783,7 +783,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
($rule->getValue() === '')) {
|
||||
// Filter rule for Blanks
|
||||
$objWriter->writeAttribute('blank', 1);
|
||||
} elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
|
||||
// Dynamic Filter Rule
|
||||
$objWriter->writeAttribute('type', $rule->getGrouping());
|
||||
$val = $column->getAttribute('val');
|
||||
@ -794,7 +794,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
if ($maxVal !== NULL) {
|
||||
$objWriter->writeAttribute('maxVal', $maxVal);
|
||||
}
|
||||
} elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
|
||||
// Top 10 Filter Rule
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
|
||||
@ -808,7 +808,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
}
|
||||
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
|
||||
// Date Group filters
|
||||
foreach($rule->getValue() as $key => $value) {
|
||||
foreach ($rule->getValue() as $key => $value) {
|
||||
if ($value > '') $objWriter->writeAttribute($key, $value);
|
||||
}
|
||||
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
|
||||
@ -979,7 +979,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
}
|
||||
|
||||
$currentRow = 0;
|
||||
while($currentRow++ < $highestRow) {
|
||||
while ($currentRow++ < $highestRow) {
|
||||
// Get row dimension
|
||||
$rowDimension = $pSheet->getRowDimension($currentRow);
|
||||
|
||||
@ -1026,7 +1026,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
|
||||
// Write cells
|
||||
if (isset($cellsByRow[$currentRow])) {
|
||||
foreach($cellsByRow[$currentRow] as $cellAddress) {
|
||||
foreach ($cellsByRow[$currentRow] as $cellAddress) {
|
||||
// Write cell
|
||||
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
|
||||
}
|
||||
@ -1115,7 +1115,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
break;
|
||||
case 'f': // Formula
|
||||
$attributes = $pCell->getFormulaAttributes();
|
||||
if($attributes['t'] == 'array') {
|
||||
if ($attributes['t'] == 'array') {
|
||||
$objWriter->startElement('f');
|
||||
$objWriter->writeAttribute('t', 'array');
|
||||
$objWriter->writeAttribute('ref', $pCellAddress);
|
||||
|
@ -333,7 +333,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$iNumColEnd = $rangeBounds[1][0];
|
||||
|
||||
$iInc = $iNumColStart;
|
||||
while($iInc <= $iNumColEnd) {
|
||||
while ($iInc <= $iNumColEnd) {
|
||||
++$countShapes[$sheetIndex];
|
||||
|
||||
// create an Drawing Object for the dropdown
|
||||
@ -679,21 +679,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
} elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
if ($dataProp['data']['data'] == false) {
|
||||
$dataSection_Content .= pack('V', 0x0000);
|
||||
} else {
|
||||
$dataSection_Content .= pack('V', 0x0001);
|
||||
}
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
@ -705,13 +702,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Data Type Not Used at the moment
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
@ -867,13 +862,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
@ -885,13 +878,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Data Type Not Used at the moment
|
||||
}
|
||||
}
|
||||
|
@ -1097,7 +1097,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
*/
|
||||
private function _match($token)
|
||||
{
|
||||
switch($token) {
|
||||
switch ($token) {
|
||||
case "+":
|
||||
case "-":
|
||||
case "*":
|
||||
@ -1183,7 +1183,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
}
|
||||
// It's an argument of some description (e.g. a named range),
|
||||
// precise nature yet to be determined
|
||||
elseif(substr($token,-1) == ')') {
|
||||
elseif (substr($token,-1) == ')') {
|
||||
return $token;
|
||||
}
|
||||
return '';
|
||||
@ -1425,7 +1425,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
// If it's a number or a percent
|
||||
elseif (is_numeric($this->_current_token))
|
||||
{
|
||||
if($this->_lookahead == '%'){
|
||||
if ($this->_lookahead == '%') {
|
||||
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
|
||||
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
|
||||
} else {
|
||||
|
@ -1275,7 +1275,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
// Pack the RGB data
|
||||
foreach ($aref as $color) {
|
||||
foreach ($color as $byte) {
|
||||
$data .= pack("C",$byte);
|
||||
$data .= pack("C", $byte);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user