Merge branch 'psr2' into develop

This commit is contained in:
MarkBaker 2015-05-15 23:42:53 +01:00
commit 2af5e55f2c
46 changed files with 2909 additions and 2706 deletions

View File

@ -83,7 +83,7 @@ class PHPExcel_Calculation
* @access private
* @var PHPExcel_Calculation
*/
private static $_instance;
private static $instance;
/**
@ -92,7 +92,7 @@ class PHPExcel_Calculation
* @access private
* @var PHPExcel
*/
private $_workbook;
private $workbook;
/**
* List of instances of the calculation engine that we've instantiated for individual workbooks
@ -100,7 +100,7 @@ class PHPExcel_Calculation
* @access private
* @var PHPExcel_Calculation[]
*/
private static $_workbookSets;
private static $workbookSets;
/**
* Calculation cache
@ -108,7 +108,7 @@ class PHPExcel_Calculation
* @access private
* @var array
*/
private $_calculationCache = array ();
private $calculationCache = array ();
/**
@ -117,7 +117,7 @@ class PHPExcel_Calculation
* @access private
* @var boolean
*/
private $_calculationCacheEnabled = true;
private $calculationCacheEnabled = true;
/**
@ -127,7 +127,7 @@ class PHPExcel_Calculation
* @access private
* @var array
*/
private static $_operators = array(
private static $operators = array(
'+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '%' => false, '~' => false,
'>' => true, '<' => true, '=' => true, '>=' => true,
@ -140,7 +140,7 @@ class PHPExcel_Calculation
* @access private
* @var array
*/
private static $_binaryOperators = array(
private static $binaryOperators = array(
'+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '>' => true, '<' => true,
'=' => true, '>=' => true, '<=' => true, '<>' => true,
@ -183,9 +183,9 @@ class PHPExcel_Calculation
* @var array of string
*
*/
private $_cyclicReferenceStack;
private $cyclicReferenceStack;
private $_cellStack = array();
private $cellStack = array();
/**
* Current iteration counter for cyclic formulae
@ -195,9 +195,9 @@ class PHPExcel_Calculation
* @var integer
*
*/
private $_cyclicFormulaCount = 1;
private $cyclicFormulaCounter = 1;
private $_cyclicFormulaCell = '';
private $cyclicFormulaCell = '';
/**
* Number of iterations for cyclic formulae
@ -213,7 +213,7 @@ class PHPExcel_Calculation
* @var integer
*
*/
private $_savedPrecision = 14;
private $savedPrecision = 14;
/**
@ -222,7 +222,7 @@ class PHPExcel_Calculation
* @var string
*
*/
private static $_localeLanguage = 'en_us'; // US English (default locale)
private static $localeLanguage = 'en_us'; // US English (default locale)
/**
* List of available locale settings
@ -231,7 +231,7 @@ class PHPExcel_Calculation
* @var string[]
*
*/
private static $_validLocaleLanguages = array(
private static $validLocaleLanguages = array(
'en' // English (default language)
);
@ -241,8 +241,8 @@ class PHPExcel_Calculation
* @var string
*
*/
private static $_localeArgumentSeparator = ',';
private static $_localeFunctions = array();
private static $localeArgumentSeparator = ',';
private static $localeFunctions = array();
/**
* Locale-specific translations for Excel constants (True, False and Null)
@ -250,10 +250,10 @@ class PHPExcel_Calculation
* @var string[]
*
*/
public static $_localeBoolean = array(
'TRUE' => 'TRUE',
'FALSE' => 'FALSE',
'NULL' => 'NULL'
public static $localeBoolean = array(
'TRUE' => 'TRUE',
'FALSE' => 'FALSE',
'NULL' => 'NULL'
);
/**
@ -263,14 +263,14 @@ class PHPExcel_Calculation
* @var string[]
*
*/
private static $_ExcelConstants = array(
'TRUE' => true,
'FALSE' => false,
'NULL' => null
private static $excelConstants = array(
'TRUE' => true,
'FALSE' => false,
'NULL' => null
);
// PHPExcel functions
private static $_PHPExcelFunctions = array( // PHPExcel functions
private static $PHPExcelFunctions = array( // PHPExcel functions
'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'abs',
'argumentCount' => '1'
@ -1705,7 +1705,7 @@ class PHPExcel_Calculation
// Internal functions used for special control purposes
private static $_controlFunctions = array(
private static $controlFunctions = array(
'MKMATRIX' => array(
'argumentCount' => '*',
'functionCall' => 'self::_mkMatrix'
@ -1716,26 +1716,26 @@ class PHPExcel_Calculation
private function __construct(PHPExcel $workbook = null)
{
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
$this->_savedPrecision = ini_get('precision');
if ($this->_savedPrecision < $setPrecision) {
$this->savedPrecision = ini_get('precision');
if ($this->savedPrecision < $setPrecision) {
ini_set('precision', $setPrecision);
}
$this->delta = 1 * pow(10, -$setPrecision);
if ($workbook !== null) {
self::$_workbookSets[$workbook->getID()] = $this;
self::$workbookSets[$workbook->getID()] = $this;
}
$this->_workbook = $workbook;
$this->_cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->_cyclicReferenceStack);
$this->workbook = $workbook;
$this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
}
public function __destruct()
{
if ($this->_savedPrecision != ini_get('precision')) {
ini_set('precision', $this->_savedPrecision);
if ($this->savedPrecision != ini_get('precision')) {
ini_set('precision', $this->savedPrecision);
}
}
@ -1745,7 +1745,7 @@ class PHPExcel_Calculation
foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
$filename = substr($filename, strlen($localeFileDirectory)+1);
if ($filename != 'en') {
self::$_validLocaleLanguages[] = $filename;
self::$validLocaleLanguages[] = $filename;
}
}
}
@ -1761,17 +1761,17 @@ class PHPExcel_Calculation
public static function getInstance(PHPExcel $workbook = null)
{
if ($workbook !== null) {
if (isset(self::$_workbookSets[$workbook->getID()])) {
return self::$_workbookSets[$workbook->getID()];
if (isset(self::$workbookSets[$workbook->getID()])) {
return self::$workbookSets[$workbook->getID()];
}
return new PHPExcel_Calculation($workbook);
}
if (!isset(self::$_instance) || (self::$_instance === null)) {
self::$_instance = new PHPExcel_Calculation();
if (!isset(self::$instance) || (self::$instance === null)) {
self::$instance = new PHPExcel_Calculation();
}
return self::$_instance;
return self::$instance;
}
/**
@ -1783,8 +1783,8 @@ class PHPExcel_Calculation
public static function unsetInstance(PHPExcel $workbook = null)
{
if ($workbook !== null) {
if (isset(self::$_workbookSets[$workbook->getID()])) {
unset(self::$_workbookSets[$workbook->getID()]);
if (isset(self::$workbookSets[$workbook->getID()])) {
unset(self::$workbookSets[$workbook->getID()]);
}
}
}
@ -1833,7 +1833,7 @@ class PHPExcel_Calculation
*/
public static function getTRUE()
{
return self::$_localeBoolean['TRUE'];
return self::$localeBoolean['TRUE'];
}
/**
@ -1844,7 +1844,7 @@ class PHPExcel_Calculation
*/
public static function getFALSE()
{
return self::$_localeBoolean['FALSE'];
return self::$localeBoolean['FALSE'];
}
/**
@ -1886,7 +1886,7 @@ class PHPExcel_Calculation
*/
public function getCalculationCacheEnabled()
{
return $this->_calculationCacheEnabled;
return $this->calculationCacheEnabled;
}
/**
@ -1897,7 +1897,7 @@ class PHPExcel_Calculation
*/
public function setCalculationCacheEnabled($pValue = true)
{
$this->_calculationCacheEnabled = $pValue;
$this->calculationCacheEnabled = $pValue;
$this->clearCalculationCache();
}
@ -1925,7 +1925,7 @@ class PHPExcel_Calculation
*/
public function clearCalculationCache()
{
$this->_calculationCache = array();
$this->calculationCache = array();
}
/**
@ -1935,8 +1935,8 @@ class PHPExcel_Calculation
*/
public function clearCalculationCacheForWorksheet($worksheetName)
{
if (isset($this->_calculationCache[$worksheetName])) {
unset($this->_calculationCache[$worksheetName]);
if (isset($this->calculationCache[$worksheetName])) {
unset($this->calculationCache[$worksheetName]);
}
}
@ -1948,9 +1948,9 @@ class PHPExcel_Calculation
*/
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
{
if (isset($this->_calculationCache[$fromWorksheetName])) {
$this->_calculationCache[$toWorksheetName] = &$this->_calculationCache[$fromWorksheetName];
unset($this->_calculationCache[$fromWorksheetName]);
if (isset($this->calculationCache[$fromWorksheetName])) {
$this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
unset($this->calculationCache[$fromWorksheetName]);
}
}
@ -1962,7 +1962,7 @@ class PHPExcel_Calculation
*/
public function getLocale()
{
return self::$_localeLanguage;
return self::$localeLanguage;
}
@ -1980,15 +1980,15 @@ class PHPExcel_Calculation
list($language) = explode('_', $locale);
}
if (count(self::$_validLocaleLanguages) == 1) {
if (count(self::$validLocaleLanguages) == 1) {
self::_loadLocales();
}
// Test whether we have any language data for this language (any locale)
if (in_array($language, self::$_validLocaleLanguages)) {
if (in_array($language, self::$validLocaleLanguages)) {
// initialise language/locale settings
self::$_localeFunctions = array();
self::$_localeArgumentSeparator = ',';
self::$_localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
self::$localeFunctions = array();
self::$localeArgumentSeparator = ',';
self::$localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
// 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
@ -2008,17 +2008,17 @@ class PHPExcel_Calculation
list($fName, $lfName) = explode('=', $localeFunction);
$fName = trim($fName);
$lfName = trim($lfName);
if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
self::$_localeFunctions[$fName] = $lfName;
if ((isset(self::$PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
self::$localeFunctions[$fName] = $lfName;
}
}
}
// Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
if (isset(self::$_localeFunctions['TRUE'])) {
self::$_localeBoolean['TRUE'] = self::$_localeFunctions['TRUE'];
if (isset(self::$localeFunctions['TRUE'])) {
self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
}
if (isset(self::$_localeFunctions['FALSE'])) {
self::$_localeBoolean['FALSE'] = self::$_localeFunctions['FALSE'];
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';
@ -2034,7 +2034,7 @@ class PHPExcel_Calculation
$settingName = strtoupper(trim($settingName));
switch ($settingName) {
case 'ARGUMENTSEPARATOR':
self::$_localeArgumentSeparator = trim($settingValue);
self::$localeArgumentSeparator = trim($settingValue);
break;
}
}
@ -2044,7 +2044,7 @@ class PHPExcel_Calculation
self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
self::$_localeLanguage = $locale;
self::$localeLanguage = $locale;
return true;
}
return false;
@ -2076,7 +2076,7 @@ class PHPExcel_Calculation
private static function _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
{
// Convert any Excel function names to the required language
if (self::$_localeLanguage !== 'en_us') {
if (self::$localeLanguage !== 'en_us') {
$inBraces = false;
// If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
if (strpos($formula, '"') !== false) {
@ -2111,10 +2111,10 @@ class PHPExcel_Calculation
{
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';
}
@ -2122,15 +2122,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);
}
@ -2141,35 +2141,35 @@ class PHPExcel_Calculation
{
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, ',');
}
public static function _localeFunc($function)
public static function localeFunc($function)
{
if (self::$_localeLanguage !== 'en_us') {
if (self::$localeLanguage !== 'en_us') {
$functionName = trim($function, '(');
if (isset(self::$_localeFunctions[$functionName])) {
if (isset(self::$localeFunctions[$functionName])) {
$brace = ($functionName != $function);
$function = self::$_localeFunctions[$functionName];
$function = self::$localeFunctions[$functionName];
if ($brace) {
$function .= '(';
}
@ -2267,24 +2267,24 @@ class PHPExcel_Calculation
// Initialise the logging settings if requested
$this->formulaError = null;
$this->_debugLog->clearLog();
$this->_cyclicReferenceStack->clear();
$this->_cyclicFormulaCount = 1;
$this->cyclicReferenceStack->clear();
$this->cyclicFormulaCounter = 1;
self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY;
}
// Execute the calculation for the cell formula
$this->_cellStack[] = array(
$this->cellStack[] = array(
'sheet' => $pCell->getWorksheet()->getTitle(),
'cell' => $pCell->getCoordinate(),
);
try {
$result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
$cellAddress = array_pop($this->_cellStack);
$this->_workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
$cellAddress = array_pop($this->cellStack);
$this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
} catch (PHPExcel_Exception $e) {
$cellAddress = array_pop($this->_cellStack);
$this->_workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
$cellAddress = array_pop($this->cellStack);
$this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
throw new PHPExcel_Calculation_Exception($e->getMessage());
}
@ -2363,12 +2363,12 @@ class PHPExcel_Calculation
// Initialise the logging settings
$this->formulaError = null;
$this->_debugLog->clearLog();
$this->_cyclicReferenceStack->clear();
$this->cyclicReferenceStack->clear();
// Disable calculation cacheing because it only applies to cell calculations, not straight formulae
// But don't actually flush any cache
$resetCache = $this->getCalculationCacheEnabled();
$this->_calculationCacheEnabled = false;
$this->calculationCacheEnabled = false;
// Execute the calculation
try {
$result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
@ -2377,7 +2377,7 @@ class PHPExcel_Calculation
}
// Reset calculation cacheing to its previous state
$this->_calculationCacheEnabled = $resetCache;
$this->calculationCacheEnabled = $resetCache;
return $result;
}
@ -2388,10 +2388,10 @@ class PHPExcel_Calculation
// Is calculation cacheing enabled?
// Is the value present in calculation cache?
$this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
if (($this->_calculationCacheEnabled) && (isset($this->_calculationCache[$cellReference]))) {
if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
$this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
// Return the cached result
$cellValue = $this->_calculationCache[$cellReference];
$cellValue = $this->calculationCache[$cellReference];
return true;
}
return false;
@ -2399,8 +2399,8 @@ class PHPExcel_Calculation
public function saveValueToCache($cellReference, $cellValue)
{
if ($this->_calculationCacheEnabled) {
$this->_calculationCache[$cellReference] = $cellValue;
if ($this->calculationCacheEnabled) {
$this->calculationCache[$cellReference] = $cellValue;
}
}
@ -2436,28 +2436,28 @@ class PHPExcel_Calculation
return $cellValue;
}
if (($wsTitle{0} !== "\x00") && ($this->_cyclicReferenceStack->onStack($wsCellReference))) {
if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
if ($this->cyclicFormulaCount <= 0) {
$this->_cyclicFormulaCell = '';
$this->cyclicFormulaCell = '';
return $this->_raiseFormulaError('Cyclic Reference in Formula');
} elseif ($this->_cyclicFormulaCell === $wsCellReference) {
++$this->_cyclicFormulaCount;
if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) {
$this->_cyclicFormulaCell = '';
} elseif ($this->cyclicFormulaCell === $wsCellReference) {
++$this->cyclicFormulaCounter;
if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
$this->cyclicFormulaCell = '';
return $cellValue;
}
} elseif ($this->_cyclicFormulaCell == '') {
if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) {
} elseif ($this->cyclicFormulaCell == '') {
if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
return $cellValue;
}
$this->_cyclicFormulaCell = $wsCellReference;
$this->cyclicFormulaCell = $wsCellReference;
}
}
// Parse the formula onto the token stack and calculate the value
$this->_cyclicReferenceStack->push($wsCellReference);
$this->cyclicReferenceStack->push($wsCellReference);
$cellValue = $this->_processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell);
$this->_cyclicReferenceStack->pop();
$this->cyclicReferenceStack->pop();
// Save to calculation cache
if ($cellID !== null) {
@ -2656,7 +2656,7 @@ class PHPExcel_Calculation
} elseif (is_string($value) && (trim($value, '"') == $value)) {
return '"'.$value.'"';
} elseif (is_bool($value)) {
return ($value) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
}
}
return PHPExcel_Calculation_Functions::flattenSingleValue($value);
@ -2848,11 +2848,11 @@ class PHPExcel_Calculation
} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal
return $this->_raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
} elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
} 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 &&
($o2 = $stack->last()) &&
isset(self::$_operators[$o2['value']]) &&
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
}
@ -2885,14 +2885,14 @@ class PHPExcel_Calculation
//}
$output[] = $d; // Dump the argument count on the output
$output[] = $stack->pop(); // Pop the function and push onto the output
if (isset(self::$_controlFunctions[$functionName])) {
if (isset(self::$controlFunctions[$functionName])) {
//echo 'Built-in function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$_controlFunctions[$functionName]['argumentCount'];
$functionCall = self::$_controlFunctions[$functionName]['functionCall'];
} elseif (isset(self::$_PHPExcelFunctions[$functionName])) {
$expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount'];
$functionCall = self::$controlFunctions[$functionName]['functionCall'];
} elseif (isset(self::$PHPExcelFunctions[$functionName])) {
//echo 'PHPExcel function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$_PHPExcelFunctions[$functionName]['argumentCount'];
$functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall'];
$expectedArgumentCount = self::$PHPExcelFunctions[$functionName]['argumentCount'];
$functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
} else { // did we somehow push a non-function on the stack? this should never happen
return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack");
}
@ -2955,7 +2955,7 @@ class PHPExcel_Calculation
// If we've a comma when we're expecting an operand, then what we actually have is a null operand;
// so push a null onto the stack
if (($expectingOperand) || (!$expectingOperator)) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
$output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
}
// make sure there was a function
$d = $stack->last(2);
@ -2984,7 +2984,7 @@ class PHPExcel_Calculation
if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
$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
if (isset(self::$PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function
$stack->push('Function', strtoupper($val));
$ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
if ($ax) {
@ -3071,13 +3071,13 @@ class PHPExcel_Calculation
// echo 'Casting '.$val.' to integer<br />';
$val = (integer) $val;
}
} elseif (isset(self::$_ExcelConstants[trim(strtoupper($val))])) {
} elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
$excelConstant = trim(strtoupper($val));
// echo 'Element '.$excelConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$excelConstant];
} elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$_localeBoolean)) !== false) {
$val = self::$excelConstants[$excelConstant];
} elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) {
// echo 'Element '.$localeConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$localeConstant];
$val = self::$excelConstants[$localeConstant];
}
$details = array('type' => 'Value', 'value' => $val, 'reference' => null);
if ($localeConstant) {
@ -3091,13 +3091,13 @@ class PHPExcel_Calculation
++$index;
} elseif ($opCharacter == ')') { // miscellaneous error checking
if ($expectingOperand) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
$output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
$expectingOperand = false;
$expectingOperator = true;
} else {
return $this->_raiseFormulaError("Formula Error: Unexpected ')'");
}
} elseif (isset(self::$_operators[$opCharacter]) && !$expectingOperator) {
} elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) {
return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
} else { // I don't even want to know what you did to get here
return $this->_raiseFormulaError("Formula Error: An unexpected error occured");
@ -3106,7 +3106,7 @@ class PHPExcel_Calculation
if ($index == strlen($formula)) {
// Did we end with an operator?.
// Only valid for the % unary operator
if ((isset(self::$_operators[$opCharacter])) && ($opCharacter != '%')) {
if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) {
return $this->_raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
} else {
break;
@ -3128,7 +3128,7 @@ class PHPExcel_Calculation
// echo 'Element is an Intersect Operator<br />';
while ($stack->count() > 0 &&
($o2 = $stack->last()) &&
isset(self::$_operators[$o2['value']]) &&
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
}
@ -3183,7 +3183,7 @@ class PHPExcel_Calculation
$token = $tokenData['value'];
// echo '<b>Token is '.$token.'</b><br />';
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$_binaryOperators[$token])) {
if (isset(self::$binaryOperators[$token])) {
// echo 'Token is a binary operator<br />';
// We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === null) {
@ -3256,7 +3256,7 @@ class PHPExcel_Calculation
}
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), false);
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($sheet1), false);
} else {
return $this->_raiseFormulaError('Unable to access Cell Reference');
}
@ -3285,10 +3285,10 @@ class PHPExcel_Calculation
// (converting the other operand to a matrix if need be); then perform the required
// matrix operation
if (is_bool($operand1)) {
$operand1 = ($operand1) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
$operand1 = ($operand1) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
}
if (is_bool($operand2)) {
$operand2 = ($operand2) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
$operand2 = ($operand2) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
}
if ((is_array($operand1)) || (is_array($operand2))) {
// Ensure that both operands are arrays/matrices
@ -3377,7 +3377,7 @@ class PHPExcel_Calculation
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), false);
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
} else {
return $this->_raiseFormulaError('Unable to access Cell Reference');
}
@ -3410,9 +3410,9 @@ class PHPExcel_Calculation
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) {
$cellSheet = $this->_workbook->getSheetByName($matches[2]);
$cellSheet = $this->workbook->getSheetByName($matches[2]);
if ($cellSheet && $cellSheet->cellExists($cellRef)) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), false);
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
$pCell->attach($pCellParent);
} else {
$cellValue = null;
@ -3444,17 +3444,17 @@ class PHPExcel_Calculation
$argCount = $stack->pop();
$argCount = $argCount['value'];
if ($functionName != 'MKMATRIX') {
$this->_debugLog->writeDebugLog('Evaluating Function ', self::_localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
$this->_debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
}
if ((isset(self::$_PHPExcelFunctions[$functionName])) || (isset(self::$_controlFunctions[$functionName]))) { // function
if (isset(self::$_PHPExcelFunctions[$functionName])) {
$functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$_PHPExcelFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$_PHPExcelFunctions[$functionName]['passCellReference']);
} elseif (isset(self::$_controlFunctions[$functionName])) {
$functionCall = self::$_controlFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$_controlFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$_controlFunctions[$functionName]['passCellReference']);
if ((isset(self::$PHPExcelFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function
if (isset(self::$PHPExcelFunctions[$functionName])) {
$functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$PHPExcelFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$PHPExcelFunctions[$functionName]['passCellReference']);
} elseif (isset(self::$controlFunctions[$functionName])) {
$functionCall = self::$controlFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$controlFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']);
}
// get the arguments for this function
// echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />';
@ -3463,8 +3463,8 @@ class PHPExcel_Calculation
$arg = $stack->pop();
$a = $argCount - $i - 1;
if (($passByReference) &&
(isset(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) {
(isset(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) {
if ($arg['reference'] === null) {
$args[] = $cellID;
if ($functionName != 'MKMATRIX') {
@ -3495,7 +3495,7 @@ class PHPExcel_Calculation
if ($functionName != 'MKMATRIX') {
if ($this->_debugLog->getWriteDebugLog()) {
krsort($argArrayVals);
$this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', implode(self::$_localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
$this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
}
}
// Process each argument in turn, building the return value as an array
@ -3507,16 +3507,16 @@ class PHPExcel_Calculation
// foreach($operand1 as $args) {
// if (is_array($args)) {
// foreach($args as $arg) {
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($arg), ' )');
// $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->_showValue($arg), ' )');
// $r = call_user_func_array($functionCall, $arg);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $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), ' )');
// $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->_showValue($args), ' )');
// $r = call_user_func_array($functionCall, $args);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $result[] = $r;
// }
// }
@ -3535,18 +3535,18 @@ class PHPExcel_Calculation
$result = call_user_func_array($functionCall, $args);
}
if ($functionName != 'MKMATRIX') {
$this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result));
$this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result));
}
$stack->push('Value', self::_wrapResult($result));
}
} else {
// if the token is a number, boolean, string or an Excel error, push it onto the stack
if (isset(self::$_ExcelConstants[strtoupper($token)])) {
if (isset(self::$excelConstants[strtoupper($token)])) {
$excelConstant = strtoupper($token);
// echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
$stack->push('Constant Value', self::$_ExcelConstants[$excelConstant]);
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
$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);
@ -3828,7 +3828,7 @@ class PHPExcel_Calculation
protected function _raiseFormulaError($errorMessage)
{
$this->formulaError = $errorMessage;
$this->_cyclicReferenceStack->clear();
$this->cyclicReferenceStack->clear();
if (!$this->suppressFormulaErrors) {
throw new PHPExcel_Calculation_Exception($errorMessage);
}
@ -3860,7 +3860,7 @@ class PHPExcel_Calculation
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);
$pSheet = $this->workbook->getSheetByName($pSheetName);
}
// Extract range
@ -3918,7 +3918,7 @@ class PHPExcel_Calculation
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);
$pSheet = $this->workbook->getSheetByName($pSheetName);
}
// Named range?
@ -3990,8 +3990,8 @@ class PHPExcel_Calculation
public function isImplemented($pFunction = '')
{
$pFunction = strtoupper($pFunction);
if (isset(self::$_PHPExcelFunctions[$pFunction])) {
return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
if (isset(self::$PHPExcelFunctions[$pFunction])) {
return (self::$PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
} else {
return false;
}
@ -4007,7 +4007,7 @@ class PHPExcel_Calculation
{
$returnValue = array();
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'],
@ -4028,7 +4028,7 @@ class PHPExcel_Calculation
*/
public function listAllFunctionNames()
{
return array_keys(self::$_PHPExcelFunctions);
return array_keys(self::$PHPExcelFunctions);
}
/**
@ -4039,7 +4039,7 @@ class PHPExcel_Calculation
public function listFunctionNames()
{
$returnValue = array();
foreach (self::$_PHPExcelFunctions as $functionName => $function) {
foreach (self::$PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[] = $functionName;
}

View File

@ -66,7 +66,7 @@ class PHPExcel_Calculation_Token_Stack
'reference' => $reference
);
if ($type == 'Function') {
$localeFunction = PHPExcel_Calculation::_localeFunc($value);
$localeFunction = PHPExcel_Calculation::localeFunc($value);
if ($localeFunction != $value) {
$this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
}

View File

@ -40,14 +40,14 @@ class PHPExcel_Cell
*
* @var PHPExcel_Cell_IValueBinder
*/
private static $_valueBinder;
private static $valueBinder;
/**
* Value of the cell
*
* @var mixed
*/
private $_value;
private $value;
/**
* Calculated value of the cell (used for caching)
@ -59,34 +59,34 @@ class PHPExcel_Cell
*
* @var mixed
*/
private $_calculatedValue;
private $calculatedValue;
/**
* Type of the cell data
*
* @var string
*/
private $_dataType;
private $dataType;
/**
* Parent worksheet
*
* @var PHPExcel_CachedObjectStorage_CacheBase
*/
private $_parent;
private $parent;
/**
* Index to cellXf
*
* @var int
*/
private $_xfIndex = 0;
private $xfIndex = 0;
/**
* Attributes of the formula
*
*/
private $_formulaAttributes;
private $formulaAttributes;
/**
@ -96,19 +96,19 @@ class PHPExcel_Cell
**/
public function notifyCacheController()
{
$this->_parent->updateCacheData($this);
$this->parent->updateCacheData($this);
return $this;
}
public function detach()
{
$this->_parent = null;
$this->parent = null;
}
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent)
{
$this->_parent = $parent;
$this->parent = $parent;
}
@ -123,17 +123,17 @@ class PHPExcel_Cell
public function __construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
{
// Initialise cell value
$this->_value = $pValue;
$this->value = $pValue;
// Set worksheet cache
$this->_parent = $pSheet->getCellCacheController();
$this->parent = $pSheet->getCellCacheController();
// Set datatype?
if ($pDataType !== null) {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType;
$this->dataType = $pDataType;
} elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell.");
}
@ -146,7 +146,7 @@ class PHPExcel_Cell
*/
public function getColumn()
{
return $this->_parent->getCurrentColumn();
return $this->parent->getCurrentColumn();
}
/**
@ -156,7 +156,7 @@ class PHPExcel_Cell
*/
public function getRow()
{
return $this->_parent->getCurrentRow();
return $this->parent->getCurrentRow();
}
/**
@ -166,7 +166,7 @@ class PHPExcel_Cell
*/
public function getCoordinate()
{
return $this->_parent->getCurrentAddress();
return $this->parent->getCurrentAddress();
}
/**
@ -176,7 +176,7 @@ class PHPExcel_Cell
*/
public function getValue()
{
return $this->_value;
return $this->value;
}
/**
@ -223,7 +223,7 @@ class PHPExcel_Cell
// set the value according to data type
switch ($pDataType) {
case PHPExcel_Cell_DataType::TYPE_NULL:
$this->_value = $pValue;
$this->value = $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
@ -231,19 +231,19 @@ class PHPExcel_Cell
// Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE:
// Rich text
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
$this->value = PHPExcel_Cell_DataType::checkString($pValue);
break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_value = (float) $pValue;
$this->value = (float) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_FORMULA:
$this->_value = (string) $pValue;
$this->value = (string) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_BOOL:
$this->_value = (bool) $pValue;
$this->value = (bool) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_ERROR:
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
$this->value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
break;
default:
throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType);
@ -251,7 +251,7 @@ class PHPExcel_Cell
}
// set the datatype
$this->_dataType = $pDataType;
$this->dataType = $pDataType;
return $this->notifyCacheController();
}
@ -267,8 +267,8 @@ class PHPExcel_Cell
*/
public function getCalculatedValue($resetLog = true)
{
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL;
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->dataType.' with a value of '.$this->getValue().PHP_EOL;
if ($this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
try {
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
$result = PHPExcel_Calculation::getInstance(
@ -282,9 +282,9 @@ class PHPExcel_Cell
}
}
} catch (PHPExcel_Exception $ex) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback for calculations referencing external files.
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->calculatedValue; // Fallback for calculations referencing external files.
}
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
$result = '#N/A';
@ -294,17 +294,17 @@ class PHPExcel_Cell
}
if ($result === '#Not Yet Implemented') {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula.
//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->calculatedValue; // Fallback if calculation engine does not support the formula.
}
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
return $result;
} elseif ($this->_value instanceof PHPExcel_RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />';
return $this->_value->getPlainText();
} elseif ($this->value instanceof PHPExcel_RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->value.'<br />';
return $this->value->getPlainText();
}
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
return $this->_value;
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->value.'<br />';
return $this->value;
}
/**
@ -316,7 +316,7 @@ class PHPExcel_Cell
public function setCalculatedValue($pValue = null)
{
if ($pValue !== null) {
$this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
$this->calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
}
return $this->notifyCacheController();
@ -334,7 +334,7 @@ class PHPExcel_Cell
*/
public function getOldCalculatedValue()
{
return $this->_calculatedValue;
return $this->calculatedValue;
}
/**
@ -344,7 +344,7 @@ class PHPExcel_Cell
*/
public function getDataType()
{
return $this->_dataType;
return $this->dataType;
}
/**
@ -358,7 +358,7 @@ class PHPExcel_Cell
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType;
$this->dataType = $pDataType;
return $this->notifyCacheController();
}
@ -370,7 +370,7 @@ class PHPExcel_Cell
*/
public function isFormula()
{
return $this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
return $this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
}
/**
@ -381,7 +381,7 @@ class PHPExcel_Cell
*/
public function hasDataValidation()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
}
@ -396,7 +396,7 @@ class PHPExcel_Cell
*/
public function getDataValidation()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
}
@ -412,7 +412,7 @@ class PHPExcel_Cell
*/
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
}
@ -429,7 +429,7 @@ class PHPExcel_Cell
*/
public function hasHyperlink()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
}
@ -444,7 +444,7 @@ class PHPExcel_Cell
*/
public function getHyperlink()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
}
@ -460,7 +460,7 @@ class PHPExcel_Cell
*/
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
}
@ -476,7 +476,7 @@ class PHPExcel_Cell
*/
public function getParent()
{
return $this->_parent;
return $this->parent;
}
/**
@ -486,7 +486,7 @@ class PHPExcel_Cell
*/
public function getWorksheet()
{
return $this->_parent->getParent();
return $this->parent->getParent();
}
/**
@ -549,7 +549,7 @@ class PHPExcel_Cell
*/
public function rebindParent(PHPExcel_Worksheet $parent)
{
$this->_parent = $parent->getCellCacheController();
$this->parent = $parent->getCellCacheController();
return $this->notifyCacheController();
}
@ -943,11 +943,11 @@ class PHPExcel_Cell
*/
public static function getValueBinder()
{
if (self::$_valueBinder === null) {
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
if (self::$valueBinder === null) {
self::$valueBinder = new PHPExcel_Cell_DefaultValueBinder();
}
return self::$_valueBinder;
return self::$valueBinder;
}
/**
@ -962,7 +962,7 @@ class PHPExcel_Cell
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
}
self::$_valueBinder = $binder;
self::$valueBinder = $binder;
}
/**
@ -972,7 +972,7 @@ class PHPExcel_Cell
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
if ((is_object($value)) && ($key != 'parent')) {
$this->$key = clone $value;
} else {
$this->$key = $value;
@ -987,7 +987,7 @@ class PHPExcel_Cell
*/
public function getXfIndex()
{
return $this->_xfIndex;
return $this->xfIndex;
}
/**
@ -998,7 +998,7 @@ class PHPExcel_Cell
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
$this->xfIndex = $pValue;
return $this->notifyCacheController();
}
@ -1008,7 +1008,7 @@ class PHPExcel_Cell
*/
public function setFormulaAttributes($pAttributes)
{
$this->_formulaAttributes = $pAttributes;
$this->formulaAttributes = $pAttributes;
return $this;
}
@ -1017,7 +1017,7 @@ class PHPExcel_Cell
*/
public function getFormulaAttributes()
{
return $this->_formulaAttributes;
return $this->formulaAttributes;
}
/**

View File

@ -14,7 +14,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_axis_number = array(
private $axisNumber = array(
'format' => self::FORMAT_CODE_GENERAL,
'source_linked' => 1
);
@ -24,7 +24,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_axis_options = array(
private $axisOptions = array(
'minimum' => null,
'maximum' => null,
'major_unit' => null,
@ -42,7 +42,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_fill_properties = array(
private $fillProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null,
'alpha' => 0
@ -53,7 +53,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_line_properties = array(
private $lineProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null,
'alpha' => 0
@ -64,7 +64,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_line_style_properties = array(
private $lineStyleProperties = array(
'width' => '9525',
'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
'dash' => self::LINE_STYLE_DASH_SOLID,
@ -87,7 +87,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_shadow_properties = array(
private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null,
'color' => array(
@ -112,7 +112,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_glow_properties = array(
private $glowProperties = array(
'size' => null,
'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -126,7 +126,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_soft_edges = array(
private $softEdges = array(
'size' => null
);
@ -137,8 +137,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setAxisNumberProperties($format_code)
{
$this->_axis_number['format'] = (string) $format_code;
$this->_axis_number['source_linked'] = 0;
$this->axisNumber['format'] = (string) $format_code;
$this->axisNumber['source_linked'] = 0;
}
/**
@ -148,7 +148,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getAxisNumberFormat()
{
return $this->_axis_number['format'];
return $this->axisNumber['format'];
}
/**
@ -158,7 +158,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getAxisNumberSourceLinked()
{
return (string) $this->_axis_number['source_linked'];
return (string) $this->axisNumber['source_linked'];
}
/**
@ -178,17 +178,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
{
$this->_axis_options['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== null) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== null) ? $this->_axis_options['orientation'] = (string) $axis_orientation : null;
($major_tmt !== null) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== null) ? $this->_axis_options['minimum'] = (string) $minimum : null;
($maximum !== null) ? $this->_axis_options['maximum'] = (string) $maximum : null;
($major_unit !== null) ? $this->_axis_options['major_unit'] = (string) $major_unit : null;
($minor_unit !== null) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : null;
$this->axisOptions['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
}
/**
@ -200,7 +200,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getAxisOptionsProperty($property)
{
return $this->_axis_options[$property];
return $this->axisOptions[$property];
}
/**
@ -224,7 +224,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
$this->fillProperties = $this->setColorProperties($color, $alpha, $type);
}
/**
@ -237,7 +237,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
$this->lineProperties = $this->setColorProperties($color, $alpha, $type);
}
/**
@ -249,7 +249,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getFillProperty($property)
{
return $this->_fill_properties[$property];
return $this->fillProperties[$property];
}
/**
@ -261,7 +261,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineProperty($property)
{
return $this->_line_properties[$property];
return $this->lineProperties[$property];
}
/**
@ -278,16 +278,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $end_arrow_size
*
*/
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) {
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
(!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : null;
(!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : null;
(!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : null;
(!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type : null;
(!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size : null;
(!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type : null;
(!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size : null;
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
{
(!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
(!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
(!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
(!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
(!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
(!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
(!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
(!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
(!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
}
/**
@ -299,7 +300,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
}
/**
@ -311,7 +312,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineStyleArrowWidth($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
}
/**
@ -323,7 +324,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineStyleArrowLength($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
}
/**
@ -338,15 +339,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param float $sh_distance
*
*/
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) {
$this->_setShadowPresetsProperties((int) $sh_presets)
->_setShadowColor(
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] : $sh_color_alpha
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
->_setShadowBlur($sh_blur)
->_setShadowAngle($sh_angle)
->_setShadowDistance($sh_distance);
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
{
$this->setShadowPresetsProperties((int) $sh_presets)
->setShadowColor(
is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha,
is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
)
->setShadowBlur($sh_blur)
->setShadowAngle($sh_angle)
->setShadowDistance($sh_distance);
}
/**
@ -356,9 +359,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowPresetsProperties($shadow_presets) {
$this->_shadow_properties['presets'] = $shadow_presets;
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
private function setShadowPresetsProperties($shadow_presets)
{
$this->shadowProperties['presets'] = $shadow_presets;
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this;
}
@ -371,19 +375,20 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) {
private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
$base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) {
if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key];
$reference = & $this->shadowProperties[$property_key];
} else {
$reference = & $reference[$property_key];
}
$this->_setShadowProperiesMapValues($property_val, $reference);
$this->setShadowProperiesMapValues($property_val, $reference);
} else {
if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val;
$this->shadowProperties[$property_key] = $property_val;
} else {
$reference[$property_key] = $property_val;
}
@ -402,8 +407,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowColor($color, $alpha, $type) {
$this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
private function setShadowColor($color, $alpha, $type)
{
$this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this;
}
@ -415,9 +421,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowBlur($blur) {
private function setShadowBlur($blur)
{
if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
$this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
}
return $this;
@ -430,9 +437,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowAngle($angle) {
private function setShadowAngle($angle)
{
if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
$this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
}
return $this;
@ -445,9 +453,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowDistance($distance) {
private function setShadowDistance($distance)
{
if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
$this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
}
return $this;
@ -461,8 +470,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha
* @param string $color_type
*/
public function getShadowProperty($elements) {
return $this->getArrayElementsValue($this->_shadow_properties, $elements);
public function getShadowProperty($elements)
{
return $this->getArrayElementsValue($this->shadowProperties, $elements);
}
/**
@ -473,12 +483,13 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha
* @param string $color_type
*/
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) {
$this->_setGlowSize($size)
->_setGlowColor(
is_null($color_value) ? $this->_glow_properties['color']['value'] : $color_value
, is_null($color_alpha) ? (int) $this->_glow_properties['color']['alpha'] : $color_alpha
, is_null($color_type) ? $this->_glow_properties['color']['type'] : $color_type
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this->setGlowSize($size)
->setGlowColor(
is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value,
is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha,
is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type
);
}
@ -489,8 +500,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getGlowProperty($property) {
return $this->getArrayElementsValue($this->_glow_properties, $property);
public function getGlowProperty($property)
{
return $this->getArrayElementsValue($this->glowProperties, $property);
}
/**
@ -500,9 +512,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setGlowSize($size) {
private function setGlowSize($size)
{
if (!is_null($size)) {
$this->_glow_properties['size'] = $this->getExcelPointsWidth($size);
$this->glowProperties['size'] = $this->getExcelPointsWidth($size);
}
return $this;
@ -517,8 +530,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setGlowColor($color, $alpha, $type) {
$this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
private function setGlowColor($color, $alpha, $type)
{
$this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this;
}
@ -528,9 +542,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @param float $size
*/
public function setSoftEdges($size) {
public function setSoftEdges($size)
{
if (!is_null($size)) {
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
}
}
@ -539,7 +554,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getSoftEdgesSize() {
return $this->_soft_edges['size'];
public function getSoftEdgesSize()
{
return $this->softEdges['size'];
}
}

View File

@ -75,90 +75,90 @@ class PHPExcel_Chart_DataSeries
*
* @var string
*/
private $_plotType = null;
private $plotType;
/**
* Plot Grouping Type
*
* @var boolean
*/
private $_plotGrouping = null;
private $plotGrouping;
/**
* Plot Direction
*
* @var boolean
*/
private $_plotDirection = null;
private $plotDirection;
/**
* Plot Style
*
* @var string
*/
private $_plotStyle = null;
private $plotStyle;
/**
* Order of plots in Series
*
* @var array of integer
*/
private $_plotOrder = array();
private $plotOrder = array();
/**
* Plot Label
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotLabel = array();
private $plotLabel = array();
/**
* Plot Category
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotCategory = array();
private $plotCategory = array();
/**
* Smooth Line
*
* @var string
*/
private $_smoothLine = null;
private $smoothLine;
/**
* Plot Values
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotValues = array();
private $plotValues = array();
/**
* Create a new PHPExcel_Chart_DataSeries
*/
public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
{
$this->_plotType = $plotType;
$this->_plotGrouping = $plotGrouping;
$this->_plotOrder = $plotOrder;
$this->plotType = $plotType;
$this->plotGrouping = $plotGrouping;
$this->plotOrder = $plotOrder;
$keys = array_keys($plotValues);
$this->_plotValues = $plotValues;
$this->plotValues = $plotValues;
if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
}
$this->_plotLabel = $plotLabel;
$this->plotLabel = $plotLabel;
if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
}
$this->_plotCategory = $plotCategory;
$this->_smoothLine = $smoothLine;
$this->_plotStyle = $plotStyle;
$this->plotCategory = $plotCategory;
$this->smoothLine = $smoothLine;
$this->plotStyle = $plotStyle;
if (is_null($plotDirection)) {
$plotDirection = self::DIRECTION_COL;
}
$this->_plotDirection = $plotDirection;
$this->plotDirection = $plotDirection;
}
/**
@ -168,7 +168,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotType()
{
return $this->_plotType;
return $this->plotType;
}
/**
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotType($plotType = '')
{
$this->_plotType = $plotType;
$this->plotType = $plotType;
return $this;
}
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotGrouping()
{
return $this->_plotGrouping;
return $this->plotGrouping;
}
/**
@ -201,7 +201,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotGrouping($groupingType = null)
{
$this->_plotGrouping = $groupingType;
$this->plotGrouping = $groupingType;
return $this;
}
@ -212,7 +212,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotDirection()
{
return $this->_plotDirection;
return $this->plotDirection;
}
/**
@ -223,7 +223,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotDirection($plotDirection = null)
{
$this->_plotDirection = $plotDirection;
$this->plotDirection = $plotDirection;
return $this;
}
@ -234,7 +234,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotOrder()
{
return $this->_plotOrder;
return $this->plotOrder;
}
/**
@ -244,7 +244,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotLabels()
{
return $this->_plotLabel;
return $this->plotLabel;
}
/**
@ -254,11 +254,11 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotLabelByIndex($index)
{
$keys = array_keys($this->_plotLabel);
$keys = array_keys($this->plotLabel);
if (in_array($index, $keys)) {
return $this->_plotLabel[$index];
return $this->plotLabel[$index];
} elseif (isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]];
return $this->plotLabel[$keys[$index]];
}
return false;
}
@ -270,7 +270,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotCategories()
{
return $this->_plotCategory;
return $this->plotCategory;
}
/**
@ -280,11 +280,11 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotCategoryByIndex($index)
{
$keys = array_keys($this->_plotCategory);
$keys = array_keys($this->plotCategory);
if (in_array($index, $keys)) {
return $this->_plotCategory[$index];
return $this->plotCategory[$index];
} elseif (isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]];
return $this->plotCategory[$keys[$index]];
}
return false;
}
@ -296,7 +296,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotStyle()
{
return $this->_plotStyle;
return $this->plotStyle;
}
/**
@ -307,7 +307,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotStyle($plotStyle = null)
{
$this->_plotStyle = $plotStyle;
$this->plotStyle = $plotStyle;
return $this;
}
@ -318,7 +318,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotValues()
{
return $this->_plotValues;
return $this->plotValues;
}
/**
@ -328,11 +328,11 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotValuesByIndex($index)
{
$keys = array_keys($this->_plotValues);
$keys = array_keys($this->plotValues);
if (in_array($index, $keys)) {
return $this->_plotValues[$index];
return $this->plotValues[$index];
} elseif (isset($keys[$index])) {
return $this->_plotValues[$keys[$index]];
return $this->plotValues[$keys[$index]];
}
return false;
}
@ -344,7 +344,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotSeriesCount()
{
return count($this->_plotValues);
return count($this->plotValues);
}
/**
@ -354,7 +354,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getSmoothLine()
{
return $this->_smoothLine;
return $this->smoothLine;
}
/**
@ -365,23 +365,23 @@ class PHPExcel_Chart_DataSeries
*/
public function setSmoothLine($smoothLine = true)
{
$this->_smoothLine = $smoothLine;
$this->smoothLine = $smoothLine;
return $this;
}
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);
}

View File

@ -31,7 +31,7 @@ class PHPExcel_Chart_DataSeriesValues
const DATASERIES_TYPE_STRING = 'String';
const DATASERIES_TYPE_NUMBER = 'Number';
private static $_dataTypeValues = array(
private static $dataTypeValues = array(
self::DATASERIES_TYPE_STRING,
self::DATASERIES_TYPE_NUMBER,
);
@ -41,42 +41,42 @@ class PHPExcel_Chart_DataSeriesValues
*
* @var string
*/
private $_dataType = null;
private $dataType;
/**
* Series Data Source
*
* @var string
*/
private $_dataSource = null;
private $dataSource;
/**
* Format Code
*
* @var string
*/
private $_formatCode = null;
private $formatCode;
/**
* Series Point Marker
*
* @var string
*/
private $_marker = null;
private $pointMarker;
/**
* Point Count (The number of datapoints in the dataseries)
*
* @var integer
*/
private $_pointCount = 0;
private $pointCount = 0;
/**
* Data Values
*
* @var array of mixed
*/
private $_dataValues = array();
private $dataValues = array();
/**
* Create a new PHPExcel_Chart_DataSeriesValues object
@ -84,11 +84,11 @@ class PHPExcel_Chart_DataSeriesValues
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
{
$this->setDataType($dataType);
$this->_dataSource = $dataSource;
$this->_formatCode = $formatCode;
$this->_pointCount = $pointCount;
$this->_dataValues = $dataValues;
$this->_marker = $marker;
$this->dataSource = $dataSource;
$this->formatCode = $formatCode;
$this->pointCount = $pointCount;
$this->dataValues = $dataValues;
$this->pointMarker = $marker;
}
/**
@ -98,7 +98,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataType()
{
return $this->_dataType;
return $this->dataType;
}
/**
@ -114,10 +114,10 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
{
if (!in_array($dataType, self::$_dataTypeValues)) {
if (!in_array($dataType, self::$dataTypeValues)) {
throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
}
$this->_dataType = $dataType;
$this->dataType = $dataType;
return $this;
}
@ -129,7 +129,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataSource()
{
return $this->_dataSource;
return $this->dataSource;
}
/**
@ -140,7 +140,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setDataSource($dataSource = null, $refreshDataValues = true)
{
$this->_dataSource = $dataSource;
$this->dataSource = $dataSource;
if ($refreshDataValues) {
// TO DO
@ -156,7 +156,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getPointMarker()
{
return $this->_marker;
return $this->pointMarker;
}
/**
@ -167,7 +167,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setPointMarker($marker = null)
{
$this->_marker = $marker;
$this->pointMarker = $marker;
return $this;
}
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getFormatCode()
{
return $this->_formatCode;
return $this->formatCode;
}
/**
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setFormatCode($formatCode = null)
{
$this->_formatCode = $formatCode;
$this->formatCode = $formatCode;
return $this;
}
@ -202,7 +202,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getPointCount()
{
return $this->_pointCount;
return $this->pointCount;
}
/**
@ -212,8 +212,8 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function isMultiLevelSeries()
{
if (count($this->_dataValues) > 0) {
return is_array($this->_dataValues[0]);
if (count($this->dataValues) > 0) {
return is_array($this->dataValues[0]);
}
return null;
}
@ -226,8 +226,8 @@ class PHPExcel_Chart_DataSeriesValues
public function multiLevelCount()
{
$levelCount = 0;
foreach ($this->_dataValues as $dataValueSet) {
$levelCount = max($levelCount,count($dataValueSet));
foreach ($this->dataValues as $dataValueSet) {
$levelCount = max($levelCount, count($dataValueSet));
}
return $levelCount;
}
@ -239,7 +239,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataValues()
{
return $this->_dataValues;
return $this->dataValues;
}
/**
@ -249,13 +249,13 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataValue()
{
$count = count($this->_dataValues);
$count = count($this->dataValues);
if ($count == 0) {
return null;
} elseif ($count == 1) {
return $this->_dataValues[0];
return $this->dataValues[0];
}
return $this->_dataValues;
return $this->dataValues;
}
/**
@ -263,14 +263,14 @@ class PHPExcel_Chart_DataSeriesValues
*
* @param array $dataValues
* @param boolean $refreshDataSource
* TRUE - refresh the value of _dataSource based on the values of $dataValues
* FALSE - don't change the value of _dataSource
* TRUE - refresh the value of dataSource based on the values of $dataValues
* FALSE - don't change the value of dataSource
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setDataValues($dataValues = array(), $refreshDataSource = true)
{
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->_pointCount = count($dataValues);
$this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->pointCount = count($dataValues);
if ($refreshDataSource) {
// TO DO
@ -279,39 +279,39 @@ class PHPExcel_Chart_DataSeriesValues
return $this;
}
private function _stripNulls($var)
private function stripNulls($var)
{
return $var !== null;
}
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
{
if ($this->_dataSource !== null) {
if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult(
$calcEngine->_calculateFormulaValue(
'='.$this->_dataSource,
'='.$this->dataSource,
null,
$worksheet->getCell('A1')
)
);
if ($flatten) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
foreach ($this->_dataValues as &$dataValue) {
$this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
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;
}
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
$this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else {
$newArray = array_values(array_shift($newDataValues));
foreach ($newArray as $i => $newDataSet) {
@ -324,10 +324,10 @@ class PHPExcel_Chart_DataSeriesValues
array_unshift($newArray[$i++], $newDataVal);
}
}
$this->_dataValues = $newArray;
$this->dataValues = $newArray;
}
}
$this->_pointCount = count($this->_dataValues);
$this->pointCount = count($this->dataValues);
}
}
}

View File

@ -20,9 +20,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*
*/
private $_object_state = false;
private $objectState = false;
private $_line_properties = array(
private $lineProperties = array(
'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
'value' => null,
@ -47,7 +47,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
)
);
private $_shadow_properties = array(
private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null,
'color' => array(
@ -67,7 +67,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
'rotWithShape' => null
);
private $_glow_properties = array(
private $glowProperties = array(
'size' => null,
'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -76,7 +76,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
)
);
private $_soft_edges = array(
private $softEdges = array(
'size' => null
);
@ -88,7 +88,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getObjectState()
{
return $this->_object_state;
return $this->objectState;
}
/**
@ -97,9 +97,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _activateObject()
private function activateObject()
{
$this->_object_state = true;
$this->objectState = true;
return $this;
}
@ -114,12 +114,12 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
{
$this
->_activateObject()
->_line_properties['color'] = $this->setColorProperties(
$this->activateObject()
->lineProperties['color'] = $this->setColorProperties(
$value,
$alpha,
$type);
$type
);
}
/**
@ -138,33 +138,33 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
{
$this->_activateObject();
$this->activateObject();
(!is_null($line_width))
? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
: null;
(!is_null($compound_type))
? $this->_line_properties['style']['compound'] = (string) $compound_type
? $this->lineProperties['style']['compound'] = (string) $compound_type
: null;
(!is_null($dash_type))
? $this->_line_properties['style']['dash'] = (string) $dash_type
? $this->lineProperties['style']['dash'] = (string) $dash_type
: null;
(!is_null($cap_type))
? $this->_line_properties['style']['cap'] = (string) $cap_type
? $this->lineProperties['style']['cap'] = (string) $cap_type
: null;
(!is_null($join_type))
? $this->_line_properties['style']['join'] = (string) $join_type
? $this->lineProperties['style']['join'] = (string) $join_type
: null;
(!is_null($head_arrow_type))
? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type
? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type
: null;
(!is_null($head_arrow_size))
? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size
? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size
: null;
(!is_null($end_arrow_type))
? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type
? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type
: null;
(!is_null($end_arrow_size))
? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size
? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size
: null;
}
@ -178,7 +178,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineColorProperty($parameter)
{
return $this->_line_properties['color'][$parameter];
return $this->lineProperties['color'][$parameter];
}
/**
@ -191,7 +191,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_properties['style'], $elements);
return $this->getArrayElementsValue($this->lineProperties['style'], $elements);
}
/**
@ -207,9 +207,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this
->_activateObject()
->_setGlowSize($size)
->_setGlowColor($color_value, $color_alpha, $color_type);
->activateObject()
->setGlowSize($size)
->setGlowColor($color_value, $color_alpha, $color_type);
}
/**
@ -222,7 +222,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowColor($property)
{
return $this->_glow_properties['color'][$property];
return $this->glowProperties['color'][$property];
}
/**
@ -233,7 +233,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowSize()
{
return $this->_glow_properties['size'];
return $this->glowProperties['size'];
}
/**
@ -244,9 +244,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setGlowSize($size)
private function setGlowSize($size)
{
$this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size);
$this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size);
return $this;
}
@ -261,16 +261,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setGlowColor($color, $alpha, $type)
private function setGlowColor($color, $alpha, $type)
{
if (!is_null($color)) {
$this->_glow_properties['color']['value'] = (string) $color;
$this->glowProperties['color']['value'] = (string) $color;
}
if (!is_null($alpha)) {
$this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
$this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
}
if (!is_null($type)) {
$this->_glow_properties['color']['type'] = (string) $type;
$this->glowProperties['color']['type'] = (string) $type;
}
return $this;
@ -287,7 +287,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleArrowParameters($arrow_selector, $property_selector)
{
return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector);
return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector);
}
/**
@ -305,17 +305,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
{
$this
->_activateObject()
->_setShadowPresetsProperties((int) $sh_presets)
->_setShadowColor(
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha']
: $this->getTrueAlpha($sh_color_alpha)
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
->_setShadowBlur($sh_blur)
->_setShadowAngle($sh_angle)
->_setShadowDistance($sh_distance);
$this->activateObject()
->setShadowPresetsProperties((int) $sh_presets)
->setShadowColor(
is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha),
is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
)
->setShadowBlur($sh_blur)
->setShadowAngle($sh_angle)
->setShadowDistance($sh_distance);
}
/**
@ -326,10 +325,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowPresetsProperties($shadow_presets)
private function setShadowPresetsProperties($shadow_presets)
{
$this->_shadow_properties['presets'] = $shadow_presets;
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
$this->shadowProperties['presets'] = $shadow_presets;
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this;
}
@ -343,20 +342,20 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null)
private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
$base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) {
if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key];
$reference = & $this->shadowProperties[$property_key];
} else {
$reference = & $reference[$property_key];
}
$this->_setShadowProperiesMapValues($property_val, $reference);
$this->setShadowProperiesMapValues($property_val, $reference);
} else {
if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val;
$this->shadowProperties[$property_key] = $property_val;
} else {
$reference[$property_key] = $property_val;
}
@ -374,16 +373,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param string $type
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowColor($color, $alpha, $type)
private function setShadowColor($color, $alpha, $type)
{
if (!is_null($color)) {
$this->_shadow_properties['color']['value'] = (string) $color;
$this->shadowProperties['color']['value'] = (string) $color;
}
if (!is_null($alpha)) {
$this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
$this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
}
if (!is_null($type)) {
$this->_shadow_properties['color']['type'] = (string) $type;
$this->shadowProperties['color']['type'] = (string) $type;
}
return $this;
@ -396,10 +395,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowBlur($blur)
private function setShadowBlur($blur)
{
if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
$this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
}
return $this;
@ -412,10 +411,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowAngle($angle)
private function setShadowAngle($angle)
{
if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
$this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
}
return $this;
@ -427,10 +426,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param float $distance
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowDistance($distance)
private function setShadowDistance($distance)
{
if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
$this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
}
return $this;
@ -445,7 +444,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/
public function getShadowProperty($elements)
{
return $this->getArrayElementsValue($this->_shadow_properties, $elements);
return $this->getArrayElementsValue($this->shadowProperties, $elements);
}
/**
@ -456,8 +455,8 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setSoftEdgesSize($size)
{
if (!is_null($size)) {
$this->_activateObject();
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
$this->activateObject();
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
}
}
@ -468,6 +467,6 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/
public function getSoftEdgesSize()
{
return $this->_soft_edges['size'];
return $this->softEdges['size'];
}
}

View File

@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout
*
* @var string
*/
private $_layoutTarget = null;
private $layoutTarget;
/**
* X Mode
*
* @var string
*/
private $_xMode = null;
private $xMode;
/**
* Y Mode
*
* @var string
*/
private $_yMode = null;
private $yMode;
/**
* X-Position
*
* @var float
*/
private $_xPos = null;
private $xPos;
/**
* Y-Position
*
* @var float
*/
private $_yPos = null;
private $yPos;
/**
* width
*
* @var float
*/
private $_width = null;
private $width;
/**
* height
*
* @var float
*/
private $_height = null;
private $height;
/**
* show legend key
@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showLegendKey = null;
private $showLegendKey;
/**
* show value
@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showVal = null;
private $showVal;
/**
* show category name
@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showCatName = null;
private $showCatName;
/**
* show data series name
@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showSerName = null;
private $showSerName;
/**
* show percentage
@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showPercent = null;
private $showPercent;
/**
* show bubble size
*
* @var boolean
*/
private $_showBubbleSize = null;
private $showBubbleSize;
/**
* show leader lines
@ -137,7 +137,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showLeaderLines = null;
private $showLeaderLines;
/**
@ -146,25 +146,25 @@ class PHPExcel_Chart_Layout
public function __construct($layout = array())
{
if (isset($layout['layoutTarget'])) {
$this->_layoutTarget = $layout['layoutTarget'];
$this->layoutTarget = $layout['layoutTarget'];
}
if (isset($layout['xMode'])) {
$this->_xMode = $layout['xMode'];
$this->xMode = $layout['xMode'];
}
if (isset($layout['yMode'])) {
$this->_yMode = $layout['yMode'];
$this->yMode = $layout['yMode'];
}
if (isset($layout['x'])) {
$this->_xPos = (float) $layout['x'];
$this->xPos = (float) $layout['x'];
}
if (isset($layout['y'])) {
$this->_yPos = (float) $layout['y'];
$this->yPos = (float) $layout['y'];
}
if (isset($layout['w'])) {
$this->_width = (float) $layout['w'];
$this->width = (float) $layout['w'];
}
if (isset($layout['h'])) {
$this->_height = (float) $layout['h'];
$this->height = (float) $layout['h'];
}
}
@ -175,7 +175,7 @@ class PHPExcel_Chart_Layout
*/
public function getLayoutTarget()
{
return $this->_layoutTarget;
return $this->layoutTarget;
}
/**
@ -186,7 +186,7 @@ class PHPExcel_Chart_Layout
*/
public function setLayoutTarget($value)
{
$this->_layoutTarget = $value;
$this->layoutTarget = $value;
return $this;
}
@ -197,7 +197,7 @@ class PHPExcel_Chart_Layout
*/
public function getXMode()
{
return $this->_xMode;
return $this->xMode;
}
/**
@ -208,7 +208,7 @@ class PHPExcel_Chart_Layout
*/
public function setXMode($value)
{
$this->_xMode = $value;
$this->xMode = $value;
return $this;
}
@ -219,7 +219,7 @@ class PHPExcel_Chart_Layout
*/
public function getYMode()
{
return $this->_yMode;
return $this->yMode;
}
/**
@ -230,7 +230,7 @@ class PHPExcel_Chart_Layout
*/
public function setYMode($value)
{
$this->_yMode = $value;
$this->yMode = $value;
return $this;
}
@ -241,7 +241,7 @@ class PHPExcel_Chart_Layout
*/
public function getXPosition()
{
return $this->_xPos;
return $this->xPos;
}
/**
@ -252,7 +252,7 @@ class PHPExcel_Chart_Layout
*/
public function setXPosition($value)
{
$this->_xPos = $value;
$this->xPos = $value;
return $this;
}
@ -263,7 +263,7 @@ class PHPExcel_Chart_Layout
*/
public function getYPosition()
{
return $this->_yPos;
return $this->yPos;
}
/**
@ -274,7 +274,7 @@ class PHPExcel_Chart_Layout
*/
public function setYPosition($value)
{
$this->_yPos = $value;
$this->yPos = $value;
return $this;
}
@ -285,7 +285,7 @@ class PHPExcel_Chart_Layout
*/
public function getWidth()
{
return $this->_width;
return $this->width;
}
/**
@ -296,7 +296,7 @@ class PHPExcel_Chart_Layout
*/
public function setWidth($value)
{
$this->_width = $value;
$this->width = $value;
return $this;
}
@ -307,7 +307,7 @@ class PHPExcel_Chart_Layout
*/
public function getHeight()
{
return $this->_height;
return $this->height;
}
/**
@ -318,7 +318,7 @@ class PHPExcel_Chart_Layout
*/
public function setHeight($value)
{
$this->_height = $value;
$this->height = $value;
return $this;
}
@ -330,7 +330,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowLegendKey()
{
return $this->_showLegendKey;
return $this->showLegendKey;
}
/**
@ -342,7 +342,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowLegendKey($value)
{
$this->_showLegendKey = $value;
$this->showLegendKey = $value;
return $this;
}
@ -353,7 +353,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowVal()
{
return $this->_showVal;
return $this->showVal;
}
/**
@ -365,7 +365,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowVal($value)
{
$this->_showVal = $value;
$this->showVal = $value;
return $this;
}
@ -376,7 +376,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowCatName()
{
return $this->_showCatName;
return $this->showCatName;
}
/**
@ -388,7 +388,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowCatName($value)
{
$this->_showCatName = $value;
$this->showCatName = $value;
return $this;
}
@ -399,7 +399,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowSerName()
{
return $this->_showSerName;
return $this->showSerName;
}
/**
@ -411,7 +411,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowSerName($value)
{
$this->_showSerName = $value;
$this->showSerName = $value;
return $this;
}
@ -422,7 +422,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowPercent()
{
return $this->_showPercent;
return $this->showPercent;
}
/**
@ -434,7 +434,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowPercent($value)
{
$this->_showPercent = $value;
$this->showPercent = $value;
return $this;
}
@ -445,7 +445,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowBubbleSize()
{
return $this->_showBubbleSize;
return $this->showBubbleSize;
}
/**
@ -457,7 +457,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowBubbleSize($value)
{
$this->_showBubbleSize = $value;
$this->showBubbleSize = $value;
return $this;
}
@ -468,7 +468,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowLeaderLines()
{
return $this->_showLeaderLines;
return $this->showLeaderLines;
}
/**
@ -480,7 +480,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowLeaderLines($value)
{
$this->_showLeaderLines = $value;
$this->showLeaderLines = $value;
return $this;
}
}

View File

@ -28,26 +28,26 @@
class PHPExcel_Chart_Legend
{
/** Legend positions */
const xlLegendPositionBottom = -4107; // Below the chart.
const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border.
const xlLegendPositionCustom = -4161; // A custom position.
const xlLegendPositionLeft = -4131; // Left of the chart.
const xlLegendPositionRight = -4152; // Right of the chart.
const xlLegendPositionTop = -4160; // Above the chart.
const xlLegendPositionBottom = -4107; // Below the chart.
const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border.
const xlLegendPositionCustom = -4161; // A custom position.
const xlLegendPositionLeft = -4131; // Left of the chart.
const xlLegendPositionRight = -4152; // Right of the chart.
const xlLegendPositionTop = -4160; // Above the chart.
const POSITION_RIGHT = 'r';
const POSITION_LEFT = 'l';
const POSITION_BOTTOM = 'b';
const POSITION_TOP = 't';
const POSITION_TOPRIGHT = 'tr';
const POSITION_LEFT = 'l';
const POSITION_BOTTOM = 'b';
const POSITION_TOP = 't';
const POSITION_TOPRIGHT = 'tr';
private static $_positionXLref = array(
self::xlLegendPositionBottom => self::POSITION_BOTTOM,
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
self::xlLegendPositionCustom => '??',
self::xlLegendPositionLeft => self::POSITION_LEFT,
self::xlLegendPositionRight => self::POSITION_RIGHT,
self::xlLegendPositionTop => self::POSITION_TOP
self::xlLegendPositionBottom => self::POSITION_BOTTOM,
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
self::xlLegendPositionCustom => '??',
self::xlLegendPositionLeft => self::POSITION_LEFT,
self::xlLegendPositionRight => self::POSITION_RIGHT,
self::xlLegendPositionTop => self::POSITION_TOP
);
/**
@ -55,30 +55,30 @@ class PHPExcel_Chart_Legend
*
* @var string
*/
private $_position = self::POSITION_RIGHT;
private $position = self::POSITION_RIGHT;
/**
* Allow overlay of other elements?
*
* @var boolean
*/
private $_overlay = TRUE;
private $overlay = true;
/**
* Legend Layout
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = NULL;
private $layout = null;
/**
* Create a new PHPExcel_Chart_Legend
*/
public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE)
public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false)
{
$this->setPosition($position);
$this->_layout = $layout;
$this->layout = $layout;
$this->setOverlay($overlay);
}
@ -87,8 +87,9 @@ class PHPExcel_Chart_Legend
*
* @return string
*/
public function getPosition() {
return $this->_position;
public function getPosition()
{
return $this->position;
}
/**
@ -96,12 +97,13 @@ class PHPExcel_Chart_Legend
*
* @param string $position
*/
public function setPosition($position = self::POSITION_RIGHT) {
if (!in_array($position,self::$_positionXLref)) {
public function setPosition($position = self::POSITION_RIGHT)
{
if (!in_array($position, self::$_positionXLref)) {
return false;
}
$this->_position = $position;
$this->position = $position;
return true;
}
@ -110,8 +112,9 @@ class PHPExcel_Chart_Legend
*
* @return number
*/
public function getPositionXL() {
return array_search($this->_position,self::$_positionXLref);
public function getPositionXL()
{
return array_search($this->position, self::$_positionXLref);
}
/**
@ -119,12 +122,13 @@ class PHPExcel_Chart_Legend
*
* @param number $positionXL
*/
public function setPositionXL($positionXL = self::xlLegendPositionRight) {
if (!array_key_exists($positionXL,self::$_positionXLref)) {
public function setPositionXL($positionXL = self::xlLegendPositionRight)
{
if (!array_key_exists($positionXL, self::$_positionXLref)) {
return false;
}
$this->_position = self::$_positionXLref[$positionXL];
$this->position = self::$_positionXLref[$positionXL];
return true;
}
@ -133,8 +137,9 @@ class PHPExcel_Chart_Legend
*
* @return boolean
*/
public function getOverlay() {
return $this->_overlay;
public function getOverlay()
{
return $this->overlay;
}
/**
@ -143,12 +148,13 @@ class PHPExcel_Chart_Legend
* @param boolean $overlay
* @return boolean
*/
public function setOverlay($overlay = FALSE) {
public function setOverlay($overlay = false)
{
if (!is_bool($overlay)) {
return false;
}
$this->_overlay = $overlay;
$this->overlay = $overlay;
return true;
}
@ -157,8 +163,8 @@ class PHPExcel_Chart_Legend
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
return $this->_layout;
public function getLayout()
{
return $this->layout;
}
}

View File

@ -32,22 +32,22 @@ class PHPExcel_Chart_PlotArea
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = null;
private $layout = null;
/**
* Plot Series
*
* @var array of PHPExcel_Chart_DataSeries
*/
private $_plotSeries = array();
private $plotSeries = array();
/**
* Create a new PHPExcel_Chart_PlotArea
*/
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
{
$this->_layout = $layout;
$this->_plotSeries = $plotSeries;
$this->layout = $layout;
$this->plotSeries = $plotSeries;
}
/**
@ -57,7 +57,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getLayout()
{
return $this->_layout;
return $this->layout;
}
/**
@ -67,7 +67,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getPlotGroupCount()
{
return count($this->_plotSeries);
return count($this->plotSeries);
}
/**
@ -78,7 +78,7 @@ class PHPExcel_Chart_PlotArea
public function getPlotSeriesCount()
{
$seriesCount = 0;
foreach ($this->_plotSeries as $plot) {
foreach ($this->plotSeries as $plot) {
$seriesCount += $plot->getPlotSeriesCount();
}
return $seriesCount;
@ -91,7 +91,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getPlotGroup()
{
return $this->_plotSeries;
return $this->plotSeries;
}
/**
@ -101,7 +101,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getPlotGroupByIndex($index)
{
return $this->_plotSeries[$index];
return $this->plotSeries[$index];
}
/**
@ -112,14 +112,14 @@ class PHPExcel_Chart_PlotArea
*/
public function setPlotSeries($plotSeries = array())
{
$this->_plotSeries = $plotSeries;
$this->plotSeries = $plotSeries;
return $this;
}
public function refresh(PHPExcel_Worksheet $worksheet)
{
foreach ($this->_plotSeries as $plotSeries) {
foreach ($this->plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet);
}
}

View File

@ -70,7 +70,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_JOIN_MITER = 'miter',
LINE_STYLE_JOIN_BEVEL = 'bevel',
LINE_STYLE_ARROW_TYPE_NOARROW = NULL,
LINE_STYLE_ARROW_TYPE_NOARROW = null,
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
@ -88,7 +88,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_ARROW_SIZE_9 = 9;
const
SHADOW_PRESETS_NOSHADOW = NULL,
SHADOW_PRESETS_NOSHADOW = null,
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
SHADOW_PRESETS_OUTER_BOTTOM = 2,
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
@ -113,19 +113,19 @@ abstract class PHPExcel_Chart_Properties
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
protected function getExcelPointsWidth($width)
protected function getExcelPointsWidth($width)
{
return $width * 12700;
return $width * 12700;
}
protected function getExcelPointsAngle($angle)
{
return $angle * 60000;
return $angle * 60000;
}
protected function getTrueAlpha($alpha)
{
return (string) 100 - $alpha . '000';
return (string) 100 - $alpha . '000';
}
protected function setColorProperties($color, $alpha, $type)
@ -137,7 +137,8 @@ abstract class PHPExcel_Chart_Properties
);
}
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) {
protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
{
$sizes = array(
1 => array('w' => 'sm', 'len' => 'sm'),
2 => array('w' => 'sm', 'len' => 'med'),
@ -153,7 +154,8 @@ abstract class PHPExcel_Chart_Properties
return $sizes[$array_selector][$array_kay_selector];
}
protected function getShadowPresetsMap($shadow_presets_option) {
protected function getShadowPresetsMap($shadow_presets_option)
{
$presets_options = array(
//OUTER
1 => array(
@ -345,7 +347,8 @@ abstract class PHPExcel_Chart_Properties
return $presets_options[$shadow_presets_option];
}
protected function getArrayElementsValue($properties, $elements) {
protected function getArrayElementsValue($properties, $elements)
{
$reference = & $properties;
if (!is_array($elements)) {
return $reference[$elements];

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Chart_Title
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Chart_Title
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Title
{
@ -41,22 +33,22 @@ class PHPExcel_Chart_Title
*
* @var string
*/
private $_caption = null;
private $caption = null;
/**
* Title Layout
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = null;
private $layout = null;
/**
* Create a new PHPExcel_Chart_Title
*/
public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
{
$this->_caption = $caption;
$this->_layout = $layout;
$this->caption = $caption;
$this->layout = $layout;
}
/**
@ -64,8 +56,9 @@ class PHPExcel_Chart_Title
*
* @return string
*/
public function getCaption() {
return $this->_caption;
public function getCaption()
{
return $this->caption;
}
/**
@ -74,8 +67,9 @@ class PHPExcel_Chart_Title
* @param string $caption
* @return PHPExcel_Chart_Title
*/
public function setCaption($caption = null) {
$this->_caption = $caption;
public function setCaption($caption = null)
{
$this->caption = $caption;
return $this;
}
@ -85,8 +79,8 @@ class PHPExcel_Chart_Title
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
return $this->_layout;
public function getLayout()
{
return $this->layout;
}
}

View File

@ -98,10 +98,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function __construct()
{
// Initialise variables
$this->_author = 'Author';
$this->_author = 'Author';
$this->_text = new PHPExcel_RichText();
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
}
/**
@ -109,7 +109,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getAuthor() {
public function getAuthor()
{
return $this->_author;
}
@ -119,7 +120,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Comment
*/
public function setAuthor($pValue = '') {
public function setAuthor($pValue = '')
{
$this->_author = $pValue;
return $this;
}
@ -129,7 +131,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return PHPExcel_RichText
*/
public function getText() {
public function getText()
{
return $this->_text;
}
@ -139,7 +142,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param PHPExcel_RichText $pValue
* @return PHPExcel_Comment
*/
public function setText(PHPExcel_RichText $pValue) {
public function setText(PHPExcel_RichText $pValue)
{
$this->_text = $pValue;
return $this;
}
@ -149,7 +153,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -159,7 +164,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setWidth($value = '96pt') {
public function setWidth($value = '96pt')
{
$this->_width = $value;
return $this;
}
@ -169,7 +175,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -179,7 +186,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setHeight($value = '55.5pt') {
public function setHeight($value = '55.5pt')
{
$this->_height = $value;
return $this;
}
@ -189,7 +197,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getMarginLeft() {
public function getMarginLeft()
{
return $this->_marginLeft;
}
@ -199,7 +208,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setMarginLeft($value = '59.25pt') {
public function setMarginLeft($value = '59.25pt')
{
$this->_marginLeft = $value;
return $this;
}
@ -209,7 +219,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getMarginTop() {
public function getMarginTop()
{
return $this->_marginTop;
}
@ -219,7 +230,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setMarginTop($value = '1.5pt') {
public function setMarginTop($value = '1.5pt')
{
$this->_marginTop = $value;
return $this;
}
@ -229,7 +241,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return boolean
*/
public function getVisible() {
public function getVisible()
{
return $this->_visible;
}
@ -239,7 +252,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param boolean $value
* @return PHPExcel_Comment
*/
public function setVisible($value = false) {
public function setVisible($value = false)
{
$this->_visible = $value;
return $this;
}
@ -249,7 +263,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return PHPExcel_Style_Color
*/
public function getFillColor() {
public function getFillColor()
{
return $this->_fillColor;
}
@ -259,7 +274,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Comment
*/
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
{
$this->_alignment = $pValue;
return $this;
}
@ -269,7 +285,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getAlignment() {
public function getAlignment()
{
return $this->_alignment;
}
@ -278,9 +295,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_author
$this->_author
. $this->_text->getHashCode()
. $this->_width
. $this->_height
@ -296,7 +314,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
@ -312,8 +331,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function __toString() {
public function __toString()
{
return $this->_text->getPlainText();
}
}

View File

@ -33,7 +33,8 @@
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Exception extends Exception {
class PHPExcel_Exception extends Exception
{
/**
* Error handler callback
*
@ -43,7 +44,8 @@ class PHPExcel_Exception extends Exception {
* @param mixed $line
* @param mixed $context
*/
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
public static function errorHandlerCallback($code, $string, $file, $line, $context)
{
$e = new self($string, $code);
$e->line = $line;
$e->file = $file;

View File

@ -157,7 +157,7 @@ class PHPExcel_HashTable
public function getByIndex($pIndex = 0)
{
if (isset($this->_keyMap[$pIndex])) {
return $this->getByHashCode( $this->_keyMap[$pIndex] );
return $this->getByHashCode($this->_keyMap[$pIndex]);
}
return null;

View File

@ -69,7 +69,9 @@ class PHPExcel_IOFactory
/**
* Private constructor for PHPExcel_IOFactory
*/
private function __construct() { }
private function __construct()
{
}
/**
* Get search locations
@ -135,7 +137,7 @@ class PHPExcel_IOFactory
$className = str_replace('{0}', $writerType, $searchLocation['class']);
$instance = new $className($phpExcel);
if ($instance !== NULL) {
if ($instance !== null) {
return $instance;
}
}
@ -165,7 +167,7 @@ class PHPExcel_IOFactory
$className = str_replace('{0}', $readerType, $searchLocation['class']);
$instance = new $className();
if ($instance !== NULL) {
if ($instance !== null) {
return $instance;
}
}
@ -222,7 +224,7 @@ class PHPExcel_IOFactory
// First, lucky guess by inspecting file extension
$pathinfo = pathinfo($pFilename);
$extensionType = NULL;
$extensionType = null;
if (isset($pathinfo['extension'])) {
switch (strtolower($pathinfo['extension'])) {
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet

View File

@ -75,7 +75,7 @@ class PHPExcel_NamedRange
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
{
// Validate data
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
throw new PHPExcel_Exception('Parameters can not be null.');
}
@ -93,7 +93,8 @@ class PHPExcel_NamedRange
*
* @return string
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -103,18 +104,19 @@ class PHPExcel_NamedRange
* @param string $value
* @return PHPExcel_NamedRange
*/
public function setName($value = null) {
if ($value !== NULL) {
public function setName($value = null)
{
if ($value !== null) {
// Old title
$oldTitle = $this->_name;
// Re-attach
if ($this->_worksheet !== NULL) {
if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
}
$this->_name = $value;
if ($this->_worksheet !== NULL) {
if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->addNamedRange($this);
}
@ -130,7 +132,8 @@ class PHPExcel_NamedRange
*
* @return PHPExcel_Worksheet
*/
public function getWorksheet() {
public function getWorksheet()
{
return $this->_worksheet;
}
@ -140,8 +143,9 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet $value
* @return PHPExcel_NamedRange
*/
public function setWorksheet(PHPExcel_Worksheet $value = null) {
if ($value !== NULL) {
public function setWorksheet(PHPExcel_Worksheet $value = null)
{
if ($value !== null) {
$this->_worksheet = $value;
}
return $this;
@ -152,7 +156,8 @@ class PHPExcel_NamedRange
*
* @return string
*/
public function getRange() {
public function getRange()
{
return $this->_range;
}
@ -162,8 +167,9 @@ class PHPExcel_NamedRange
* @param string $value
* @return PHPExcel_NamedRange
*/
public function setRange($value = null) {
if ($value !== NULL) {
public function setRange($value = null)
{
if ($value !== null) {
$this->_range = $value;
}
return $this;
@ -174,7 +180,8 @@ class PHPExcel_NamedRange
*
* @return bool
*/
public function getLocalOnly() {
public function getLocalOnly()
{
return $this->_localOnly;
}
@ -184,7 +191,8 @@ class PHPExcel_NamedRange
* @param bool $value
* @return PHPExcel_NamedRange
*/
public function setLocalOnly($value = false) {
public function setLocalOnly($value = false)
{
$this->_localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null;
return $this;
@ -195,7 +203,8 @@ class PHPExcel_NamedRange
*
* @return PHPExcel_Worksheet|null
*/
public function getScope() {
public function getScope()
{
return $this->_scope;
}
@ -205,7 +214,8 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet|null $value
* @return PHPExcel_NamedRange
*/
public function setScope(PHPExcel_Worksheet $value = null) {
public function setScope(PHPExcel_Worksheet $value = null)
{
$this->_scope = $value;
$this->_localOnly = ($value == null) ? false : true;
return $this;
@ -218,14 +228,16 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
* @return PHPExcel_NamedRange
*/
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) {
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
{
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -46,8 +46,9 @@ class PHPExcel_ReferenceHelper
*
* @return PHPExcel_ReferenceHelper
*/
public static function getInstance() {
if (!isset(self::$_instance) || (self::$_instance === NULL)) {
public static function getInstance()
{
if (!isset(self::$_instance) || (self::$_instance === null)) {
self::$_instance = new PHPExcel_ReferenceHelper();
}
@ -57,7 +58,8 @@ class PHPExcel_ReferenceHelper
/**
* Create a new PHPExcel_ReferenceHelper
*/
protected function __construct() {
protected function __construct()
{
}
/**
@ -68,7 +70,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second column to test (e.g. 'Z')
* @return integer
*/
public static function columnSort($a, $b) {
public static function columnSort($a, $b)
{
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
}
@ -80,7 +83,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second column to test (e.g. 'Z')
* @return integer
*/
public static function columnReverseSort($a, $b) {
public static function columnReverseSort($a, $b)
{
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
}
@ -92,9 +96,10 @@ class PHPExcel_ReferenceHelper
* @param string $b Second cell to test (e.g. 'Z1')
* @return integer
*/
public static function cellSort($a, $b) {
sscanf($a,'%[A-Z]%d', $ac, $ar);
sscanf($b,'%[A-Z]%d', $bc, $br);
public static function cellSort($a, $b)
{
sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -110,9 +115,10 @@ class PHPExcel_ReferenceHelper
* @param string $b Second cell to test (e.g. 'Z1')
* @return integer
*/
public static function cellReverseSort($a, $b) {
sscanf($a,'%[A-Z]%d', $ac, $ar);
sscanf($b,'%[A-Z]%d', $bc, $br);
public static function cellReverseSort($a, $b)
{
sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -130,20 +136,21 @@ class PHPExcel_ReferenceHelper
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @return boolean
*/
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
{
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
// Is cell within the range of rows/columns if we're deleting
if ($pNumRows < 0 &&
($cellRow >= ($beforeRow + $pNumRows)) &&
($cellRow < $beforeRow)) {
return TRUE;
return true;
} elseif ($pNumCols < 0 &&
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
($cellColumnIndex < $beforeColumnIndex)) {
return TRUE;
return true;
}
return FALSE;
return false;
}
/**
@ -198,7 +205,7 @@ class PHPExcel_ReferenceHelper
foreach ($aComments as $key => &$value) {
// Any comments inside a deleted range will be ignored
if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
// Otherwise build a new array of comments indexed by the adjusted cell reference
// Otherwise build a new array of comments indexed by the adjusted cell reference
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
$aNewComments[$newReference] = $value;
}
@ -220,15 +227,13 @@ class PHPExcel_ReferenceHelper
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aHyperlinkCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->setHyperlink( $newReference, $value );
$pSheet->setHyperlink( $key, null );
$pSheet->setHyperlink($newReference, $value);
$pSheet->setHyperlink($key, null);
}
}
}
@ -246,14 +251,13 @@ class PHPExcel_ReferenceHelper
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aDataValidationCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->setDataValidation( $newReference, $value );
$pSheet->setDataValidation( $key, null );
$pSheet->setDataValidation($newReference, $value);
$pSheet->setDataValidation($key, null);
}
}
}
@ -298,8 +302,8 @@ class PHPExcel_ReferenceHelper
foreach ($aProtectedCells as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->protectCells( $newReference, $value, true );
$pSheet->unprotectCells( $key );
$pSheet->protectCells($newReference, $value, true);
$pSheet->unprotectCells($key);
}
}
}
@ -372,7 +376,7 @@ class PHPExcel_ReferenceHelper
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @throws PHPExcel_Exception
*/
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null)
{
$remove = ($pNumCols < 0 || $pNumRows < 0);
$aCellCollection = $pSheet->getCellCollection();
@ -442,8 +446,7 @@ class PHPExcel_ReferenceHelper
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted
$pSheet->getCell($newCoordinates)
->setValue($this->updateFormulaReferences($cell->getValue(),
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
} else {
// Formula should not be adjusted
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
@ -451,14 +454,12 @@ class PHPExcel_ReferenceHelper
// Clear the original cell
$pSheet->getCellCacheController()->deleteCacheData($cellID);
} else {
/* We don't need to update styles for rows/columns before our insertion position,
but we do still need to adjust any formulae in those cells */
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted
$cell->setValue($this->updateFormulaReferences($cell->getValue(),
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
$cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
}
}
@ -472,7 +473,7 @@ class PHPExcel_ReferenceHelper
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
// Style
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i;
$coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
if ($pSheet->cellExists($coordinate)) {
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
@ -594,17 +595,17 @@ class PHPExcel_ReferenceHelper
}
}
}
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
$pSheet->setAutoFilter($this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows));
}
// Update worksheet: freeze pane
if ($pSheet->getFreezePane() != '') {
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
$pSheet->freezePane($this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows));
}
// Page setup
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
$pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows));
}
// Update worksheet: drawings
@ -620,9 +621,7 @@ class PHPExcel_ReferenceHelper
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
$namedRange->setRange(
$this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)
);
$namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows));
}
}
}
@ -642,7 +641,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated formula
* @throws PHPExcel_Exception
*/
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
{
// Update cell references in the formula
$formulaBlocks = explode('"', $pFormula);
$i = false;
@ -657,8 +657,8 @@ class PHPExcel_ReferenceHelper
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)) {
@ -682,8 +682,8 @@ class PHPExcel_ReferenceHelper
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)) {
@ -781,7 +781,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
// Is it in another worksheet? Will not have to update anything.
if (strpos($pCellRange, "!") !== false) {
return $pCellRange;
@ -805,7 +806,8 @@ class PHPExcel_ReferenceHelper
* @param string $oldName Old name (name to replace)
* @param string $newName New name
*/
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '')
{
if ($oldName == '') {
return;
}
@ -813,7 +815,7 @@ class PHPExcel_ReferenceHelper
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
if (($cell !== null) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
$formula = $cell->getValue();
if (strpos($formula, $oldName) !== false) {
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
@ -835,7 +837,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
// Update range
$range = PHPExcel_Cell::splitRange($pCellRange);
@ -872,23 +875,22 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell reference
* @throws PHPExcel_Exception
*/
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
// Get coordinates of $pCellReference
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference );
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
// Verify which parts should be updated
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
$newRow >= $beforeRow);
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
// Create new column reference
if ($updateColumn) {
$newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols );
$newColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
}
// Create new row reference
@ -908,7 +910,8 @@ class PHPExcel_ReferenceHelper
*
* @throws PHPExcel_Exception
*/
public final function __clone() {
final public function __clone()
{
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
}
}

View File

@ -41,7 +41,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in pixels
* @return int Value in EMU
*/
public static function pixelsToEMU($pValue = 0) {
public static function pixelsToEMU($pValue = 0)
{
return round($pValue * 9525);
}
@ -51,7 +52,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in EMU
* @return int Value in pixels
*/
public static function EMUToPixels($pValue = 0) {
public static function EMUToPixels($pValue = 0)
{
if ($pValue != 0) {
return round($pValue / 9525);
} else {
@ -68,22 +70,19 @@ class PHPExcel_Shared_Drawing
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
* @return int Value in cell dimension
*/
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize();
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
// Exact width can be determined
$colWidth = $pValue
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
} else {
// We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11
$colWidth = $pValue * 11
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
$colWidth = $pValue * 11 * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
}
return $colWidth;
@ -96,23 +95,19 @@ class PHPExcel_Shared_Drawing
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
* @return int Value in pixels
*/
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize();
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
// Exact width can be determined
$colWidth = $pValue
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
} else {
// We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11
$colWidth = $pValue * $size
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
$colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
}
// Round pixels to closest integer
@ -127,7 +122,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in pixels
* @return int Value in points
*/
public static function pixelsToPoints($pValue = 0) {
public static function pixelsToPoints($pValue = 0)
{
return $pValue * 0.67777777;
}
@ -137,7 +133,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in points
* @return int Value in pixels
*/
public static function pointsToPixels($pValue = 0) {
public static function pointsToPixels($pValue = 0)
{
if ($pValue != 0) {
return (int) ceil($pValue * 1.333333333);
} else {
@ -151,7 +148,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Degrees
* @return int Angle
*/
public static function degreesToAngle($pValue = 0) {
public static function degreesToAngle($pValue = 0)
{
return (int)round($pValue * 60000);
}
@ -161,7 +159,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Angle
* @return int Degrees
*/
public static function angleToDegrees($pValue = 0) {
public static function angleToDegrees($pValue = 0)
{
if ($pValue != 0) {
return round($pValue / 60000);
} else {
@ -179,94 +178,93 @@ class PHPExcel_Shared_Drawing
public static function imagecreatefrombmp($p_sFile)
{
// Load the image into a string
$file = fopen($p_sFile,"rb");
$read = fread($file,10);
while (!feof($file)&&($read<>""))
$read .= fread($file,1024);
$file = fopen($p_sFile, "rb");
$read = fread($file, 10);
while (!feof($file) && ($read<>"")) {
$read .= fread($file, 1024);
}
$temp = unpack("H*", $read);
$hex = $temp[1];
$header = substr($hex,0,108);
$temp = unpack("H*", $read);
$hex = $temp[1];
$header = substr($hex, 0, 108);
// Process the header
// Structure: http://www.fastgraph.com/help/bmp_header_format.html
if (substr($header,0,4)=="424d")
{
if (substr($header, 0, 4)=="424d") {
// Cut it in parts of 2 bytes
$header_parts = str_split($header,2);
$header_parts = str_split($header, 2);
// Get the width 4 bytes
$width = hexdec($header_parts[19].$header_parts[18]);
$width = hexdec($header_parts[19].$header_parts[18]);
// Get the height 4 bytes
$height = hexdec($header_parts[23].$header_parts[22]);
$height = hexdec($header_parts[23].$header_parts[22]);
// Unset the header params
unset($header_parts);
}
// Define starting X and Y
$x = 0;
$y = 1;
$x = 0;
$y = 1;
// Create newimage
$image = imagecreatetruecolor($width, $height);
$image = imagecreatetruecolor($width, $height);
// Grab the body from the image
$body = substr($hex,108);
$body = substr($hex, 108);
// Calculate if padding at the end-line is needed
// Divided by two to keep overview.
// 1 byte = 2 HEX-chars
$body_size = (strlen($body)/2);
$header_size = ($width*$height);
$body_size = (strlen($body)/2);
$header_size = ($width*$height);
// Use end-line padding? Only when needed
$usePadding = ($body_size>($header_size*3)+4);
$usePadding = ($body_size>($header_size*3)+4);
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
// Calculate the next DWORD-position in the body
for ($i=0;$i<$body_size;$i+=3)
{
for ($i = 0 ; $i < $body_size ; $i += 3) {
// Calculate line-ending and padding
if ($x>=$width)
{
// If padding needed, ignore image-padding
// Shift i to the ending of the current 32-bit-block
if ($usePadding)
$i += $width%4;
if ($x >= $width) {
// If padding needed, ignore image-padding
// Shift i to the ending of the current 32-bit-block
if ($usePadding) {
$i += $width%4;
}
// Reset horizontal position
$x = 0;
$x = 0;
// Raise the height-position (bottom-up)
$y++;
// Reached the image-height? Break the for-loop
if ($y>$height)
if ($y > $height) {
break;
}
}
// Calculation of the RGB-pixel (defined as BGR in image-data)
// Define $i_pos as absolute position in the body
$i_pos = $i*2;
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
// Calculation of the RGB-pixel (defined as BGR in image-data)
// Define $i_pos as absolute position in the body
$i_pos = $i * 2;
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
// Calculate and draw the pixel
$color = imagecolorallocate($image, $r, $g, $b);
// Calculate and draw the pixel
$color = imagecolorallocate($image, $r, $g, $b);
imagesetpixel($image, $x, $height-$y, $color);
// Raise the horizontal position
// Raise the horizontal position
$x++;
}
// Unset the body / free the memory
// Unset the body / free the memory
unset($body);
// Return image-object
return $image;
}
}

View File

@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher
{
return $this->_dgContainer = $dgContainer;
}
}

View File

@ -41,7 +41,7 @@ class PHPExcel_Shared_File
* @protected
* @var boolean
*/
protected static $_useUploadTempDirectory = FALSE;
protected static $_useUploadTempDirectory = false;
/**
@ -49,9 +49,10 @@ class PHPExcel_Shared_File
*
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
*/
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) {
public static function setUseUploadTempDirectory($useUploadTempDir = false)
{
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
} // function setUseUploadTempDirectory()
}
/**
@ -59,9 +60,10 @@ class PHPExcel_Shared_File
*
* @return boolean Use File Upload Temporary directory (true or false)
*/
public static function getUseUploadTempDirectory() {
public static function getUseUploadTempDirectory()
{
return self::$_useUploadTempDirectory;
} // function getUseUploadTempDirectory()
}
/**
@ -70,11 +72,12 @@ class PHPExcel_Shared_File
* @param string $pFilename Filename
* @return bool
*/
public static function file_exists($pFilename) {
public static function file_exists($pFilename)
{
// Sick construction, but it seems that
// file_exists returns strange values when
// doing the original file_exists on ZIP archives...
if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) {
if (strtolower(substr($pFilename, 0, 3)) == 'zip') {
// Open ZIP file and verify if the file exists
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
@ -99,7 +102,8 @@ class PHPExcel_Shared_File
* @param string $pFilename
* @return string
*/
public static function realpath($pFilename) {
public static function realpath($pFilename)
{
// Returnvalue
$returnValue = '';
@ -109,8 +113,8 @@ class PHPExcel_Shared_File
}
// Found something?
if ($returnValue == '' || ($returnValue === NULL)) {
$pathArray = explode('/' , $pFilename);
if ($returnValue == '' || ($returnValue === null)) {
$pathArray = explode('/', $pFilename);
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
for ($i = 0; $i < count($pathArray); ++$i) {
if ($pathArray[$i] == '..' && $i > 0) {
@ -137,10 +141,11 @@ class PHPExcel_Shared_File
if (self::$_useUploadTempDirectory) {
// use upload-directory when defined to allow running on environments having very restricted
// open_basedir configs
if (ini_get('upload_tmp_dir') !== FALSE) {
if (ini_get('upload_tmp_dir') !== false) {
if ($temp = ini_get('upload_tmp_dir')) {
if (file_exists($temp))
if (file_exists($temp)) {
return realpath($temp);
}
}
}
}
@ -149,13 +154,19 @@ class PHPExcel_Shared_File
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
if ( !function_exists('sys_get_temp_dir')) {
if ($temp = getenv('TMP') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
}
if ($temp = getenv('TEMP') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
}
if ($temp = getenv('TMPDIR') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
}
// trick for creating a file in system's temporary dir
@ -174,5 +185,4 @@ class PHPExcel_Shared_File
// be called if we're running 5.2.1 or earlier
return realpath(sys_get_temp_dir());
}
}

View File

@ -159,7 +159,7 @@ class PHPExcel_Shared_OLE
for ($i = 0; $i < $bbatBlockCount; ++$i) {
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
fseek($fh, $pos);
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) {
$this->bbat[] = self::_readInt4($fh);
}
}
@ -198,8 +198,7 @@ class PHPExcel_Shared_OLE
{
static $isRegistered = false;
if (!$isRegistered) {
stream_wrapper_register('ole-chainedblockstream',
'PHPExcel_Shared_OLE_ChainedBlockStream');
stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
$isRegistered = true;
}
@ -266,7 +265,7 @@ class PHPExcel_Shared_OLE
public function _readPpsWks($blockId)
{
$fh = $this->getStream($blockId);
for ($pos = 0; ; $pos += 128) {
for ($pos = 0;; $pos += 128) {
fseek($fh, $pos, SEEK_SET);
$nameUtf16 = fread($fh, 64);
$nameLength = self::_readInt2($fh);
@ -275,19 +274,18 @@ class PHPExcel_Shared_OLE
$name = str_replace("\x00", "", $nameUtf16);
$type = self::_readInt1($fh);
switch ($type) {
case self::OLE_PPS_TYPE_ROOT:
$pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
$this->root = $pps;
break;
case self::OLE_PPS_TYPE_DIR:
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
null, null, null, null, array());
break;
case self::OLE_PPS_TYPE_FILE:
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
break;
default:
continue;
case self::OLE_PPS_TYPE_ROOT:
$pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
$this->root = $pps;
break;
case self::OLE_PPS_TYPE_DIR:
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array());
break;
case self::OLE_PPS_TYPE_FILE:
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
break;
default:
continue;
}
fseek($fh, 1, SEEK_CUR);
$pps->Type = $type;
@ -304,9 +302,7 @@ class PHPExcel_Shared_OLE
$this->_list[] = $pps;
// check if the PPS tree (starting from root) is complete
if (isset($this->root) &&
$this->_ppsTreeComplete($this->root->No)) {
if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
break;
}
}
@ -473,8 +469,7 @@ 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;
@ -513,7 +508,7 @@ class PHPExcel_Shared_OLE
}
// factor used for separating numbers into 4 bytes parts
$factor = pow(2,32);
$factor = pow(2, 32);
list(, $high_part) = unpack('V', substr($string, 4, 4));
list(, $low_part) = unpack('V', substr($string, 0, 4));

View File

@ -5689,3 +5689,4 @@
return $p_path;
}
// --------------------------------------------------------------------------------

View File

@ -57,9 +57,10 @@ class PHPExcel_Shared_ZipStreamWrapper {
/**
* Register wrapper
*/
public static function register() {
@stream_wrapper_unregister("zip");
@stream_wrapper_register("zip", __CLASS__);
public static function register()
{
@stream_wrapper_unregister('zip');
@stream_wrapper_register('zip', __CLASS__);
}
/**
@ -71,7 +72,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param string &$openedPath absolute path of the opened stream (out parameter)
* @return bool true on success
*/
public function stream_open($path, $mode, $options, &$opened_path) {
public function stream_open($path, $mode, $options, &$opened_path)
{
// Check for mode
if ($mode{0} != 'r') {
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
@ -87,7 +89,7 @@ class PHPExcel_Shared_ZipStreamWrapper {
$this->_fileNameInArchive = $url['fragment'];
$this->_position = 0;
$this->_data = $this->_archive->getFromName( $this->_fileNameInArchive );
$this->_data = $this->_archive->getFromName($this->_fileNameInArchive);
return true;
}
@ -97,7 +99,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return boolean
*/
public function statName() {
public function statName()
{
return $this->_fileNameInArchive;
}
@ -106,8 +109,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return boolean
*/
public function url_stat() {
return $this->statName( $this->_fileNameInArchive );
public function url_stat()
{
return $this->statName($this->_fileNameInArchive);
}
/**
@ -115,8 +119,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return boolean
*/
public function stream_stat() {
return $this->_archive->statName( $this->_fileNameInArchive );
public function stream_stat()
{
return $this->_archive->statName($this->_fileNameInArchive);
}
/**
@ -125,7 +130,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param int $count maximum number of bytes to read
* @return string
*/
function stream_read($count) {
function stream_read($count)
{
$ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret);
return $ret;
@ -137,7 +143,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return int
*/
public function stream_tell() {
public function stream_tell()
{
return $this->_position;
}
@ -146,7 +153,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return bool
*/
public function stream_eof() {
public function stream_eof()
{
return $this->_position >= strlen($this->_data);
}
@ -157,7 +165,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
* @return bool
*/
public function stream_seek($offset, $whence) {
public function stream_seek($offset, $whence)
{
switch ($whence) {
case SEEK_SET:
if ($offset < strlen($this->_data) && $offset >= 0) {
@ -167,7 +176,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false;
}
break;
case SEEK_CUR:
if ($offset >= 0) {
$this->_position += $offset;
@ -176,7 +184,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false;
}
break;
case SEEK_END:
if (strlen($this->_data) + $offset >= 0) {
$this->_position = strlen($this->_data) + $offset;
@ -185,7 +192,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false;
}
break;
default:
return false;
}

View File

@ -210,7 +210,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
{
if (is_array($pStyles)) {
if ($this->isSupervisor) {
$pRange = $this->getSelectedCells();
// Uppercase coordinate
@ -322,7 +321,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
unset($regionStyles['borders']['inside']);
// what are the inner edges of the region when looking at the selection
$innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges );
$innerEdges = array_diff(array('top', 'right', 'bottom', 'left'), $edges);
// inner edges that are not touching the region should take the 'inside' border properties if they have been set
foreach ($innerEdges as $innerEdge) {

View File

@ -40,7 +40,7 @@ class PHPExcel_Worksheet_AutoFilter
*
* @var PHPExcel_Worksheet
*/
private $_workSheet = NULL;
private $_workSheet = null;
/**
@ -65,7 +65,7 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $pRange Cell range (i.e. A1:E10)
* @param PHPExcel_Worksheet $pSheet
*/
public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = NULL)
public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = null)
{
$this->_range = $pRange;
$this->_workSheet = $pSheet;
@ -76,7 +76,8 @@ class PHPExcel_Worksheet_AutoFilter
*
* @return PHPExcel_Worksheet
*/
public function getParent() {
public function getParent()
{
return $this->_workSheet;
}
@ -86,7 +87,8 @@ class PHPExcel_Worksheet_AutoFilter
* @param PHPExcel_Worksheet $pSheet
* @return PHPExcel_Worksheet_AutoFilter
*/
public function setParent(PHPExcel_Worksheet $pSheet = NULL) {
public function setParent(PHPExcel_Worksheet $pSheet = null)
{
$this->_workSheet = $pSheet;
return $this;
@ -97,7 +99,8 @@ class PHPExcel_Worksheet_AutoFilter
*
* @return string
*/
public function getRange() {
public function getRange()
{
return $this->_range;
}
@ -108,14 +111,15 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter
*/
public function setRange($pRange = '') {
public function setRange($pRange = '')
{
// Uppercase coordinate
$cellAddress = explode('!',strtoupper($pRange));
if (count($cellAddress) > 1) {
list($worksheet, $pRange) = $cellAddress;
}
if (strpos($pRange,':') !== FALSE) {
if (strpos($pRange, ':') !== false) {
$this->_range = $pRange;
} elseif (empty($pRange)) {
$this->_range = '';
@ -146,7 +150,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumns() {
public function getColumns()
{
return $this->_columns;
}
@ -157,7 +162,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return integer The column offset within the autofilter range
*/
public function testColumnInRange($column) {
public function testColumnInRange($column)
{
if (empty($this->_range)) {
throw new PHPExcel_Exception("No autofilter range is defined.");
}
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return integer The offset of the specified column within the autofilter range
*/
public function getColumnOffset($pColumn) {
public function getColumnOffset($pColumn)
{
return $this->testColumnInRange($pColumn);
}
@ -189,7 +196,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumn($pColumn) {
public function getColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (!isset($this->_columns[$pColumn])) {
@ -206,7 +214,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumnByOffset($pColumnOffset = 0) {
public function getColumnByOffset($pColumnOffset = 0)
{
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
@ -250,7 +259,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter
*/
public function clearColumn($pColumn) {
public function clearColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (isset($this->_columns[$pColumn])) {
@ -271,11 +281,12 @@ 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);
if (($fromColumn !== NULL) && (isset($this->_columns[$fromColumn])) && ($toColumn !== NULL)) {
if (($fromColumn !== null) && (isset($this->_columns[$fromColumn])) && ($toColumn !== null)) {
$this->_columns[$fromColumn]->setParent();
$this->_columns[$fromColumn]->setColumnIndex($toColumn);
$this->_columns[$toColumn] = $this->_columns[$fromColumn];
@ -300,7 +311,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$dataSetValues = $dataSet['filterValues'];
$blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) {
if (($cellValue == '') || ($cellValue === null)) {
return $blanks;
}
return in_array($cellValue, $dataSetValues);
@ -317,7 +328,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$dateSet = $dataSet['filterValues'];
$blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) {
if (($cellValue == '') || ($cellValue === null)) {
return $blanks;
}
@ -338,12 +349,12 @@ class PHPExcel_Worksheet_AutoFilter
}
foreach ($dateSet as $dateValue) {
// Use of substr to extract value at the appropriate group level
if (substr($dtVal,0,strlen($dateValue)) == $dateValue)
return TRUE;
if (substr($dtVal,0,strlen($dateValue)) == $dateValue) {
return true;
}
}
}
return FALSE;
return false;
}
/**
@ -357,12 +368,12 @@ class PHPExcel_Worksheet_AutoFilter
{
$dataSet = $ruleSet['filterRules'];
$join = $ruleSet['join'];
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : FALSE;
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
if (!$customRuleForBlanks) {
// Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) {
return FALSE;
if (($cellValue == '') || ($cellValue === null)) {
return false;
}
}
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
@ -392,13 +403,13 @@ class PHPExcel_Worksheet_AutoFilter
} elseif ($rule['value'] == '') {
switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL :
$retVal = (($cellValue == '') || ($cellValue === NULL));
$retVal = (($cellValue == '') || ($cellValue === null));
break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL :
$retVal = (($cellValue != '') && ($cellValue !== NULL));
$retVal = (($cellValue != '') && ($cellValue !== null));
break;
default :
$retVal = TRUE;
$retVal = true;
break;
}
} else {
@ -411,8 +422,9 @@ class PHPExcel_Worksheet_AutoFilter
$returnVal = $returnVal || $retVal;
// Break as soon as we have a TRUE match for OR joins,
// to avoid unnecessary additional code execution
if ($returnVal)
if ($returnVal) {
return $returnVal;
}
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND :
$returnVal = $returnVal && $retVal;
@ -433,18 +445,18 @@ class PHPExcel_Worksheet_AutoFilter
private static function _filterTestInPeriodDateSet($cellValue, $monthSet)
{
// Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) {
return FALSE;
if (($cellValue == '') || ($cellValue === null)) {
return false;
}
if (is_numeric($cellValue)) {
$dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue));
if (in_array($dateValue, $monthSet)) {
return TRUE;
return true;
}
}
return FALSE;
return false;
}
/**
@ -467,7 +479,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$rDateType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$val = $maxVal = NULL;
$val = $maxVal = null;
$ruleValues = array();
$baseDate = PHPExcel_Calculation_DateTime::DATENOW();
@ -480,22 +492,22 @@ class PHPExcel_Worksheet_AutoFilter
$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;
}
@ -508,30 +520,30 @@ class PHPExcel_Worksheet_AutoFilter
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)));
$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);
$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 :
@ -555,33 +567,20 @@ class PHPExcel_Worksheet_AutoFilter
}
// Set the filter column rule attributes ready for writing
$filterColumn->setAttributes(array( 'val' => $val,
'maxVal' => $maxVal
)
);
$filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
// Set the rules for identifying rows for hide/show
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
'value' => $val
);
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN,
'value' => $maxVal
);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
PHPExcel_Calculation_Functions::setReturnDateType($rDateType);
return array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND
)
);
return array('method' => '_filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND));
}
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)
);
$dataValues = PHPExcel_Calculation_Functions::flattenArray($this->_workSheet->rangeToArray($range, null, true, false));
$dataValues = array_filter($dataValues);
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
@ -605,7 +604,7 @@ class PHPExcel_Worksheet_AutoFilter
// The heading row should always be visible
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE);
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(true);
$columnFilterTests = array();
foreach ($this->_columns as $columnID => $filterColumn) {
@ -619,17 +618,15 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValues[] = $rule->getValue();
}
// Test if we want to include blanks in our filter criteria
$blanks = FALSE;
$blanks = false;
$ruleDataSet = array_filter($ruleValues);
if (count($ruleValues) != count($ruleDataSet))
$blanks = TRUE;
$blanks = true;
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
// Filter on absolute values
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInSimpleDataSet',
'arguments' => array( 'filterValues' => $ruleDataSet,
'blanks' => $blanks
)
'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
);
} else {
// Filter on date group values
@ -669,14 +666,12 @@ class PHPExcel_Worksheet_AutoFilter
$arguments['dateTime'] = array_filter($arguments['dateTime']);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInDateGroupSet',
'arguments' => array( 'filterValues' => $arguments,
'blanks' => $blanks
)
'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
);
}
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER :
$customRuleForBlanks = FALSE;
$customRuleForBlanks = false;
$ruleValues = array();
// Build a list of the filter value selections
foreach ($rules as $rule) {
@ -687,21 +682,16 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValue = preg_quote($ruleValue);
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
if (trim($ruleValue) == '') {
$customRuleForBlanks = TRUE;
$customRuleForBlanks = true;
$ruleValue = trim($ruleValue);
}
}
$ruleValues[] = array( 'operator' => $rule->getOperator(),
'value' => $ruleValue
);
$ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
}
$join = $filterColumn->getJoin();
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => $join,
'customRuleForBlanks' => $customRuleForBlanks
)
'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
);
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
@ -714,19 +704,17 @@ 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
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
$ruleValues[] = array( 'operator' => $operator,
$ruleValues[] = array('operator' => $operator,
'value' => $average
);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
);
} else {
// Date based
@ -774,18 +762,12 @@ class PHPExcel_Worksheet_AutoFilter
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
$ruleValues[] = array( 'operator' => $operator,
'value' => $maxVal
);
$ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
);
$filterColumn->setAttributes(
array('maxVal' => $maxVal)
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
);
$filterColumn->setAttributes(array('maxVal' => $maxVal));
break;
}
}
@ -796,7 +778,7 @@ 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;
$result = TRUE;
$result = true;
foreach ($columnFilterTests as $columnID => $columnFilterTest) {
// echo 'Testing cell ', $columnID.$row,PHP_EOL;
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
@ -805,15 +787,13 @@ class PHPExcel_Worksheet_AutoFilter
$result = $result &&
call_user_func_array(
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
array(
$cellValue,
$columnFilterTest['arguments']
)
array($cellValue, $columnFilterTest['arguments'])
);
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
// If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
if (!$result)
if (!$result) {
break;
}
}
// Set show/hide for the row based on the result of the autoFilter result
// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
@ -827,13 +807,14 @@ class PHPExcel_Worksheet_AutoFilter
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
if ($key == '_workSheet') {
// Detach from worksheet
$this->{$key} = NULL;
$this->{$key} = null;
} else {
$this->{$key} = clone $value;
}
@ -858,5 +839,4 @@ class PHPExcel_Worksheet_AutoFilter
public function __toString() {
return (string) $this->_range;
}
}

View File

@ -220,7 +220,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getJoin() {
public function getJoin()
{
return $this->_join;
}
@ -409,5 +410,4 @@ class PHPExcel_Worksheet_AutoFilter_Column
}
}
}
}

View File

@ -333,7 +333,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
unset($pValue[$key]);
} else {
// Work out what the dateTime grouping will be
$grouping = max($grouping, array_search($key,self::$_dateTimeGroups));
$grouping = max($grouping, array_search($key, self::$_dateTimeGroups));
}
}
if (count($pValue) == 0) {

View File

@ -267,5 +267,4 @@ class PHPExcel_Worksheet_ColumnDimension
}
}
}
}

View File

@ -59,7 +59,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getFilename() {
public function getFilename()
{
return basename($this->_path);
}
@ -68,7 +69,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getIndexedFilename() {
public function getIndexedFilename()
{
$fileName = $this->getFilename();
$fileName = str_replace(' ', '_', $fileName);
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
@ -79,7 +81,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getExtension() {
public function getExtension()
{
$exploded = explode(".", basename($this->_path));
return $exploded[count($exploded) - 1];
}
@ -89,7 +92,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getPath() {
public function getPath()
{
return $this->_path;
}
@ -101,7 +105,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->_path = $pValue;
@ -124,9 +129,10 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_path
$this->_path
. parent::getHashCode()
. __CLASS__
);
@ -135,7 +141,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -104,13 +104,13 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
public function __construct()
{
// Initialise values
$this->_visible = false;
$this->_blurRadius = 6;
$this->_distance = 2;
$this->_direction = 0;
$this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
$this->_alpha = 50;
$this->_visible = false;
$this->_blurRadius = 6;
$this->_distance = 2;
$this->_direction = 0;
$this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
$this->_alpha = 50;
}
/**
@ -118,7 +118,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return boolean
*/
public function getVisible() {
public function getVisible()
{
return $this->_visible;
}
@ -128,7 +129,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param boolean $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setVisible($pValue = false) {
public function setVisible($pValue = false)
{
$this->_visible = $pValue;
return $this;
}
@ -138,7 +140,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getBlurRadius() {
public function getBlurRadius()
{
return $this->_blurRadius;
}
@ -148,7 +151,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setBlurRadius($pValue = 6) {
public function setBlurRadius($pValue = 6)
{
$this->_blurRadius = $pValue;
return $this;
}
@ -158,7 +162,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getDistance() {
public function getDistance()
{
return $this->_distance;
}
@ -168,7 +173,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setDistance($pValue = 2) {
public function setDistance($pValue = 2)
{
$this->_distance = $pValue;
return $this;
}
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getDirection() {
public function getDirection()
{
return $this->_direction;
}
@ -188,7 +195,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setDirection($pValue = 0) {
public function setDirection($pValue = 0)
{
$this->_direction = $pValue;
return $this;
}
@ -198,7 +206,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getAlignment() {
public function getAlignment()
{
return $this->_alignment;
}
@ -208,7 +217,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setAlignment($pValue = 0) {
public function setAlignment($pValue = 0)
{
$this->_alignment = $pValue;
return $this;
}
@ -218,7 +228,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return PHPExcel_Style_Color
*/
public function getColor() {
public function getColor()
{
return $this->_color;
}
@ -229,7 +240,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setColor(PHPExcel_Style_Color $pValue = null) {
public function setColor(PHPExcel_Style_Color $pValue = null)
{
$this->_color = $pValue;
return $this;
}
@ -239,7 +251,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getAlpha() {
public function getAlpha()
{
return $this->_alpha;
}
@ -249,7 +262,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setAlpha($pValue = 0) {
public function setAlpha($pValue = 0)
{
$this->_alpha = $pValue;
return $this;
}
@ -259,9 +273,10 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
($this->_visible ? 't' : 'f')
($this->_visible ? 't' : 'f')
. $this->_blurRadius
. $this->_distance
. $this->_direction
@ -275,7 +290,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -15,7 +15,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* License along with this library; if not,241 write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
@ -192,7 +192,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getOddHeader() {
public function getOddHeader()
{
return $this->_oddHeader;
}
@ -202,7 +203,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setOddHeader($pValue) {
public function setOddHeader($pValue)
{
$this->_oddHeader = $pValue;
return $this;
}
@ -212,7 +214,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getOddFooter() {
public function getOddFooter()
{
return $this->_oddFooter;
}
@ -222,7 +225,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setOddFooter($pValue) {
public function setOddFooter($pValue)
{
$this->_oddFooter = $pValue;
return $this;
}
@ -232,7 +236,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getEvenHeader() {
public function getEvenHeader()
{
return $this->_evenHeader;
}
@ -242,7 +247,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setEvenHeader($pValue) {
public function setEvenHeader($pValue)
{
$this->_evenHeader = $pValue;
return $this;
}
@ -252,7 +258,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getEvenFooter() {
public function getEvenFooter()
{
return $this->_evenFooter;
}
@ -262,7 +269,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setEvenFooter($pValue) {
public function setEvenFooter($pValue)
{
$this->_evenFooter = $pValue;
return $this;
}
@ -272,7 +280,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getFirstHeader() {
public function getFirstHeader()
{
return $this->_firstHeader;
}
@ -282,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstHeader($pValue) {
public function setFirstHeader($pValue)
{
$this->_firstHeader = $pValue;
return $this;
}
@ -292,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getFirstFooter() {
public function getFirstFooter()
{
return $this->_firstFooter;
}
@ -302,7 +313,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstFooter($pValue) {
public function setFirstFooter($pValue)
{
$this->_firstFooter = $pValue;
return $this;
}
@ -312,7 +324,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getDifferentOddEven() {
public function getDifferentOddEven()
{
return $this->_differentOddEven;
}
@ -322,7 +335,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setDifferentOddEven($pValue = false) {
public function setDifferentOddEven($pValue = false)
{
$this->_differentOddEven = $pValue;
return $this;
}
@ -332,7 +346,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getDifferentFirst() {
public function getDifferentFirst()
{
return $this->_differentFirst;
}
@ -342,7 +357,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setDifferentFirst($pValue = false) {
public function setDifferentFirst($pValue = false)
{
$this->_differentFirst = $pValue;
return $this;
}
@ -352,7 +368,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getScaleWithDocument() {
public function getScaleWithDocument()
{
return $this->_scaleWithDocument;
}
@ -362,7 +379,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setScaleWithDocument($pValue = true) {
public function setScaleWithDocument($pValue = true)
{
$this->_scaleWithDocument = $pValue;
return $this;
}
@ -372,7 +390,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getAlignWithMargins() {
public function getAlignWithMargins()
{
return $this->_alignWithMargins;
}
@ -382,7 +401,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setAlignWithMargins($pValue = true) {
public function setAlignWithMargins($pValue = true)
{
$this->_alignWithMargins = $pValue;
return $this;
}
@ -395,7 +415,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) {
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
{
$this->_headerFooterImages[$location] = $image;
return $this;
}
@ -407,7 +428,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function removeImage($location = self::IMAGE_HEADER_LEFT) {
public function removeImage($location = self::IMAGE_HEADER_LEFT)
{
if (isset($this->_headerFooterImages[$location])) {
unset($this->_headerFooterImages[$location]);
}
@ -421,7 +443,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setImages($images) {
public function setImages($images)
{
if (!is_array($images)) {
throw new PHPExcel_Exception('Invalid parameter!');
}
@ -435,15 +458,28 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
*/
public function getImages() {
public function getImages()
{
// Sort array
$images = array();
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) {
$images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
}
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) {
$images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
}
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
$images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
$images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
$images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
$images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
}
$this->_headerFooterImages = $images;
return $this->_headerFooterImages;
@ -452,7 +488,8 @@ class PHPExcel_Worksheet_HeaderFooter
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -195,7 +195,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -107,81 +107,81 @@
class PHPExcel_Worksheet_PageSetup
{
/* Paper size */
const PAPERSIZE_LETTER = 1;
const PAPERSIZE_LETTER = 1;
const PAPERSIZE_LETTER_SMALL = 2;
const PAPERSIZE_TABLOID = 3;
const PAPERSIZE_LEDGER = 4;
const PAPERSIZE_LEGAL = 5;
const PAPERSIZE_STATEMENT = 6;
const PAPERSIZE_EXECUTIVE = 7;
const PAPERSIZE_A3 = 8;
const PAPERSIZE_A4 = 9;
const PAPERSIZE_TABLOID = 3;
const PAPERSIZE_LEDGER = 4;
const PAPERSIZE_LEGAL = 5;
const PAPERSIZE_STATEMENT = 6;
const PAPERSIZE_EXECUTIVE = 7;
const PAPERSIZE_A3 = 8;
const PAPERSIZE_A4 = 9;
const PAPERSIZE_A4_SMALL = 10;
const PAPERSIZE_A5 = 11;
const PAPERSIZE_B4 = 12;
const PAPERSIZE_B5 = 13;
const PAPERSIZE_FOLIO = 14;
const PAPERSIZE_QUARTO = 15;
const PAPERSIZE_STANDARD_1 = 16;
const PAPERSIZE_STANDARD_2 = 17;
const PAPERSIZE_A5 = 11;
const PAPERSIZE_B4 = 12;
const PAPERSIZE_B5 = 13;
const PAPERSIZE_FOLIO = 14;
const PAPERSIZE_QUARTO = 15;
const PAPERSIZE_STANDARD_1 = 16;
const PAPERSIZE_STANDARD_2 = 17;
const PAPERSIZE_NOTE = 18;
const PAPERSIZE_NO9_ENVELOPE = 19;
const PAPERSIZE_NO10_ENVELOPE = 20;
const PAPERSIZE_NO11_ENVELOPE = 21;
const PAPERSIZE_NO12_ENVELOPE = 22;
const PAPERSIZE_NO14_ENVELOPE = 23;
const PAPERSIZE_C = 24;
const PAPERSIZE_D = 25;
const PAPERSIZE_E = 26;
const PAPERSIZE_DL_ENVELOPE = 27;
const PAPERSIZE_C5_ENVELOPE = 28;
const PAPERSIZE_C3_ENVELOPE = 29;
const PAPERSIZE_C4_ENVELOPE = 30;
const PAPERSIZE_C6_ENVELOPE = 31;
const PAPERSIZE_NO10_ENVELOPE = 20;
const PAPERSIZE_NO11_ENVELOPE = 21;
const PAPERSIZE_NO12_ENVELOPE = 22;
const PAPERSIZE_NO14_ENVELOPE = 23;
const PAPERSIZE_C = 24;
const PAPERSIZE_D = 25;
const PAPERSIZE_E = 26;
const PAPERSIZE_DL_ENVELOPE = 27;
const PAPERSIZE_C5_ENVELOPE = 28;
const PAPERSIZE_C3_ENVELOPE = 29;
const PAPERSIZE_C4_ENVELOPE = 30;
const PAPERSIZE_C6_ENVELOPE = 31;
const PAPERSIZE_C65_ENVELOPE = 32;
const PAPERSIZE_B4_ENVELOPE = 33;
const PAPERSIZE_B5_ENVELOPE = 34;
const PAPERSIZE_B6_ENVELOPE = 35;
const PAPERSIZE_ITALY_ENVELOPE = 36;
const PAPERSIZE_B4_ENVELOPE = 33;
const PAPERSIZE_B5_ENVELOPE = 34;
const PAPERSIZE_B6_ENVELOPE = 35;
const PAPERSIZE_ITALY_ENVELOPE = 36;
const PAPERSIZE_MONARCH_ENVELOPE = 37;
const PAPERSIZE_6_3_4_ENVELOPE = 38;
const PAPERSIZE_US_STANDARD_FANFOLD = 39;
const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
const PAPERSIZE_6_3_4_ENVELOPE = 38;
const PAPERSIZE_US_STANDARD_FANFOLD = 39;
const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41;
const PAPERSIZE_ISO_B4 = 42;
const PAPERSIZE_ISO_B4 = 42;
const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43;
const PAPERSIZE_STANDARD_PAPER_1 = 44;
const PAPERSIZE_STANDARD_PAPER_2 = 45;
const PAPERSIZE_STANDARD_PAPER_3 = 46;
const PAPERSIZE_INVITE_ENVELOPE = 47;
const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
const PAPERSIZE_A4_EXTRA_PAPER = 51;
const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
const PAPERSIZE_LETTER_PLUS_PAPER = 57;
const PAPERSIZE_A4_PLUS_PAPER = 58;
const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
const PAPERSIZE_A3_EXTRA_PAPER = 61;
const PAPERSIZE_A5_EXTRA_PAPER = 62;
const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
const PAPERSIZE_INVITE_ENVELOPE = 47;
const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
const PAPERSIZE_A4_EXTRA_PAPER = 51;
const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
const PAPERSIZE_LETTER_PLUS_PAPER = 57;
const PAPERSIZE_A4_PLUS_PAPER = 58;
const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
const PAPERSIZE_A3_EXTRA_PAPER = 61;
const PAPERSIZE_A5_EXTRA_PAPER = 62;
const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
const PAPERSIZE_A2_PAPER = 64;
const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
/* Page orientation */
const ORIENTATION_DEFAULT = 'default';
const ORIENTATION_LANDSCAPE = 'landscape';
const ORIENTATION_PORTRAIT = 'portrait';
const ORIENTATION_DEFAULT = 'default';
const ORIENTATION_LANDSCAPE = 'landscape';
const ORIENTATION_PORTRAIT = 'portrait';
/* Print Range Set Method */
const SETPRINTRANGE_OVERWRITE = 'O';
const SETPRINTRANGE_INSERT = 'I';
const SETPRINTRANGE_OVERWRITE = 'O';
const SETPRINTRANGE_INSERT = 'I';
/**
@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int
*/
private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
/**
* Orientation
*
* @var string
*/
private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
/**
* Scale (Print Scale)
@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_scale = 100;
private $_scale = 100;
/**
* Fit To Page
@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_fitToPage = FALSE;
private $_fitToPage = false;
/**
* Fit To Height
@ -251,28 +251,28 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_horizontalCentered = FALSE;
private $_horizontalCentered = false;
/**
* Center page vertically
*
* @var boolean
*/
private $_verticalCentered = FALSE;
private $_verticalCentered = false;
/**
* Print area
*
* @var string
*/
private $_printArea = NULL;
private $_printArea = null;
/**
* First page number
*
* @var int
*/
private $_firstPageNumber = NULL;
private $_firstPageNumber = null;
/**
* Create a new PHPExcel_Worksheet_PageSetup
@ -286,7 +286,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int
*/
public function getPaperSize() {
public function getPaperSize()
{
return $this->_paperSize;
}
@ -296,7 +297,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) {
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
{
$this->_paperSize = $pValue;
return $this;
}
@ -306,7 +308,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return string
*/
public function getOrientation() {
public function getOrientation()
{
return $this->_orientation;
}
@ -316,7 +319,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) {
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
{
$this->_orientation = $pValue;
return $this;
}
@ -326,7 +330,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int?
*/
public function getScale() {
public function getScale()
{
return $this->_scale;
}
@ -341,7 +346,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setScale($pValue = 100, $pUpdate = true) {
public function setScale($pValue = 100, $pUpdate = true)
{
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 0, where 0 results in 100
if (($pValue >= 0) || is_null($pValue)) {
@ -370,7 +376,8 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToPage($pValue = TRUE) {
public function setFitToPage($pValue = true)
{
$this->_fitToPage = $pValue;
return $this;
}
@ -380,7 +387,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int?
*/
public function getFitToHeight() {
public function getFitToHeight()
{
return $this->_fitToHeight;
}
@ -391,10 +399,11 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToHeight($pValue = 1, $pUpdate = TRUE) {
public function setFitToHeight($pValue = 1, $pUpdate = true)
{
$this->_fitToHeight = $pValue;
if ($pUpdate) {
$this->_fitToPage = TRUE;
$this->_fitToPage = true;
}
return $this;
}
@ -404,7 +413,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int?
*/
public function getFitToWidth() {
public function getFitToWidth()
{
return $this->_fitToWidth;
}
@ -415,10 +425,11 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToWidth($pValue = 1, $pUpdate = TRUE) {
public function setFitToWidth($pValue = 1, $pUpdate = true)
{
$this->_fitToWidth = $pValue;
if ($pUpdate) {
$this->_fitToPage = TRUE;
$this->_fitToPage = true;
}
return $this;
}
@ -428,7 +439,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return boolean
*/
public function isColumnsToRepeatAtLeftSet() {
public function isColumnsToRepeatAtLeftSet()
{
if (is_array($this->_columnsToRepeatAtLeft)) {
if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
return true;
@ -443,7 +455,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return array Containing start column and end column, empty array if option unset
*/
public function getColumnsToRepeatAtLeft() {
public function getColumnsToRepeatAtLeft()
{
return $this->_columnsToRepeatAtLeft;
}
@ -453,7 +466,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup
*/
public function setColumnsToRepeatAtLeft($pValue = null) {
public function setColumnsToRepeatAtLeft($pValue = null)
{
if (is_array($pValue)) {
$this->_columnsToRepeatAtLeft = $pValue;
}
@ -467,7 +481,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pEnd
* @return PHPExcel_Worksheet_PageSetup
*/
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') {
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A')
{
$this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
return $this;
}
@ -477,7 +492,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return boolean
*/
public function isRowsToRepeatAtTopSet() {
public function isRowsToRepeatAtTopSet()
{
if (is_array($this->_rowsToRepeatAtTop)) {
if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
return true;
@ -492,7 +508,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return array Containing start column and end column, empty array if option unset
*/
public function getRowsToRepeatAtTop() {
public function getRowsToRepeatAtTop()
{
return $this->_rowsToRepeatAtTop;
}
@ -502,7 +519,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup
*/
public function setRowsToRepeatAtTop($pValue = null) {
public function setRowsToRepeatAtTop($pValue = null)
{
if (is_array($pValue)) {
$this->_rowsToRepeatAtTop = $pValue;
}
@ -516,7 +534,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pEnd
* @return PHPExcel_Worksheet_PageSetup
*/
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) {
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1)
{
$this->_rowsToRepeatAtTop = array($pStart, $pEnd);
return $this;
}
@ -526,7 +545,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return bool
*/
public function getHorizontalCentered() {
public function getHorizontalCentered()
{
return $this->_horizontalCentered;
}
@ -536,7 +556,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value
* @return PHPExcel_Worksheet_PageSetup
*/
public function setHorizontalCentered($value = false) {
public function setHorizontalCentered($value = false)
{
$this->_horizontalCentered = $value;
return $this;
}
@ -546,7 +567,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return bool
*/
public function getVerticalCentered() {
public function getVerticalCentered()
{
return $this->_verticalCentered;
}
@ -556,7 +578,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value
* @return PHPExcel_Worksheet_PageSetup
*/
public function setVerticalCentered($value = false) {
public function setVerticalCentered($value = false)
{
$this->_verticalCentered = $value;
return $this;
}
@ -571,7 +594,8 @@ class PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
* @return string
*/
public function getPrintArea($index = 0) {
public function getPrintArea($index = 0)
{
if ($index == 0) {
return $this->_printArea;
}
@ -591,7 +615,8 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1
* @return boolean
*/
public function isPrintAreaSet($index = 0) {
public function isPrintAreaSet($index = 0)
{
if ($index == 0) {
return !is_null($this->_printArea);
}
@ -608,9 +633,10 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup
*/
public function clearPrintArea($index = 0) {
public function clearPrintArea($index = 0)
{
if ($index == 0) {
$this->_printArea = NULL;
$this->_printArea = null;
} else {
$printAreas = explode(',', $this->_printArea);
if (isset($printAreas[$index-1])) {
@ -642,12 +668,13 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) {
if (strpos($value,'!') !== false) {
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
if (strpos($value, '!') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
} elseif (strpos($value,':') === false) {
} elseif (strpos($value, ':') === false) {
throw new PHPExcel_Exception('Cell coordinate must be a range of cells.');
} elseif (strpos($value,'$') !== false) {
} elseif (strpos($value, '$') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
}
$value = strtoupper($value);
@ -677,7 +704,7 @@ class PHPExcel_Worksheet_PageSetup
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));
$printAreas = array_merge(array_slice($printAreas, 0, $index), array($value), array_slice($printAreas, $index));
$this->_printArea = implode(',', $printAreas);
}
} else {
@ -700,7 +727,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function addPrintArea($value, $index = -1) {
public function addPrintArea($value, $index = -1)
{
return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
}
@ -758,7 +786,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int
*/
public function getFirstPageNumber() {
public function getFirstPageNumber()
{
return $this->_firstPageNumber;
}
@ -768,7 +797,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $value
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstPageNumber($value = null) {
public function setFirstPageNumber($value = null)
{
$this->_firstPageNumber = $value;
return $this;
}
@ -778,14 +808,16 @@ class PHPExcel_Worksheet_PageSetup
*
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function resetFirstPageNumber() {
public function resetFirstPageNumber()
{
return $this->setFirstPageNumber(null);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -166,8 +166,9 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function isProtectionEnabled() {
return $this->_sheet ||
function isProtectionEnabled()
{
return $this->_sheet ||
$this->_objects ||
$this->_scenarios ||
$this->_formatCells ||
@ -190,7 +191,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSheet() {
function getSheet()
{
return $this->_sheet;
}
@ -200,7 +202,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSheet($pValue = false) {
function setSheet($pValue = false)
{
$this->_sheet = $pValue;
return $this;
}
@ -210,7 +213,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getObjects() {
function getObjects()
{
return $this->_objects;
}
@ -220,7 +224,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setObjects($pValue = false) {
function setObjects($pValue = false)
{
$this->_objects = $pValue;
return $this;
}
@ -230,7 +235,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getScenarios() {
function getScenarios()
{
return $this->_scenarios;
}
@ -240,7 +246,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setScenarios($pValue = false) {
function setScenarios($pValue = false)
{
$this->_scenarios = $pValue;
return $this;
}
@ -250,7 +257,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatCells() {
function getFormatCells()
{
return $this->_formatCells;
}
@ -260,7 +268,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatCells($pValue = false) {
function setFormatCells($pValue = false)
{
$this->_formatCells = $pValue;
return $this;
}
@ -270,7 +279,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatColumns() {
function getFormatColumns()
{
return $this->_formatColumns;
}
@ -280,7 +290,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatColumns($pValue = false) {
function setFormatColumns($pValue = false)
{
$this->_formatColumns = $pValue;
return $this;
}
@ -290,7 +301,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatRows() {
function getFormatRows()
{
return $this->_formatRows;
}
@ -300,7 +312,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatRows($pValue = false) {
function setFormatRows($pValue = false)
{
$this->_formatRows = $pValue;
return $this;
}
@ -310,7 +323,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertColumns() {
function getInsertColumns()
{
return $this->_insertColumns;
}
@ -320,7 +334,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertColumns($pValue = false) {
function setInsertColumns($pValue = false)
{
$this->_insertColumns = $pValue;
return $this;
}
@ -330,7 +345,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertRows() {
function getInsertRows()
{
return $this->_insertRows;
}
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertRows($pValue = false) {
function setInsertRows($pValue = false)
{
$this->_insertRows = $pValue;
return $this;
}
@ -350,7 +367,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertHyperlinks() {
function getInsertHyperlinks()
{
return $this->_insertHyperlinks;
}
@ -360,7 +378,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertHyperlinks($pValue = false) {
function setInsertHyperlinks($pValue = false)
{
$this->_insertHyperlinks = $pValue;
return $this;
}
@ -370,7 +389,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteColumns() {
function getDeleteColumns()
{
return $this->_deleteColumns;
}
@ -380,7 +400,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteColumns($pValue = false) {
function setDeleteColumns($pValue = false)
{
$this->_deleteColumns = $pValue;
return $this;
}
@ -390,7 +411,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteRows() {
function getDeleteRows()
{
return $this->_deleteRows;
}
@ -400,7 +422,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteRows($pValue = false) {
function setDeleteRows($pValue = false)
{
$this->_deleteRows = $pValue;
return $this;
}
@ -410,7 +433,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectLockedCells() {
function getSelectLockedCells()
{
return $this->_selectLockedCells;
}
@ -420,7 +444,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectLockedCells($pValue = false) {
function setSelectLockedCells($pValue = false)
{
$this->_selectLockedCells = $pValue;
return $this;
}
@ -430,7 +455,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSort() {
function getSort()
{
return $this->_sort;
}
@ -440,7 +466,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSort($pValue = false) {
function setSort($pValue = false)
{
$this->_sort = $pValue;
return $this;
}
@ -450,7 +477,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getAutoFilter() {
function getAutoFilter()
{
return $this->_autoFilter;
}
@ -460,7 +488,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setAutoFilter($pValue = false) {
function setAutoFilter($pValue = false)
{
$this->_autoFilter = $pValue;
return $this;
}
@ -470,7 +499,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getPivotTables() {
function getPivotTables()
{
return $this->_pivotTables;
}
@ -480,7 +510,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setPivotTables($pValue = false) {
function setPivotTables($pValue = false)
{
$this->_pivotTables = $pValue;
return $this;
}
@ -490,7 +521,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectUnlockedCells() {
function getSelectUnlockedCells()
{
return $this->_selectUnlockedCells;
}
@ -500,7 +532,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectUnlockedCells($pValue = false) {
function setSelectUnlockedCells($pValue = false)
{
$this->_selectUnlockedCells = $pValue;
return $this;
}
@ -510,7 +543,8 @@ class PHPExcel_Worksheet_Protection
*
* @return string
*/
function getPassword() {
function getPassword()
{
return $this->_password;
}
@ -521,7 +555,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection
*/
function setPassword($pValue = '', $pAlreadyHashed = false) {
function setPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
}
@ -532,7 +567,8 @@ class PHPExcel_Worksheet_Protection
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -65,7 +65,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getIncludeCharts() {
public function getIncludeCharts()
{
return $this->_includeCharts;
}
@ -93,7 +94,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getPreCalculateFormulas() {
public function getPreCalculateFormulas()
{
return $this->_preCalculateFormulas;
}
@ -105,7 +107,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter
*/
public function setPreCalculateFormulas($pValue = TRUE) {
public function setPreCalculateFormulas($pValue = true)
{
$this->_preCalculateFormulas = (boolean) $pValue;
return $this;
}
@ -115,7 +118,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getUseDiskCaching() {
public function getUseDiskCaching()
{
return $this->_useDiskCaching;
}
@ -127,10 +131,11 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007
*/
public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) {
public function setUseDiskCaching($pValue = false, $pDirectory = null)
{
$this->_useDiskCaching = $pValue;
if ($pDirectory !== NULL) {
if ($pDirectory !== null) {
if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory;
} else {
@ -145,7 +150,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return string
*/
public function getDiskCachingDirectory() {
public function getDiskCachingDirectory()
{
return $this->_diskCachingDirectory;
}
}

View File

@ -257,7 +257,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
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

View File

@ -32,7 +32,8 @@
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart {
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
{
/**
* Write charts to XML format
*
@ -41,7 +42,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeChart(PHPExcel_Chart $pChart = null) {
public function writeChart(PHPExcel_Chart $pChart = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -115,7 +117,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) {
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
{
if (is_null($title)) {
return;
}
@ -159,7 +162,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) {
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
{
if (is_null($legend)) {
return;
}
@ -213,7 +217,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines )
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines)
{
if (is_null($plotArea)) {
return;
@ -349,7 +353,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeDataLbls($objWriter, $chartLayout) {
private function _writeDataLbls($objWriter, $chartLayout)
{
$objWriter->startElement('c:dLbls');
$objWriter->startElement('c:showLegendKey');
@ -403,7 +408,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) {
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
{
$objWriter->startElement('c:catAx');
if ($id1 > 0) {
@ -524,7 +530,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) {
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
{
$objWriter->startElement('c:valAx');
if ($id2 > 0) {
@ -1004,7 +1011,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string|array
* @throws PHPExcel_Writer_Exception
*/
private static function _getChartType($plotArea) {
private static function _getChartType($plotArea)
{
$groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) {
@ -1036,7 +1044,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) {
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotGroup)) {
return;
}
@ -1209,7 +1218,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) {
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter)
{
if (is_null($plotSeriesLabel)) {
return;
}
@ -1246,7 +1256,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) {
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) {
return;
}
@ -1337,7 +1348,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) {
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) {
return;
}
@ -1383,7 +1395,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) {
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
{
$objWriter->startElement('c:layout');
if (!is_null($layout)) {
@ -1451,7 +1464,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeAlternateContent($objWriter) {
private function _writeAlternateContent($objWriter)
{
$objWriter->startElement('mc:AlternateContent');
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
@ -1480,7 +1494,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePrintSettings($objWriter) {
private function _writePrintSettings($objWriter)
{
$objWriter->startElement('c:printSettings');
$objWriter->startElement('c:headerFooter');

View File

@ -71,19 +71,19 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
$objWriter->startElement('comments');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
// Loop through authors
$objWriter->startElement('authors');
foreach ($authors as $author => $index) {
$objWriter->writeElement('author', $author);
}
$objWriter->endElement();
// Loop through authors
$objWriter->startElement('authors');
foreach ($authors as $author => $index) {
$objWriter->writeElement('author', $author);
}
$objWriter->endElement();
// Loop through comments
$objWriter->startElement('commentList');
foreach ($comments as $key => $value) {
$this->_writeComment($objWriter, $key, $value, $authors);
}
$objWriter->endElement();
// Loop through comments
$objWriter->startElement('commentList');
foreach ($comments as $key => $value) {
$this->_writeComment($objWriter, $key, $value, $authors);
}
$objWriter->endElement();
$objWriter->endElement();
@ -104,13 +104,13 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
{
// comment
$objWriter->startElement('comment');
$objWriter->writeAttribute('ref', $pCellReference);
$objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
$objWriter->writeAttribute('ref', $pCellReference);
$objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
// text
$objWriter->startElement('text');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
$objWriter->endElement();
// text
$objWriter->startElement('text');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
$objWriter->endElement();
$objWriter->endElement();
}
@ -144,42 +144,42 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
// o:shapelayout
$objWriter->startElement('o:shapelayout');
$objWriter->writeAttribute('v:ext', 'edit');
// o:idmap
$objWriter->startElement('o:idmap');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('data', '1');
$objWriter->endElement();
// o:shapelayout
$objWriter->startElement('o:shapelayout');
$objWriter->writeAttribute('v:ext', 'edit');
// o:idmap
$objWriter->startElement('o:idmap');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('data', '1');
$objWriter->endElement();
// v:shapetype
$objWriter->startElement('v:shapetype');
$objWriter->writeAttribute('id', '_x0000_t202');
$objWriter->writeAttribute('coordsize', '21600,21600');
$objWriter->writeAttribute('o:spt', '202');
$objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
$objWriter->endElement();
// v:stroke
$objWriter->startElement('v:stroke');
$objWriter->writeAttribute('joinstyle', 'miter');
$objWriter->endElement();
// v:path
$objWriter->startElement('v:path');
$objWriter->writeAttribute('gradientshapeok', 't');
$objWriter->writeAttribute('o:connecttype', 'rect');
$objWriter->endElement();
// v:shapetype
$objWriter->startElement('v:shapetype');
$objWriter->writeAttribute('id', '_x0000_t202');
$objWriter->writeAttribute('coordsize', '21600,21600');
$objWriter->writeAttribute('o:spt', '202');
$objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
// v:stroke
$objWriter->startElement('v:stroke');
$objWriter->writeAttribute('joinstyle', 'miter');
$objWriter->endElement();
// Loop through comments
foreach ($comments as $key => $value) {
$this->_writeVMLComment($objWriter, $key, $value);
}
// v:path
$objWriter->startElement('v:path');
$objWriter->writeAttribute('gradientshapeok', 't');
$objWriter->writeAttribute('o:connecttype', 'rect');
$objWriter->endElement();
$objWriter->endElement();
// Loop through comments
foreach ($comments as $key => $value) {
$this->_writeVMLComment($objWriter, $key, $value);
}
$objWriter->endElement();
@ -205,22 +205,22 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
// v:shape
$objWriter->startElement('v:shape');
$objWriter->writeAttribute('id', '_x0000_s' . $id);
$objWriter->writeAttribute('type', '#_x0000_t202');
$objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden'));
$objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
$objWriter->writeAttribute('o:insetmode', 'auto');
$objWriter->writeAttribute('id', '_x0000_s' . $id);
$objWriter->writeAttribute('type', '#_x0000_t202');
$objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden'));
$objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
$objWriter->writeAttribute('o:insetmode', 'auto');
// v:fill
$objWriter->startElement('v:fill');
$objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
$objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
$objWriter->endElement();
// v:shadow
$objWriter->startElement('v:shadow');
$objWriter->writeAttribute('on', 't');
$objWriter->writeAttribute('color', 'black');
$objWriter->writeAttribute('obscured', 't');
$objWriter->writeAttribute('on', 't');
$objWriter->writeAttribute('color', 'black');
$objWriter->writeAttribute('obscured', 't');
$objWriter->endElement();
// v:path

View File

@ -60,125 +60,126 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$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');
// Theme
$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');
// Styles
$this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
// Rels
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
// Rels
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
// XML
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
// XML
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
// VML
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
// VML
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
// 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');
//... and define a new type for the VBA project
$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');
// 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');
//... and define a new type for the VBA project
$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');
}
} 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/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');
}
// 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');
}
// Shared strings
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
// Add worksheet relationship content types
$chart = 1;
for ($i = 0; $i < $sheetCount; ++$i) {
$drawings = $pPHPExcel->getSheet($i)->getDrawingCollection();
$drawingCount = count($drawings);
$chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0;
// 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');
}
// 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');
}
} else {// no macros in workbook, so standard type
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
}
}
// 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');
}
}
// Add media content-types
$aMediaContentTypes = array();
$mediaCount = $this->getParentWriter()->getDrawingHashTable()->count();
for ($i = 0; $i < $mediaCount; ++$i) {
$extension = '';
$mimeType = '';
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];
$mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
}
// DocProps
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
if (!isset( $aMediaContentTypes[$extension])) {
$aMediaContentTypes[$extension] = $mimeType;
$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->_writeDefaultContentType($objWriter, $extension, $mimeType);
}
// 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');
}
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) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
$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());
// Shared strings
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
// Add worksheet relationship content types
$chart = 1;
for ($i = 0; $i < $sheetCount; ++$i) {
$drawings = $pPHPExcel->getSheet($i)->getDrawingCollection();
$drawingCount = count($drawings);
$chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0;
// 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');
}
// 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');
}
}
}
// 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');
}
}
// Add media content-types
$aMediaContentTypes = array();
$mediaCount = $this->getParentWriter()->getDrawingHashTable()->count();
for ($i = 0; $i < $mediaCount; ++$i) {
$extension = '';
$mimeType = '';
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() );
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];
$mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
}
if (!isset( $aMediaContentTypes[$extension]) ) {
$aMediaContentTypes[$extension] = $mimeType;
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
}
}
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) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
$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());
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
}
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
}
}
}
}
$objWriter->endElement();

View File

@ -240,21 +240,21 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('name', $customProperty);
switch ($propertyType) {
case 'i' :
case 'i':
$objWriter->writeElement('vt:i4', $propertyValue);
break;
case 'f' :
case 'f':
$objWriter->writeElement('vt:r8', $propertyValue);
break;
case 'b' :
case 'b':
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
break;
case 'd' :
case 'd':
$objWriter->startElement('vt:filetime');
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
$objWriter->endElement();
break;
default :
default:
$objWriter->writeElement('vt:lpwstr', $propertyValue);
break;
}

View File

@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -62,26 +62,25 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
$objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
// Loop through images and write drawings
$i = 1;
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
$this->_writeDrawing($objWriter, $iterator->current(), $i);
// Loop through images and write drawings
$i = 1;
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
$this->_writeDrawing($objWriter, $iterator->current(), $i);
$iterator->next();
++$i;
}
$iterator->next();
++$i;
}
if ($includeCharts) {
$chartCount = $pWorksheet->getChartCount();
// Loop through charts and write the chart position
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c+$i);
}
if ($includeCharts) {
$chartCount = $pWorksheet->getChartCount();
// Loop through charts and write the chart position
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c+$i);
}
}
}
$objWriter->endElement();
@ -174,81 +173,81 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
if ($pRelationId >= 0) {
// xdr:oneCellAnchor
$objWriter->startElement('xdr:oneCellAnchor');
// Image location
$aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
$aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);
// Image location
$aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
$aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);
// xdr:from
$objWriter->startElement('xdr:from');
$objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
$objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
$objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
$objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
$objWriter->endElement();
// xdr:from
$objWriter->startElement('xdr:from');
$objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
$objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
$objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
$objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
$objWriter->endElement();
// xdr:ext
$objWriter->startElement('xdr:ext');
$objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
$objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
$objWriter->endElement();
// xdr:ext
$objWriter->startElement('xdr:ext');
$objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
$objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
$objWriter->endElement();
// xdr:pic
$objWriter->startElement('xdr:pic');
// xdr:pic
$objWriter->startElement('xdr:pic');
// xdr:nvPicPr
$objWriter->startElement('xdr:nvPicPr');
// xdr:nvPicPr
$objWriter->startElement('xdr:nvPicPr');
// xdr:cNvPr
$objWriter->startElement('xdr:cNvPr');
$objWriter->writeAttribute('id', $pRelationId);
$objWriter->writeAttribute('name', $pDrawing->getName());
$objWriter->writeAttribute('descr', $pDrawing->getDescription());
$objWriter->endElement();
// xdr:cNvPr
$objWriter->startElement('xdr:cNvPr');
$objWriter->writeAttribute('id', $pRelationId);
$objWriter->writeAttribute('name', $pDrawing->getName());
$objWriter->writeAttribute('descr', $pDrawing->getDescription());
$objWriter->endElement();
// xdr:cNvPicPr
$objWriter->startElement('xdr:cNvPicPr');
// xdr:cNvPicPr
$objWriter->startElement('xdr:cNvPicPr');
// a:picLocks
$objWriter->startElement('a:picLocks');
$objWriter->writeAttribute('noChangeAspect', '1');
$objWriter->endElement();
// a:picLocks
$objWriter->startElement('a:picLocks');
$objWriter->writeAttribute('noChangeAspect', '1');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
// xdr:blipFill
$objWriter->startElement('xdr:blipFill');
// xdr:blipFill
$objWriter->startElement('xdr:blipFill');
// a:blip
$objWriter->startElement('a:blip');
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
$objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
$objWriter->endElement();
// a:blip
$objWriter->startElement('a:blip');
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
$objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
$objWriter->endElement();
// a:stretch
$objWriter->startElement('a:stretch');
$objWriter->writeElement('a:fillRect', null);
$objWriter->endElement();
// a:stretch
$objWriter->startElement('a:stretch');
$objWriter->writeElement('a:fillRect', null);
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
// xdr:spPr
$objWriter->startElement('xdr:spPr');
// xdr:spPr
$objWriter->startElement('xdr:spPr');
// a:xfrm
$objWriter->startElement('a:xfrm');
$objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
$objWriter->endElement();
// a:xfrm
$objWriter->startElement('a:xfrm');
$objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
$objWriter->endElement();
// a:prstGeom
$objWriter->startElement('a:prstGeom');
$objWriter->writeAttribute('prst', 'rect');
// a:prstGeom
$objWriter->startElement('a:prstGeom');
$objWriter->writeAttribute('prst', 'rect');
// a:avLst
$objWriter->writeElement('a:avLst', null);
// a:avLst
$objWriter->writeElement('a:avLst', null);
$objWriter->endElement();
$objWriter->endElement();
// // a:solidFill
// $objWriter->startElement('a:solidFill');
@ -268,110 +267,110 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
// $objWriter->endElement();
/*
// a:ln
$objWriter->startElement('a:ln');
$objWriter->writeAttribute('w', '88900');
$objWriter->writeAttribute('cap', 'sq');
// a:ln
$objWriter->startElement('a:ln');
$objWriter->writeAttribute('w', '88900');
$objWriter->writeAttribute('cap', 'sq');
// a:solidFill
$objWriter->startElement('a:solidFill');
// a:solidFill
$objWriter->startElement('a:solidFill');
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', 'FFFFFF');
$objWriter->endElement();
$objWriter->endElement();
// a:miter
$objWriter->startElement('a:miter');
$objWriter->writeAttribute('lim', '800000');
$objWriter->endElement();
$objWriter->endElement();
*/
if ($pDrawing->getShadow()->getVisible()) {
// a:effectLst
$objWriter->startElement('a:effectLst');
// a:outerShdw
$objWriter->startElement('a:outerShdw');
$objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
$objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
$objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
$objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
$objWriter->writeAttribute('rotWithShape', '0');
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
// a:alpha
$objWriter->startElement('a:alpha');
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
}
/*
// a:scene3d
$objWriter->startElement('a:scene3d');
// a:camera
$objWriter->startElement('a:camera');
$objWriter->writeAttribute('prst', 'orthographicFront');
$objWriter->endElement();
// a:lightRig
$objWriter->startElement('a:lightRig');
$objWriter->writeAttribute('rig', 'twoPt');
$objWriter->writeAttribute('dir', 't');
// a:rot
$objWriter->startElement('a:rot');
$objWriter->writeAttribute('lat', '0');
$objWriter->writeAttribute('lon', '0');
$objWriter->writeAttribute('rev', '0');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
*/
/*
// a:sp3d
$objWriter->startElement('a:sp3d');
// a:bevelT
$objWriter->startElement('a:bevelT');
$objWriter->writeAttribute('w', '25400');
$objWriter->writeAttribute('h', '19050');
$objWriter->endElement();
// a:contourClr
$objWriter->startElement('a:contourClr');
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', 'FFFFFF');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
*/
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', 'FFFFFF');
$objWriter->endElement();
$objWriter->endElement();
// xdr:clientData
$objWriter->writeElement('xdr:clientData', null);
// a:miter
$objWriter->startElement('a:miter');
$objWriter->writeAttribute('lim', '800000');
$objWriter->endElement();
$objWriter->endElement();
*/
if ($pDrawing->getShadow()->getVisible()) {
// a:effectLst
$objWriter->startElement('a:effectLst');
// a:outerShdw
$objWriter->startElement('a:outerShdw');
$objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
$objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
$objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
$objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
$objWriter->writeAttribute('rotWithShape', '0');
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
// a:alpha
$objWriter->startElement('a:alpha');
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
}
/*
// a:scene3d
$objWriter->startElement('a:scene3d');
// a:camera
$objWriter->startElement('a:camera');
$objWriter->writeAttribute('prst', 'orthographicFront');
$objWriter->endElement();
// a:lightRig
$objWriter->startElement('a:lightRig');
$objWriter->writeAttribute('rig', 'twoPt');
$objWriter->writeAttribute('dir', 't');
// a:rot
$objWriter->startElement('a:rot');
$objWriter->writeAttribute('lat', '0');
$objWriter->writeAttribute('lon', '0');
$objWriter->writeAttribute('rev', '0');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
*/
/*
// a:sp3d
$objWriter->startElement('a:sp3d');
// a:bevelT
$objWriter->startElement('a:bevelT');
$objWriter->writeAttribute('w', '25400');
$objWriter->writeAttribute('h', '19050');
$objWriter->endElement();
// a:contourClr
$objWriter->startElement('a:contourClr');
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', 'FFFFFF');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
*/
$objWriter->endElement();
$objWriter->endElement();
// xdr:clientData
$objWriter->writeElement('xdr:clientData', null);
$objWriter->endElement();
} else {
@ -399,8 +398,8 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
// XML header
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
// Header/footer images
$images = $pWorksheet->getHeaderFooter()->getImages();
// Header/footer images
$images = $pWorksheet->getHeaderFooter()->getImages();
// xml
$objWriter->startElement('xml');
@ -408,117 +407,117 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
// o:shapelayout
$objWriter->startElement('o:shapelayout');
$objWriter->writeAttribute('v:ext', 'edit');
// o:shapelayout
$objWriter->startElement('o:shapelayout');
$objWriter->writeAttribute('v:ext', 'edit');
// o:idmap
$objWriter->startElement('o:idmap');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('data', '1');
$objWriter->endElement();
// o:idmap
$objWriter->startElement('o:idmap');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('data', '1');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
// v:shapetype
$objWriter->startElement('v:shapetype');
$objWriter->writeAttribute('id', '_x0000_t75');
$objWriter->writeAttribute('coordsize', '21600,21600');
$objWriter->writeAttribute('o:spt', '75');
$objWriter->writeAttribute('o:preferrelative', 't');
$objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
$objWriter->writeAttribute('filled', 'f');
$objWriter->writeAttribute('stroked', 'f');
// v:shapetype
$objWriter->startElement('v:shapetype');
$objWriter->writeAttribute('id', '_x0000_t75');
$objWriter->writeAttribute('coordsize', '21600,21600');
$objWriter->writeAttribute('o:spt', '75');
$objWriter->writeAttribute('o:preferrelative', 't');
$objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
$objWriter->writeAttribute('filled', 'f');
$objWriter->writeAttribute('stroked', 'f');
// v:stroke
$objWriter->startElement('v:stroke');
$objWriter->writeAttribute('joinstyle', 'miter');
$objWriter->endElement();
// v:stroke
$objWriter->startElement('v:stroke');
$objWriter->writeAttribute('joinstyle', 'miter');
$objWriter->endElement();
// v:formulas
$objWriter->startElement('v:formulas');
// v:formulas
$objWriter->startElement('v:formulas');
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @0 1 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @0 1 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum 0 0 @1');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum 0 0 @1');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @2 1 2');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @2 1 2');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @0 0 1');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @0 0 1');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @6 1 2');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @6 1 2');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @8 21600 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @8 21600 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @10 21600 0');
$objWriter->endElement();
// v:f
$objWriter->startElement('v:f');
$objWriter->writeAttribute('eqn', 'sum @10 21600 0');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
// v:path
$objWriter->startElement('v:path');
$objWriter->writeAttribute('o:extrusionok', 'f');
$objWriter->writeAttribute('gradientshapeok', 't');
$objWriter->writeAttribute('o:connecttype', 'rect');
$objWriter->endElement();
// v:path
$objWriter->startElement('v:path');
$objWriter->writeAttribute('o:extrusionok', 'f');
$objWriter->writeAttribute('gradientshapeok', 't');
$objWriter->writeAttribute('o:connecttype', 'rect');
$objWriter->endElement();
// o:lock
$objWriter->startElement('o:lock');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('aspectratio', 't');
$objWriter->endElement();
// o:lock
$objWriter->startElement('o:lock');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('aspectratio', 't');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
// Loop through images
foreach ($images as $key => $value) {
$this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
}
// Loop through images
foreach ($images as $key => $value) {
$this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
}
$objWriter->endElement();
@ -548,22 +547,22 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
// v:shape
$objWriter->startElement('v:shape');
$objWriter->writeAttribute('id', $pReference);
$objWriter->writeAttribute('o:spid', '_x0000_s' . $id);
$objWriter->writeAttribute('type', '#_x0000_t75');
$objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
$objWriter->writeAttribute('id', $pReference);
$objWriter->writeAttribute('o:spid', '_x0000_s' . $id);
$objWriter->writeAttribute('type', '#_x0000_t75');
$objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
// v:imagedata
$objWriter->startElement('v:imagedata');
$objWriter->writeAttribute('o:relid', 'rId' . $pReference);
$objWriter->writeAttribute('o:title', $pImage->getName());
$objWriter->endElement();
// v:imagedata
$objWriter->startElement('v:imagedata');
$objWriter->writeAttribute('o:relid', 'rId' . $pReference);
$objWriter->writeAttribute('o:title', $pImage->getName());
$objWriter->endElement();
// o:lock
$objWriter->startElement('o:lock');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('rotation', 't');
$objWriter->endElement();
// o:lock
$objWriter->startElement('o:lock');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('rotation', 't');
$objWriter->endElement();
$objWriter->endElement();
}

View File

@ -259,10 +259,10 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// Underline
$underlineType = $element->getFont()->getUnderline();
switch ($underlineType) {
case 'single' :
case 'single':
$underlineType = 'sng';
break;
case 'double' :
case 'double':
$underlineType = 'dbl';
break;
}
@ -304,7 +304,8 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param array $stringTable Stringtable
* @return array
*/
public function flipStringTable($stringTable = array()) {
public function flipStringTable($stringTable = array())
{
// Return value
$returnValue = array();

View File

@ -210,102 +210,103 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// sheetViews
$objWriter->startElement('sheetViews');
// Sheet selected?
$sheetSelected = false;
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
$sheetSelected = true;
// Sheet selected?
$sheetSelected = false;
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
$sheetSelected = true;
}
// sheetView
$objWriter->startElement('sheetView');
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
$objWriter->writeAttribute('workbookViewId', '0');
// Zoom scales
if ($pSheet->getSheetView()->getZoomScale() != 100) {
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
}
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
}
// View Layout Type
if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
$objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
}
// Gridlines
if ($pSheet->getShowGridlines()) {
$objWriter->writeAttribute('showGridLines', 'true');
} else {
$objWriter->writeAttribute('showGridLines', 'false');
}
// Row and column headers
if ($pSheet->getShowRowColHeaders()) {
$objWriter->writeAttribute('showRowColHeaders', '1');
} else {
$objWriter->writeAttribute('showRowColHeaders', '0');
}
// Right-to-left
if ($pSheet->getRightToLeft()) {
$objWriter->writeAttribute('rightToLeft', 'true');
}
$activeCell = $pSheet->getActiveCell();
// Pane
$pane = '';
$topLeftCell = $pSheet->getFreezePane();
if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
$activeCell = $topLeftCell;
// Calculate freeze coordinates
$xSplit = $ySplit = 0;
list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
$xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
// pane
$pane = 'topRight';
$objWriter->startElement('pane');
if ($xSplit > 1) {
$objWriter->writeAttribute('xSplit', $xSplit - 1);
}
// sheetView
$objWriter->startElement('sheetView');
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
$objWriter->writeAttribute('workbookViewId', '0');
// Zoom scales
if ($pSheet->getSheetView()->getZoomScale() != 100) {
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
}
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
}
// View Layout Type
if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
$objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
}
// Gridlines
if ($pSheet->getShowGridlines()) {
$objWriter->writeAttribute('showGridLines', 'true');
} else {
$objWriter->writeAttribute('showGridLines', 'false');
}
// Row and column headers
if ($pSheet->getShowRowColHeaders()) {
$objWriter->writeAttribute('showRowColHeaders', '1');
} else {
$objWriter->writeAttribute('showRowColHeaders', '0');
}
// Right-to-left
if ($pSheet->getRightToLeft()) {
$objWriter->writeAttribute('rightToLeft', 'true');
}
$activeCell = $pSheet->getActiveCell();
// Pane
$pane = '';
$topLeftCell = $pSheet->getFreezePane();
if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
$activeCell = $topLeftCell;
// Calculate freeze coordinates
$xSplit = $ySplit = 0;
list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
$xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
// pane
$pane = 'topRight';
$objWriter->startElement('pane');
if ($xSplit > 1)
$objWriter->writeAttribute('xSplit', $xSplit - 1);
if ($ySplit > 1) {
$objWriter->writeAttribute('ySplit', $ySplit - 1);
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
}
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
$objWriter->writeAttribute('activePane', $pane);
$objWriter->writeAttribute('state', 'frozen');
$objWriter->endElement();
if (($xSplit > 1) && ($ySplit > 1)) {
// Write additional selections if more than two panes (ie both an X and a Y split)
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'topRight');
$objWriter->endElement();
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'bottomLeft');
$objWriter->endElement();
}
}
// Selection
// if ($pane != '') {
// Only need to write selection element if we have a split pane
// We cheat a little by over-riding the active cell selection, setting it to the split cell
$objWriter->startElement('selection');
if ($pane != '') {
$objWriter->writeAttribute('pane', $pane);
}
$objWriter->writeAttribute('activeCell', $activeCell);
$objWriter->writeAttribute('sqref', $activeCell);
$objWriter->endElement();
// }
if ($ySplit > 1) {
$objWriter->writeAttribute('ySplit', $ySplit - 1);
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
}
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
$objWriter->writeAttribute('activePane', $pane);
$objWriter->writeAttribute('state', 'frozen');
$objWriter->endElement();
if (($xSplit > 1) && ($ySplit > 1)) {
// Write additional selections if more than two panes (ie both an X and a Y split)
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'topRight');
$objWriter->endElement();
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'bottomLeft');
$objWriter->endElement();
}
}
// Selection
// if ($pane != '') {
// Only need to write selection element if we have a split pane
// We cheat a little by over-riding the active cell selection, setting it to the split cell
$objWriter->startElement('selection');
if ($pane != '') {
$objWriter->writeAttribute('pane', $pane);
}
$objWriter->writeAttribute('activeCell', $activeCell);
$objWriter->writeAttribute('sqref', $activeCell);
$objWriter->endElement();
// }
$objWriter->endElement();
$objWriter->endElement();
}
@ -371,7 +372,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{
// cols
if (count($pSheet->getColumnDimensions()) > 0) {
if (count($pSheet->getColumnDimensions()) > 0) {
$objWriter->startElement('cols');
$pSheet->calculateColumnWidths();
@ -485,50 +486,48 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->startElement('conditionalFormatting');
$objWriter->writeAttribute('sqref', $cellCoordinate);
// cfRule
$objWriter->startElement('cfRule');
$objWriter->writeAttribute('type', $conditional->getConditionType());
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
$objWriter->writeAttribute('priority', $id++);
// cfRule
$objWriter->startElement('cfRule');
$objWriter->writeAttribute('type', $conditional->getConditionType());
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
$objWriter->writeAttribute('priority', $id++);
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
}
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeAttribute('text', $conditional->getText());
}
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
foreach ($conditional->getConditions() as $formula) {
// Formula
$objWriter->writeElement('formula', $formula);
}
}
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeAttribute('text', $conditional->getText());
}
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
foreach ($conditional->getConditions() as $formula) {
// Formula
$objWriter->writeElement('formula', $formula);
}
}
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
}
@ -656,17 +655,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// protectedRanges
$objWriter->startElement('protectedRanges');
// Loop protectedRanges
foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
// protectedRange
$objWriter->startElement('protectedRange');
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
$objWriter->writeAttribute('sqref', $protectedCell);
if (!empty($passwordHash)) {
$objWriter->writeAttribute('password', $passwordHash);
}
$objWriter->endElement();
// Loop protectedRanges
foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
// protectedRange
$objWriter->startElement('protectedRange');
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
$objWriter->writeAttribute('sqref', $protectedCell);
if (!empty($passwordHash)) {
$objWriter->writeAttribute('password', $passwordHash);
}
$objWriter->endElement();
}
$objWriter->endElement();
}
@ -685,13 +684,13 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// mergeCells
$objWriter->startElement('mergeCells');
// Loop mergeCells
foreach ($pSheet->getMergeCells() as $mergeCell) {
// mergeCell
$objWriter->startElement('mergeCell');
$objWriter->writeAttribute('ref', $mergeCell);
$objWriter->endElement();
}
// Loop mergeCells
foreach ($pSheet->getMergeCells() as $mergeCell) {
// mergeCell
$objWriter->startElement('mergeCell');
$objWriter->writeAttribute('ref', $mergeCell);
$objWriter->endElement();
}
$objWriter->endElement();
}
@ -761,76 +760,77 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$range = PHPExcel_Cell::splitRange($autoFilterRange);
$range = $range[0];
// Strip any worksheet ref
if (strpos($range[0],'!') !== false) {
if (strpos($range[0], '!') !== false) {
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) {
$rules = $column->getRules();
if (count($rules > 0)) {
if (count($rules) > 0) {
$objWriter->startElement('filterColumn');
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
$objWriter->startElement($column->getFilterType());
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
$objWriter->writeAttribute('and', 1);
$objWriter->startElement($column->getFilterType());
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
$objWriter->writeAttribute('and', 1);
}
foreach ($rules as $rule) {
if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) &&
($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
($rule->getValue() === '')) {
// Filter rule for Blanks
$objWriter->writeAttribute('blank', 1);
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
// Dynamic Filter Rule
$objWriter->writeAttribute('type', $rule->getGrouping());
$val = $column->getAttribute('val');
if ($val !== null) {
$objWriter->writeAttribute('val', $val);
}
$maxVal = $column->getAttribute('maxVal');
if ($maxVal !== null) {
$objWriter->writeAttribute('maxVal', $maxVal);
}
} 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'));
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
} else {
// Filter, DateGroupItem or CustomFilter
$objWriter->startElement($rule->getRuleType());
foreach ($rules as $rule) {
if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) &&
($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
($rule->getValue() === '')) {
// Filter rule for Blanks
$objWriter->writeAttribute('blank', 1);
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
// Dynamic Filter Rule
$objWriter->writeAttribute('type', $rule->getGrouping());
$val = $column->getAttribute('val');
if ($val !== null) {
$objWriter->writeAttribute('val', $val);
if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
$objWriter->writeAttribute('operator', $rule->getOperator());
}
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters
foreach ($rule->getValue() as $key => $value) {
if ($value > '') {
$objWriter->writeAttribute($key, $value);
}
$maxVal = $column->getAttribute('maxVal');
if ($maxVal !== null) {
$objWriter->writeAttribute('maxVal', $maxVal);
}
} 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'));
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
} else {
// Filter, DateGroupItem or CustomFilter
$objWriter->startElement($rule->getRuleType());
if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
$objWriter->writeAttribute('operator', $rule->getOperator());
}
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters
foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value);
}
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else {
$objWriter->writeAttribute('val', $rule->getValue());
}
$objWriter->endElement();
}
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else {
$objWriter->writeAttribute('val', $rule->getValue());
}
$objWriter->endElement();
$objWriter->endElement();
}
}
$objWriter->endElement();
$objWriter->endElement();
}
}
}
$objWriter->endElement();
}
}
@ -921,14 +921,14 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('count', count($aRowBreaks));
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
foreach ($aRowBreaks as $cell) {
$coords = PHPExcel_Cell::coordinateFromString($cell);
foreach ($aRowBreaks as $cell) {
$coords = PHPExcel_Cell::coordinateFromString($cell);
$objWriter->startElement('brk');
$objWriter->writeAttribute('id', $coords[1]);
$objWriter->writeAttribute('man', '1');
$objWriter->endElement();
}
$objWriter->startElement('brk');
$objWriter->writeAttribute('id', $coords[1]);
$objWriter->writeAttribute('man', '1');
$objWriter->endElement();
}
$objWriter->endElement();
}
@ -939,14 +939,14 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('count', count($aColumnBreaks));
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
foreach ($aColumnBreaks as $cell) {
$coords = PHPExcel_Cell::coordinateFromString($cell);
foreach ($aColumnBreaks as $cell) {
$coords = PHPExcel_Cell::coordinateFromString($cell);
$objWriter->startElement('brk');
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
$objWriter->writeAttribute('man', '1');
$objWriter->endElement();
}
$objWriter->startElement('brk');
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
$objWriter->writeAttribute('man', '1');
$objWriter->endElement();
}
$objWriter->endElement();
}

View File

@ -1135,8 +1135,7 @@ class PHPExcel_Writer_Excel5_Parser
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
return $token;
}
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
return $token;
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
@ -1253,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Parser
$this->_advance();
return $result;
// If it's an error code
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A'){
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A') {
$result = $this->_createTree($this->_current_token, 'ptgErr', '');
$this->_advance();
return $result;
@ -1361,45 +1360,39 @@ class PHPExcel_Writer_Excel5_Parser
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
// if it's a range A1:B2 or $A$1:$B$2
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's a number or a percent
elseif (is_numeric($this->_current_token)) {
} elseif (is_numeric($this->_current_token)) {
// If it's a number or a percent
if ($this->_lookahead == '%') {
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
@ -1408,15 +1401,12 @@ class PHPExcel_Writer_Excel5_Parser
}
$this->_advance();
return $result;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
// if it's a function call
$result = $this->_func();
return $result;
}
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.
", lookahead: ".$this->_lookahead.
", current char: ".$this->_current_char);
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.", lookahead: ".$this->_lookahead.", current char: ".$this->_current_char);
}
/**