mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 14:56:04 +03:00
Merge branch 'psr2' of https://github.com/PHPOffice/PHPExcel into psr2
Conflicts: Classes/PHPExcel/Calculation.php Classes/PHPExcel/Shared/CodePage.php Classes/PHPExcel/Shared/Date.php Classes/PHPExcel/Shared/ZipArchive.php
This commit is contained in:
commit
99b0beb721
@ -25,7 +25,7 @@ before_script:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
## PHP_CodeSniffer
|
## PHP_CodeSniffer
|
||||||
- ./vendor/bin/phpcs Classes/ unitTests/ --standard=PSR2 -n --ignore=Classes/PHPExcel/Shared/PCLZip
|
- ./vendor/bin/phpcs --report-width=200 --report-summary --report-full Classes/ unitTests/ --standard=PSR2 -n
|
||||||
## PHPUnit
|
## PHPUnit
|
||||||
- phpunit -c ./unitTests/
|
- phpunit -c ./unitTests/
|
||||||
|
|
||||||
|
@ -3657,6 +3657,301 @@ class PHPExcel_Calculation {
|
|||||||
|
|
||||||
return strcmp($inversedStr1, $inversedStr2);
|
return strcmp($inversedStr1, $inversedStr2);
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
|
||||||
|
// Validate the two operands
|
||||||
|
if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return FALSE;
|
||||||
|
if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return FALSE;
|
||||||
|
|
||||||
|
// If either of the operands is a matrix, we need to treat them both as matrices
|
||||||
|
// (converting the other operand to a matrix if need be); then perform the required
|
||||||
|
// matrix operation
|
||||||
|
if ((is_array($operand1)) || (is_array($operand2))) {
|
||||||
|
// Ensure that both operands are arrays/matrices of the same size
|
||||||
|
self::_checkMatrixOperands($operand1, $operand2, 2);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Convert operand 1 from a PHP array to a matrix
|
||||||
|
$matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
|
||||||
|
// Perform the required operation against the operand 1 matrix, passing in operand 2
|
||||||
|
$matrixResult = $matrix->$matrixFunction($operand2);
|
||||||
|
$result = $matrixResult->getArray();
|
||||||
|
} catch (PHPExcel_Exception $ex) {
|
||||||
|
$this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
|
||||||
|
$result = '#VALUE!';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) &&
|
||||||
|
((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) ||
|
||||||
|
(is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) {
|
||||||
|
$result = PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
} else {
|
||||||
|
// If we're dealing with non-matrix operations, execute the necessary operation
|
||||||
|
switch ($operation) {
|
||||||
|
// Addition
|
||||||
|
case '+':
|
||||||
|
$result = $operand1 + $operand2;
|
||||||
|
break;
|
||||||
|
// Subtraction
|
||||||
|
case '-':
|
||||||
|
$result = $operand1 - $operand2;
|
||||||
|
break;
|
||||||
|
// Multiplication
|
||||||
|
case '*':
|
||||||
|
$result = $operand1 * $operand2;
|
||||||
|
break;
|
||||||
|
// Division
|
||||||
|
case '/':
|
||||||
|
if ($operand2 == 0) {
|
||||||
|
// Trap for Divide by Zero error
|
||||||
|
$stack->push('Value','#DIV/0!');
|
||||||
|
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails('#DIV/0!'));
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
$result = $operand1 / $operand2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Power
|
||||||
|
case '^':
|
||||||
|
$result = pow($operand1, $operand2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the result details
|
||||||
|
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
|
||||||
|
// And push the result onto the stack
|
||||||
|
$stack->push('Value',$result);
|
||||||
|
return TRUE;
|
||||||
|
} // function _executeNumericBinaryOperation()
|
||||||
|
|
||||||
|
|
||||||
|
// trigger an error, but nicely, if need be
|
||||||
|
protected function _raiseFormulaError($errorMessage) {
|
||||||
|
$this->formulaError = $errorMessage;
|
||||||
|
$this->_cyclicReferenceStack->clear();
|
||||||
|
if (!$this->suppressFormulaErrors) throw new PHPExcel_Calculation_Exception($errorMessage);
|
||||||
|
trigger_error($errorMessage, E_USER_ERROR);
|
||||||
|
} // function _raiseFormulaError()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract range values
|
||||||
|
*
|
||||||
|
* @param string &$pRange String based range representation
|
||||||
|
* @param PHPExcel_Worksheet $pSheet Worksheet
|
||||||
|
* @param boolean $resetLog Flag indicating whether calculation log should be reset or not
|
||||||
|
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
|
||||||
|
* @throws PHPExcel_Calculation_Exception
|
||||||
|
*/
|
||||||
|
public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) {
|
||||||
|
// Return value
|
||||||
|
$returnValue = array ();
|
||||||
|
|
||||||
|
// echo 'extractCellRange('.$pRange.')',PHP_EOL;
|
||||||
|
if ($pSheet !== NULL) {
|
||||||
|
$pSheetName = $pSheet->getTitle();
|
||||||
|
// echo 'Passed sheet name is '.$pSheetName.PHP_EOL;
|
||||||
|
// echo 'Range reference is '.$pRange.PHP_EOL;
|
||||||
|
if (strpos ($pRange, '!') !== false) {
|
||||||
|
// echo '$pRange reference includes sheet reference',PHP_EOL;
|
||||||
|
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||||
|
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
|
||||||
|
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
|
||||||
|
$pSheet = $this->_workbook->getSheetByName($pSheetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract range
|
||||||
|
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
|
||||||
|
$pRange = $pSheetName.'!'.$pRange;
|
||||||
|
if (!isset($aReferences[1])) {
|
||||||
|
// Single cell in range
|
||||||
|
sscanf($aReferences[0],'%[A-Z]%d', $currentCol, $currentRow);
|
||||||
|
$cellValue = NULL;
|
||||||
|
if ($pSheet->cellExists($aReferences[0])) {
|
||||||
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
||||||
|
} else {
|
||||||
|
$returnValue[$currentRow][$currentCol] = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Extract cell data for all cells in the range
|
||||||
|
foreach ($aReferences as $reference) {
|
||||||
|
// Extract range
|
||||||
|
sscanf($reference,'%[A-Z]%d', $currentCol, $currentRow);
|
||||||
|
$cellValue = NULL;
|
||||||
|
if ($pSheet->cellExists($reference)) {
|
||||||
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
|
||||||
|
} else {
|
||||||
|
$returnValue[$currentRow][$currentCol] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $returnValue;
|
||||||
|
} // function extractCellRange()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract range values
|
||||||
|
*
|
||||||
|
* @param string &$pRange String based range representation
|
||||||
|
* @param PHPExcel_Worksheet $pSheet Worksheet
|
||||||
|
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
|
||||||
|
* @param boolean $resetLog Flag indicating whether calculation log should be reset or not
|
||||||
|
* @throws PHPExcel_Calculation_Exception
|
||||||
|
*/
|
||||||
|
public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) {
|
||||||
|
// Return value
|
||||||
|
$returnValue = array ();
|
||||||
|
|
||||||
|
// echo 'extractNamedRange('.$pRange.')<br />';
|
||||||
|
if ($pSheet !== NULL) {
|
||||||
|
$pSheetName = $pSheet->getTitle();
|
||||||
|
// echo 'Current sheet name is '.$pSheetName.'<br />';
|
||||||
|
// echo 'Range reference is '.$pRange.'<br />';
|
||||||
|
if (strpos ($pRange, '!') !== false) {
|
||||||
|
// echo '$pRange reference includes sheet reference',PHP_EOL;
|
||||||
|
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||||
|
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
|
||||||
|
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
|
||||||
|
$pSheet = $this->_workbook->getSheetByName($pSheetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Named range?
|
||||||
|
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
|
||||||
|
if ($namedRange !== NULL) {
|
||||||
|
$pSheet = $namedRange->getWorksheet();
|
||||||
|
// echo 'Named Range '.$pRange.' (';
|
||||||
|
$pRange = $namedRange->getRange();
|
||||||
|
$splitRange = PHPExcel_Cell::splitRange($pRange);
|
||||||
|
// Convert row and column references
|
||||||
|
if (ctype_alpha($splitRange[0][0])) {
|
||||||
|
$pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
|
||||||
|
} elseif(ctype_digit($splitRange[0][0])) {
|
||||||
|
$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
|
||||||
|
}
|
||||||
|
// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
|
||||||
|
|
||||||
|
// if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
|
||||||
|
// if (!$namedRange->getLocalOnly()) {
|
||||||
|
// $pSheet = $namedRange->getWorksheet();
|
||||||
|
// } else {
|
||||||
|
// return $returnValue;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract range
|
||||||
|
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
|
||||||
|
// var_dump($aReferences);
|
||||||
|
if (!isset($aReferences[1])) {
|
||||||
|
// Single cell (or single column or row) in range
|
||||||
|
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
|
||||||
|
$cellValue = NULL;
|
||||||
|
if ($pSheet->cellExists($aReferences[0])) {
|
||||||
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
||||||
|
} else {
|
||||||
|
$returnValue[$currentRow][$currentCol] = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Extract cell data for all cells in the range
|
||||||
|
foreach ($aReferences as $reference) {
|
||||||
|
// Extract range
|
||||||
|
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference);
|
||||||
|
// echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
|
||||||
|
$cellValue = NULL;
|
||||||
|
if ($pSheet->cellExists($reference)) {
|
||||||
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
|
||||||
|
} else {
|
||||||
|
$returnValue[$currentRow][$currentCol] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// print_r($returnValue);
|
||||||
|
// echo '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $returnValue;
|
||||||
|
} // function extractNamedRange()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a specific function implemented?
|
||||||
|
*
|
||||||
|
* @param string $pFunction Function Name
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isImplemented($pFunction = '') {
|
||||||
|
$pFunction = strtoupper ($pFunction);
|
||||||
|
if (isset(self::$_PHPExcelFunctions[$pFunction])) {
|
||||||
|
return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} // function isImplemented()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all implemented functions as an array of function objects
|
||||||
|
*
|
||||||
|
* @return array of PHPExcel_Calculation_Function
|
||||||
|
*/
|
||||||
|
public function listFunctions() {
|
||||||
|
// Return value
|
||||||
|
$returnValue = array();
|
||||||
|
// Loop functions
|
||||||
|
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
|
||||||
|
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
|
||||||
|
$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
|
||||||
|
$functionName,
|
||||||
|
$function['functionCall']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $returnValue;
|
||||||
|
} // function listFunctions()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all Excel function names
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function listAllFunctionNames() {
|
||||||
|
return array_keys(self::$_PHPExcelFunctions);
|
||||||
|
} // function listAllFunctionNames()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of implemented Excel function names
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function listFunctionNames() {
|
||||||
|
// Return value
|
||||||
|
$returnValue = array();
|
||||||
|
// Loop functions
|
||||||
|
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
|
||||||
|
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
|
||||||
|
$returnValue[] = $functionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $returnValue;
|
||||||
|
} // function listFunctionNames()
|
||||||
|
|
||||||
|
} // class PHPExcel_Calculation
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
|
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
|
||||||
// Validate the two operands
|
// Validate the two operands
|
||||||
|
@ -113,9 +113,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
||||||
// Convert value to number
|
// Convert value to number
|
||||||
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||||
->getNumberFormat()->setFormatCode(
|
->getNumberFormat()->setFormatCode(
|
||||||
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
|
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
|
||||||
);
|
);
|
||||||
@ -123,9 +123,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||||
// Convert value to number
|
// Convert value to number
|
||||||
$value = (float) trim(str_replace(array('$',','), '', $value));
|
$value = (float) trim(str_replace(array('$',','), '', $value));
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
$days = $h / 24 + $m / 1440;
|
$days = $h / 24 + $m / 1440;
|
||||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
|
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
// Convert value to number
|
// Convert value to number
|
||||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
|
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
} else {
|
} else {
|
||||||
$formatCode = 'yyyy-mm-dd';
|
$formatCode = 'yyyy-mm-dd';
|
||||||
}
|
}
|
||||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||||
->getNumberFormat()->setFormatCode($formatCode);
|
->getNumberFormat()->setFormatCode($formatCode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,8 @@ class PHPExcel_Cell_DataValidation
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFormula2() {
|
public function getFormula2()
|
||||||
|
{
|
||||||
return $this->formula2;
|
return $this->formula2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,9 +176,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @param string $minor_unit
|
* @param string $minor_unit
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null,
|
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)
|
||||||
$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;
|
$this->_axis_options['axis_labels'] = (string) $axis_labels;
|
||||||
($horizontal_crosses_value !== null)
|
($horizontal_crosses_value !== null)
|
||||||
@ -201,7 +199,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAxisOptionsProperty($property) {
|
public function getAxisOptionsProperty($property)
|
||||||
|
{
|
||||||
return $this->_axis_options[$property];
|
return $this->_axis_options[$property];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +210,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @param string $orientation
|
* @param string $orientation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setAxisOrientation($orientation) {
|
public function setAxisOrientation($orientation)
|
||||||
|
{
|
||||||
$this->orientation = (string) $orientation;
|
$this->orientation = (string) $orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
|
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
|
||||||
|
{
|
||||||
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
|
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +236,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
|
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
|
||||||
|
{
|
||||||
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
|
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +248,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFillProperty($property) {
|
public function getFillProperty($property)
|
||||||
|
{
|
||||||
return $this->_fill_properties[$property];
|
return $this->_fill_properties[$property];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +260,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLineProperty($property) {
|
public function getLineProperty($property)
|
||||||
|
{
|
||||||
return $this->_line_properties[$property];
|
return $this->_line_properties[$property];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,10 +280,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setLineStyleProperties($line_width = null, $compound_type = 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) {
|
||||||
$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)
|
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width)
|
||||||
: null;
|
: null;
|
||||||
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
|
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
|
||||||
@ -304,7 +305,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getLineStyleProperty($elements) {
|
public function getLineStyleProperty($elements)
|
||||||
|
{
|
||||||
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
|
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +318,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getLineStyleArrowWidth($arrow) {
|
public function getLineStyleArrowWidth($arrow)
|
||||||
|
{
|
||||||
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
|
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +331,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getLineStyleArrowLength($arrow) {
|
public function getLineStyleArrowLength($arrow)
|
||||||
|
{
|
||||||
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
|
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPlotType() {
|
public function getPlotType()
|
||||||
|
{
|
||||||
return $this->_plotType;
|
return $this->_plotType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +177,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* @param string $plotType
|
* @param string $plotType
|
||||||
* @return PHPExcel_Chart_DataSeries
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotType($plotType = '') {
|
public function setPlotType($plotType = '')
|
||||||
|
{
|
||||||
$this->_plotType = $plotType;
|
$this->_plotType = $plotType;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -186,7 +188,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPlotGrouping() {
|
public function getPlotGrouping()
|
||||||
|
{
|
||||||
return $this->_plotGrouping;
|
return $this->_plotGrouping;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +199,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* @param string $groupingType
|
* @param string $groupingType
|
||||||
* @return PHPExcel_Chart_DataSeries
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotGrouping($groupingType = null) {
|
public function setPlotGrouping($groupingType = null)
|
||||||
|
{
|
||||||
$this->_plotGrouping = $groupingType;
|
$this->_plotGrouping = $groupingType;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -206,7 +210,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPlotDirection() {
|
public function getPlotDirection()
|
||||||
|
{
|
||||||
return $this->_plotDirection;
|
return $this->_plotDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +221,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* @param string $plotDirection
|
* @param string $plotDirection
|
||||||
* @return PHPExcel_Chart_DataSeries
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotDirection($plotDirection = null) {
|
public function setPlotDirection($plotDirection = null)
|
||||||
|
{
|
||||||
$this->_plotDirection = $plotDirection;
|
$this->_plotDirection = $plotDirection;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -226,7 +232,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPlotOrder() {
|
public function getPlotOrder()
|
||||||
|
{
|
||||||
return $this->_plotOrder;
|
return $this->_plotOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +242,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return array of PHPExcel_Chart_DataSeriesValues
|
* @return array of PHPExcel_Chart_DataSeriesValues
|
||||||
*/
|
*/
|
||||||
public function getPlotLabels() {
|
public function getPlotLabels()
|
||||||
|
{
|
||||||
return $this->_plotLabel;
|
return $this->_plotLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,11 +252,12 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return PHPExcel_Chart_DataSeriesValues
|
* @return PHPExcel_Chart_DataSeriesValues
|
||||||
*/
|
*/
|
||||||
public function getPlotLabelByIndex($index) {
|
public function getPlotLabelByIndex($index)
|
||||||
|
{
|
||||||
$keys = array_keys($this->_plotLabel);
|
$keys = array_keys($this->_plotLabel);
|
||||||
if (in_array($index,$keys)) {
|
if (in_array($index, $keys)) {
|
||||||
return $this->_plotLabel[$index];
|
return $this->_plotLabel[$index];
|
||||||
} elseif(isset($keys[$index])) {
|
} elseif (isset($keys[$index])) {
|
||||||
return $this->_plotLabel[$keys[$index]];
|
return $this->_plotLabel[$keys[$index]];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -259,7 +268,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return array of PHPExcel_Chart_DataSeriesValues
|
* @return array of PHPExcel_Chart_DataSeriesValues
|
||||||
*/
|
*/
|
||||||
public function getPlotCategories() {
|
public function getPlotCategories()
|
||||||
|
{
|
||||||
return $this->_plotCategory;
|
return $this->_plotCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,11 +278,12 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return PHPExcel_Chart_DataSeriesValues
|
* @return PHPExcel_Chart_DataSeriesValues
|
||||||
*/
|
*/
|
||||||
public function getPlotCategoryByIndex($index) {
|
public function getPlotCategoryByIndex($index)
|
||||||
|
{
|
||||||
$keys = array_keys($this->_plotCategory);
|
$keys = array_keys($this->_plotCategory);
|
||||||
if (in_array($index,$keys)) {
|
if (in_array($index, $keys)) {
|
||||||
return $this->_plotCategory[$index];
|
return $this->_plotCategory[$index];
|
||||||
} elseif(isset($keys[$index])) {
|
} elseif (isset($keys[$index])) {
|
||||||
return $this->_plotCategory[$keys[$index]];
|
return $this->_plotCategory[$keys[$index]];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -283,7 +294,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPlotStyle() {
|
public function getPlotStyle()
|
||||||
|
{
|
||||||
return $this->_plotStyle;
|
return $this->_plotStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +305,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* @param string $plotStyle
|
* @param string $plotStyle
|
||||||
* @return PHPExcel_Chart_DataSeries
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotStyle($plotStyle = null) {
|
public function setPlotStyle($plotStyle = null)
|
||||||
|
{
|
||||||
$this->_plotStyle = $plotStyle;
|
$this->_plotStyle = $plotStyle;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -303,7 +316,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return array of PHPExcel_Chart_DataSeriesValues
|
* @return array of PHPExcel_Chart_DataSeriesValues
|
||||||
*/
|
*/
|
||||||
public function getPlotValues() {
|
public function getPlotValues()
|
||||||
|
{
|
||||||
return $this->_plotValues;
|
return $this->_plotValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,11 +326,12 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return PHPExcel_Chart_DataSeriesValues
|
* @return PHPExcel_Chart_DataSeriesValues
|
||||||
*/
|
*/
|
||||||
public function getPlotValuesByIndex($index) {
|
public function getPlotValuesByIndex($index)
|
||||||
|
{
|
||||||
$keys = array_keys($this->_plotValues);
|
$keys = array_keys($this->_plotValues);
|
||||||
if (in_array($index,$keys)) {
|
if (in_array($index, $keys)) {
|
||||||
return $this->_plotValues[$index];
|
return $this->_plotValues[$index];
|
||||||
} elseif(isset($keys[$index])) {
|
} elseif (isset($keys[$index])) {
|
||||||
return $this->_plotValues[$keys[$index]];
|
return $this->_plotValues[$keys[$index]];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -327,7 +342,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getPlotSeriesCount() {
|
public function getPlotSeriesCount()
|
||||||
|
{
|
||||||
return count($this->_plotValues);
|
return count($this->_plotValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +352,8 @@ class PHPExcel_Chart_DataSeries
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getSmoothLine() {
|
public function getSmoothLine()
|
||||||
|
{
|
||||||
return $this->_smoothLine;
|
return $this->_smoothLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,23 +363,28 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* @param boolean $smoothLine
|
* @param boolean $smoothLine
|
||||||
* @return PHPExcel_Chart_DataSeries
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setSmoothLine($smoothLine = TRUE) {
|
public function setSmoothLine($smoothLine = true)
|
||||||
|
{
|
||||||
$this->_smoothLine = $smoothLine;
|
$this->_smoothLine = $smoothLine;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
public function refresh(PHPExcel_Worksheet $worksheet)
|
||||||
|
{
|
||||||
foreach($this->_plotValues as $plotValues) {
|
foreach($this->_plotValues as $plotValues) {
|
||||||
if ($plotValues !== NULL)
|
if ($plotValues !== null) {
|
||||||
$plotValues->refresh($worksheet, TRUE);
|
$plotValues->refresh($worksheet, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach($this->_plotLabel as $plotValues) {
|
foreach($this->_plotLabel as $plotValues) {
|
||||||
if ($plotValues !== NULL)
|
if ($plotValues !== null) {
|
||||||
$plotValues->refresh($worksheet, TRUE);
|
$plotValues->refresh($worksheet, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach($this->_plotCategory as $plotValues) {
|
foreach($this->_plotCategory as $plotValues) {
|
||||||
if ($plotValues !== NULL)
|
if ($plotValues !== null) {
|
||||||
$plotValues->refresh($worksheet, FALSE);
|
$plotValues->refresh($worksheet, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_layoutTarget = NULL;
|
private $_layoutTarget = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X Mode
|
* X Mode
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_xMode = NULL;
|
private $_xMode = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Y Mode
|
* Y Mode
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_yMode = NULL;
|
private $_yMode = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X-Position
|
* X-Position
|
||||||
*
|
*
|
||||||
* @var float
|
* @var float
|
||||||
*/
|
*/
|
||||||
private $_xPos = NULL;
|
private $_xPos = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Y-Position
|
* Y-Position
|
||||||
*
|
*
|
||||||
* @var float
|
* @var float
|
||||||
*/
|
*/
|
||||||
private $_yPos = NULL;
|
private $_yPos = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* width
|
* width
|
||||||
*
|
*
|
||||||
* @var float
|
* @var float
|
||||||
*/
|
*/
|
||||||
private $_width = NULL;
|
private $_width = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* height
|
* height
|
||||||
*
|
*
|
||||||
* @var float
|
* @var float
|
||||||
*/
|
*/
|
||||||
private $_height = NULL;
|
private $_height = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show legend key
|
* show legend key
|
||||||
@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showLegendKey = NULL;
|
private $_showLegendKey = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show value
|
* show value
|
||||||
@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showVal = NULL;
|
private $_showVal = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show category name
|
* show category name
|
||||||
@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showCatName = NULL;
|
private $_showCatName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show data series name
|
* show data series name
|
||||||
@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showSerName = NULL;
|
private $_showSerName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show percentage
|
* show percentage
|
||||||
@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showPercent = NULL;
|
private $_showPercent = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show bubble size
|
* show bubble size
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showBubbleSize = NULL;
|
private $_showBubbleSize = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show leader lines
|
* show leader lines
|
||||||
@ -137,21 +137,35 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showLeaderLines = NULL;
|
private $_showLeaderLines = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Chart_Layout
|
* Create a new PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function __construct($layout=array())
|
public function __construct($layout = array())
|
||||||
{
|
{
|
||||||
if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; }
|
if (isset($layout['layoutTarget'])) {
|
||||||
if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; }
|
$this->_layoutTarget = $layout['layoutTarget'];
|
||||||
if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; }
|
}
|
||||||
if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; }
|
if (isset($layout['xMode'])) {
|
||||||
if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; }
|
$this->_xMode = $layout['xMode'];
|
||||||
if (isset($layout['w'])) { $this->_width = (float) $layout['w']; }
|
}
|
||||||
if (isset($layout['h'])) { $this->_height = (float) $layout['h']; }
|
if (isset($layout['yMode'])) {
|
||||||
|
$this->_yMode = $layout['yMode'];
|
||||||
|
}
|
||||||
|
if (isset($layout['x'])) {
|
||||||
|
$this->_xPos = (float) $layout['x'];
|
||||||
|
}
|
||||||
|
if (isset($layout['y'])) {
|
||||||
|
$this->_yPos = (float) $layout['y'];
|
||||||
|
}
|
||||||
|
if (isset($layout['w'])) {
|
||||||
|
$this->_width = (float) $layout['w'];
|
||||||
|
}
|
||||||
|
if (isset($layout['h'])) {
|
||||||
|
$this->_height = (float) $layout['h'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +173,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLayoutTarget() {
|
public function getLayoutTarget()
|
||||||
|
{
|
||||||
return $this->_layoutTarget;
|
return $this->_layoutTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +184,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param Layout Target $value
|
* @param Layout Target $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setLayoutTarget($value) {
|
public function setLayoutTarget($value)
|
||||||
|
{
|
||||||
$this->_layoutTarget = $value;
|
$this->_layoutTarget = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -179,7 +195,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getXMode() {
|
public function getXMode()
|
||||||
|
{
|
||||||
return $this->_xMode;
|
return $this->_xMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +206,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param X-Mode $value
|
* @param X-Mode $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setXMode($value) {
|
public function setXMode($value)
|
||||||
|
{
|
||||||
$this->_xMode = $value;
|
$this->_xMode = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -199,7 +217,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getYMode() {
|
public function getYMode()
|
||||||
|
{
|
||||||
return $this->_yMode;
|
return $this->_yMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +228,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param Y-Mode $value
|
* @param Y-Mode $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setYMode($value) {
|
public function setYMode($value)
|
||||||
|
{
|
||||||
$this->_yMode = $value;
|
$this->_yMode = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -219,7 +239,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function getXPosition() {
|
public function getXPosition()
|
||||||
|
{
|
||||||
return $this->_xPos;
|
return $this->_xPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +250,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param X-Position $value
|
* @param X-Position $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setXPosition($value) {
|
public function setXPosition($value)
|
||||||
|
{
|
||||||
$this->_xPos = $value;
|
$this->_xPos = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -239,7 +261,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function getYPosition() {
|
public function getYPosition()
|
||||||
|
{
|
||||||
return $this->_yPos;
|
return $this->_yPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +272,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param Y-Position $value
|
* @param Y-Position $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setYPosition($value) {
|
public function setYPosition($value)
|
||||||
|
{
|
||||||
$this->_yPos = $value;
|
$this->_yPos = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -259,7 +283,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function getWidth() {
|
public function getWidth()
|
||||||
|
{
|
||||||
return $this->_width;
|
return $this->_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +294,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param Width $value
|
* @param Width $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setWidth($value) {
|
public function setWidth($value)
|
||||||
|
{
|
||||||
$this->_width = $value;
|
$this->_width = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -279,7 +305,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function getHeight() {
|
public function getHeight()
|
||||||
|
{
|
||||||
return $this->_height;
|
return $this->_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +316,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param Height $value
|
* @param Height $value
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setHeight($value) {
|
public function setHeight($value)
|
||||||
|
{
|
||||||
$this->_height = $value;
|
$this->_height = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -300,7 +328,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowLegendKey() {
|
public function getShowLegendKey()
|
||||||
|
{
|
||||||
return $this->_showLegendKey;
|
return $this->_showLegendKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +340,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show legend key
|
* @param boolean $value Show legend key
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowLegendKey($value) {
|
public function setShowLegendKey($value)
|
||||||
|
{
|
||||||
$this->_showLegendKey = $value;
|
$this->_showLegendKey = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -321,7 +351,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowVal() {
|
public function getShowVal()
|
||||||
|
{
|
||||||
return $this->_showVal;
|
return $this->_showVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +363,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show val
|
* @param boolean $value Show val
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowVal($value) {
|
public function setShowVal($value)
|
||||||
|
{
|
||||||
$this->_showVal = $value;
|
$this->_showVal = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -342,7 +374,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowCatName() {
|
public function getShowCatName()
|
||||||
|
{
|
||||||
return $this->_showCatName;
|
return $this->_showCatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +386,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show cat name
|
* @param boolean $value Show cat name
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowCatName($value) {
|
public function setShowCatName($value)
|
||||||
|
{
|
||||||
$this->_showCatName = $value;
|
$this->_showCatName = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -363,7 +397,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowSerName() {
|
public function getShowSerName()
|
||||||
|
{
|
||||||
return $this->_showSerName;
|
return $this->_showSerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +409,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show series name
|
* @param boolean $value Show series name
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowSerName($value) {
|
public function setShowSerName($value)
|
||||||
|
{
|
||||||
$this->_showSerName = $value;
|
$this->_showSerName = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -384,7 +420,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowPercent() {
|
public function getShowPercent()
|
||||||
|
{
|
||||||
return $this->_showPercent;
|
return $this->_showPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +432,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show percentage
|
* @param boolean $value Show percentage
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowPercent($value) {
|
public function setShowPercent($value)
|
||||||
|
{
|
||||||
$this->_showPercent = $value;
|
$this->_showPercent = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -405,7 +443,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowBubbleSize() {
|
public function getShowBubbleSize()
|
||||||
|
{
|
||||||
return $this->_showBubbleSize;
|
return $this->_showBubbleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +455,8 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show bubble size
|
* @param boolean $value Show bubble size
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowBubbleSize($value) {
|
public function setShowBubbleSize($value)
|
||||||
|
{
|
||||||
$this->_showBubbleSize = $value;
|
$this->_showBubbleSize = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -426,7 +466,8 @@ class PHPExcel_Chart_Layout
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowLeaderLines() {
|
public function getShowLeaderLines()
|
||||||
|
{
|
||||||
return $this->_showLeaderLines;
|
return $this->_showLeaderLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,9 +478,9 @@ class PHPExcel_Chart_Layout
|
|||||||
* @param boolean $value Show leader lines
|
* @param boolean $value Show leader lines
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowLeaderLines($value) {
|
public function setShowLeaderLines($value)
|
||||||
|
{
|
||||||
$this->_showLeaderLines = $value;
|
$this->_showLeaderLines = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ class PHPExcel_Chart_PlotArea
|
|||||||
*
|
*
|
||||||
* @return PHPExcel_Chart_Layout
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function getLayout() {
|
public function getLayout()
|
||||||
|
{
|
||||||
return $this->_layout;
|
return $this->_layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,8 @@ class PHPExcel_Chart_PlotArea
|
|||||||
*
|
*
|
||||||
* @return array of PHPExcel_Chart_DataSeries
|
* @return array of PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function getPlotGroupCount() {
|
public function getPlotGroupCount()
|
||||||
|
{
|
||||||
return count($this->_plotSeries);
|
return count($this->_plotSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +75,10 @@ class PHPExcel_Chart_PlotArea
|
|||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getPlotSeriesCount() {
|
public function getPlotSeriesCount()
|
||||||
|
{
|
||||||
$seriesCount = 0;
|
$seriesCount = 0;
|
||||||
foreach($this->_plotSeries as $plot) {
|
foreach ($this->_plotSeries as $plot) {
|
||||||
$seriesCount += $plot->getPlotSeriesCount();
|
$seriesCount += $plot->getPlotSeriesCount();
|
||||||
}
|
}
|
||||||
return $seriesCount;
|
return $seriesCount;
|
||||||
@ -86,7 +89,8 @@ class PHPExcel_Chart_PlotArea
|
|||||||
*
|
*
|
||||||
* @return array of PHPExcel_Chart_DataSeries
|
* @return array of PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function getPlotGroup() {
|
public function getPlotGroup()
|
||||||
|
{
|
||||||
return $this->_plotSeries;
|
return $this->_plotSeries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +99,8 @@ class PHPExcel_Chart_PlotArea
|
|||||||
*
|
*
|
||||||
* @return PHPExcel_Chart_DataSeries
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function getPlotGroupByIndex($index) {
|
public function getPlotGroupByIndex($index)
|
||||||
|
{
|
||||||
return $this->_plotSeries[$index];
|
return $this->_plotSeries[$index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,16 +110,17 @@ class PHPExcel_Chart_PlotArea
|
|||||||
* @param [PHPExcel_Chart_DataSeries]
|
* @param [PHPExcel_Chart_DataSeries]
|
||||||
* @return PHPExcel_Chart_PlotArea
|
* @return PHPExcel_Chart_PlotArea
|
||||||
*/
|
*/
|
||||||
public function setPlotSeries($plotSeries = array()) {
|
public function setPlotSeries($plotSeries = array())
|
||||||
|
{
|
||||||
$this->_plotSeries = $plotSeries;
|
$this->_plotSeries = $plotSeries;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
public function refresh(PHPExcel_Worksheet $worksheet)
|
||||||
foreach($this->_plotSeries as $plotSeries) {
|
{
|
||||||
|
foreach ($this->_plotSeries as $plotSeries) {
|
||||||
$plotSeries->refresh($worksheet);
|
$plotSeries->refresh($worksheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,353 +8,353 @@
|
|||||||
|
|
||||||
abstract class PHPExcel_Chart_Properties
|
abstract class PHPExcel_Chart_Properties
|
||||||
{
|
{
|
||||||
|
const
|
||||||
|
EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
|
||||||
|
EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
|
||||||
|
EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
|
||||||
|
|
||||||
const
|
const
|
||||||
EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
|
AXIS_LABELS_LOW = 'low',
|
||||||
EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
|
AXIS_LABELS_HIGH = 'high',
|
||||||
EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
|
AXIS_LABELS_NEXT_TO = 'nextTo',
|
||||||
|
AXIS_LABELS_NONE = 'none';
|
||||||
|
|
||||||
const
|
const
|
||||||
AXIS_LABELS_LOW = 'low',
|
TICK_MARK_NONE = 'none',
|
||||||
AXIS_LABELS_HIGH = 'high',
|
TICK_MARK_INSIDE = 'in',
|
||||||
AXIS_LABELS_NEXT_TO = 'nextTo',
|
TICK_MARK_OUTSIDE = 'out',
|
||||||
AXIS_LABELS_NONE = 'none';
|
TICK_MARK_CROSS = 'cross';
|
||||||
|
|
||||||
const
|
const
|
||||||
TICK_MARK_NONE = 'none',
|
HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
|
||||||
TICK_MARK_INSIDE = 'in',
|
HORIZONTAL_CROSSES_MAXIMUM = 'max';
|
||||||
TICK_MARK_OUTSIDE = 'out',
|
|
||||||
TICK_MARK_CROSS = 'cross';
|
|
||||||
|
|
||||||
const
|
const
|
||||||
HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
|
FORMAT_CODE_GENERAL = 'General',
|
||||||
HORIZONTAL_CROSSES_MAXIMUM = 'max';
|
FORMAT_CODE_NUMBER = '#,##0.00',
|
||||||
|
FORMAT_CODE_CURRENCY = '$#,##0.00',
|
||||||
|
FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
|
||||||
|
FORMAT_CODE_DATE = 'm/d/yyyy',
|
||||||
|
FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
|
||||||
|
FORMAT_CODE_PERCENTAGE = '0.00%',
|
||||||
|
FORMAT_CODE_FRACTION = '# ?/?',
|
||||||
|
FORMAT_CODE_SCIENTIFIC = '0.00E+00',
|
||||||
|
FORMAT_CODE_TEXT = '@',
|
||||||
|
FORMAT_CODE_SPECIAL = '00000';
|
||||||
|
|
||||||
const
|
const
|
||||||
FORMAT_CODE_GENERAL = 'General',
|
ORIENTATION_NORMAL = 'minMax',
|
||||||
FORMAT_CODE_NUMBER = '#,##0.00',
|
ORIENTATION_REVERSED = 'maxMin';
|
||||||
FORMAT_CODE_CURRENCY = '$#,##0.00',
|
|
||||||
FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
|
|
||||||
FORMAT_CODE_DATE = 'm/d/yyyy',
|
|
||||||
FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
|
|
||||||
FORMAT_CODE_PERCENTAGE = '0.00%',
|
|
||||||
FORMAT_CODE_FRACTION = '# ?/?',
|
|
||||||
FORMAT_CODE_SCIENTIFIC = '0.00E+00',
|
|
||||||
FORMAT_CODE_TEXT = '@',
|
|
||||||
FORMAT_CODE_SPECIAL = '00000';
|
|
||||||
|
|
||||||
const
|
const
|
||||||
ORIENTATION_NORMAL = 'minMax',
|
LINE_STYLE_COMPOUND_SIMPLE = 'sng',
|
||||||
ORIENTATION_REVERSED = 'maxMin';
|
LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
|
||||||
|
LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
|
||||||
|
LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
|
||||||
|
LINE_STYLE_COMPOUND_TRIPLE = 'tri',
|
||||||
|
|
||||||
const
|
LINE_STYLE_DASH_SOLID = 'solid',
|
||||||
LINE_STYLE_COMPOUND_SIMPLE = 'sng',
|
LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
|
||||||
LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
|
LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
|
||||||
LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
|
LINE_STYPE_DASH_DASH = 'dash',
|
||||||
LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
|
LINE_STYLE_DASH_DASH_DOT = 'dashDot',
|
||||||
LINE_STYLE_COMPOUND_TRIPLE = 'tri',
|
LINE_STYLE_DASH_LONG_DASH = 'lgDash',
|
||||||
|
LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
|
||||||
|
LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
|
||||||
|
|
||||||
LINE_STYLE_DASH_SOLID = 'solid',
|
LINE_STYLE_CAP_SQUARE = 'sq',
|
||||||
LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
|
LINE_STYLE_CAP_ROUND = 'rnd',
|
||||||
LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
|
LINE_STYLE_CAP_FLAT = 'flat',
|
||||||
LINE_STYPE_DASH_DASH = 'dash',
|
|
||||||
LINE_STYLE_DASH_DASH_DOT = 'dashDot',
|
|
||||||
LINE_STYLE_DASH_LONG_DASH = 'lgDash',
|
|
||||||
LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
|
|
||||||
LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
|
|
||||||
|
|
||||||
LINE_STYLE_CAP_SQUARE = 'sq',
|
LINE_STYLE_JOIN_ROUND = 'bevel',
|
||||||
LINE_STYLE_CAP_ROUND = 'rnd',
|
LINE_STYLE_JOIN_MITER = 'miter',
|
||||||
LINE_STYLE_CAP_FLAT = 'flat',
|
LINE_STYLE_JOIN_BEVEL = 'bevel',
|
||||||
|
|
||||||
LINE_STYLE_JOIN_ROUND = 'bevel',
|
LINE_STYLE_ARROW_TYPE_NOARROW = NULL,
|
||||||
LINE_STYLE_JOIN_MITER = 'miter',
|
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
|
||||||
LINE_STYLE_JOIN_BEVEL = 'bevel',
|
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
|
||||||
|
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
|
||||||
|
LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
|
||||||
|
LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
|
||||||
|
|
||||||
LINE_STYLE_ARROW_TYPE_NOARROW = NULL,
|
LINE_STYLE_ARROW_SIZE_1 = 1,
|
||||||
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
|
LINE_STYLE_ARROW_SIZE_2 = 2,
|
||||||
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
|
LINE_STYLE_ARROW_SIZE_3 = 3,
|
||||||
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
|
LINE_STYLE_ARROW_SIZE_4 = 4,
|
||||||
LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
|
LINE_STYLE_ARROW_SIZE_5 = 5,
|
||||||
LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
|
LINE_STYLE_ARROW_SIZE_6 = 6,
|
||||||
|
LINE_STYLE_ARROW_SIZE_7 = 7,
|
||||||
|
LINE_STYLE_ARROW_SIZE_8 = 8,
|
||||||
|
LINE_STYLE_ARROW_SIZE_9 = 9;
|
||||||
|
|
||||||
LINE_STYLE_ARROW_SIZE_1 = 1,
|
const
|
||||||
LINE_STYLE_ARROW_SIZE_2 = 2,
|
SHADOW_PRESETS_NOSHADOW = NULL,
|
||||||
LINE_STYLE_ARROW_SIZE_3 = 3,
|
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
|
||||||
LINE_STYLE_ARROW_SIZE_4 = 4,
|
SHADOW_PRESETS_OUTER_BOTTOM = 2,
|
||||||
LINE_STYLE_ARROW_SIZE_5 = 5,
|
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
|
||||||
LINE_STYLE_ARROW_SIZE_6 = 6,
|
SHADOW_PRESETS_OUTER_RIGHT = 4,
|
||||||
LINE_STYLE_ARROW_SIZE_7 = 7,
|
SHADOW_PRESETS_OUTER_CENTER = 5,
|
||||||
LINE_STYLE_ARROW_SIZE_8 = 8,
|
SHADOW_PRESETS_OUTER_LEFT = 6,
|
||||||
LINE_STYLE_ARROW_SIZE_9 = 9;
|
SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
|
||||||
|
SHADOW_PRESETS_OUTER_TOP = 8,
|
||||||
|
SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
|
||||||
|
SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
|
||||||
|
SHADOW_PRESETS_INNER_BOTTOM = 11,
|
||||||
|
SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
|
||||||
|
SHADOW_PRESETS_INNER_RIGHT = 13,
|
||||||
|
SHADOW_PRESETS_INNER_CENTER = 14,
|
||||||
|
SHADOW_PRESETS_INNER_LEFT = 15,
|
||||||
|
SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
|
||||||
|
SHADOW_PRESETS_INNER_TOP = 17,
|
||||||
|
SHADOW_PRESETS_INNER_TOP_LEFT = 18,
|
||||||
|
SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
|
||||||
|
SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
|
||||||
|
SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
|
||||||
|
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
|
||||||
|
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
|
||||||
|
|
||||||
const
|
protected function getExcelPointsWidth($width)
|
||||||
SHADOW_PRESETS_NOSHADOW = NULL,
|
{
|
||||||
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
|
return $width * 12700;
|
||||||
SHADOW_PRESETS_OUTER_BOTTOM = 2,
|
|
||||||
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
|
|
||||||
SHADOW_PRESETS_OUTER_RIGHT = 4,
|
|
||||||
SHADOW_PRESETS_OUTER_CENTER = 5,
|
|
||||||
SHADOW_PRESETS_OUTER_LEFT = 6,
|
|
||||||
SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
|
|
||||||
SHADOW_PRESETS_OUTER_TOP = 8,
|
|
||||||
SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
|
|
||||||
SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
|
|
||||||
SHADOW_PRESETS_INNER_BOTTOM = 11,
|
|
||||||
SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
|
|
||||||
SHADOW_PRESETS_INNER_RIGHT = 13,
|
|
||||||
SHADOW_PRESETS_INNER_CENTER = 14,
|
|
||||||
SHADOW_PRESETS_INNER_LEFT = 15,
|
|
||||||
SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
|
|
||||||
SHADOW_PRESETS_INNER_TOP = 17,
|
|
||||||
SHADOW_PRESETS_INNER_TOP_LEFT = 18,
|
|
||||||
SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
|
|
||||||
SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
|
|
||||||
SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
|
|
||||||
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
|
|
||||||
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
|
|
||||||
|
|
||||||
protected function getExcelPointsWidth($width) {
|
|
||||||
return $width * 12700;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getExcelPointsAngle($angle) {
|
|
||||||
return $angle * 60000;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getTrueAlpha($alpha) {
|
|
||||||
return (string) 100 - $alpha . '000';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setColorProperties($color, $alpha, $type) {
|
|
||||||
return array(
|
|
||||||
'type' => (string) $type,
|
|
||||||
'value' => (string) $color,
|
|
||||||
'alpha' => (string) $this->getTrueAlpha($alpha)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) {
|
|
||||||
$sizes = array(
|
|
||||||
1 => array('w' => 'sm', 'len' => 'sm'),
|
|
||||||
2 => array('w' => 'sm', 'len' => 'med'),
|
|
||||||
3 => array('w' => 'sm', 'len' => 'lg'),
|
|
||||||
4 => array('w' => 'med', 'len' => 'sm'),
|
|
||||||
5 => array('w' => 'med', 'len' => 'med'),
|
|
||||||
6 => array('w' => 'med', 'len' => 'lg'),
|
|
||||||
7 => array('w' => 'lg', 'len' => 'sm'),
|
|
||||||
8 => array('w' => 'lg', 'len' => 'med'),
|
|
||||||
9 => array('w' => 'lg', 'len' => 'lg')
|
|
||||||
);
|
|
||||||
|
|
||||||
return $sizes[$array_selector][$array_kay_selector];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getShadowPresetsMap($shadow_presets_option) {
|
|
||||||
$presets_options = array(
|
|
||||||
//OUTER
|
|
||||||
1 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '2700000',
|
|
||||||
'algn' => 'tl',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
2 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '5400000',
|
|
||||||
'algn' => 't',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
3 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '8100000',
|
|
||||||
'algn' => 'tr',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
4 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'algn' => 'l',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
5 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'size' => array(
|
|
||||||
'sx' => '102000',
|
|
||||||
'sy' => '102000'
|
|
||||||
)
|
|
||||||
,
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '38100',
|
|
||||||
'algn' => 'ctr',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
6 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '10800000',
|
|
||||||
'algn' => 'r',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
7 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '18900000',
|
|
||||||
'algn' => 'bl',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
8 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '16200000',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
9 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '50800',
|
|
||||||
'distance' => '38100',
|
|
||||||
'direction' => '13500000',
|
|
||||||
'algn' => 'br',
|
|
||||||
'rotWithShape' => '0'
|
|
||||||
),
|
|
||||||
//INNER
|
|
||||||
10 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '2700000',
|
|
||||||
),
|
|
||||||
11 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '5400000',
|
|
||||||
),
|
|
||||||
12 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '8100000',
|
|
||||||
),
|
|
||||||
13 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
),
|
|
||||||
14 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '114300',
|
|
||||||
),
|
|
||||||
15 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '10800000',
|
|
||||||
),
|
|
||||||
16 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '18900000',
|
|
||||||
),
|
|
||||||
17 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '16200000',
|
|
||||||
),
|
|
||||||
18 => array(
|
|
||||||
'effect' => 'innerShdw',
|
|
||||||
'blur' => '63500',
|
|
||||||
'distance' => '50800',
|
|
||||||
'direction' => '13500000',
|
|
||||||
),
|
|
||||||
//perspective
|
|
||||||
19 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '152400',
|
|
||||||
'distance' => '317500',
|
|
||||||
'size' => array(
|
|
||||||
'sx' => '90000',
|
|
||||||
'sy' => '-19000',
|
|
||||||
),
|
|
||||||
'direction' => '5400000',
|
|
||||||
'rotWithShape' => '0',
|
|
||||||
),
|
|
||||||
20 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '76200',
|
|
||||||
'direction' => '18900000',
|
|
||||||
'size' => array(
|
|
||||||
'sy' => '23000',
|
|
||||||
'kx' => '-1200000',
|
|
||||||
),
|
|
||||||
'algn' => 'bl',
|
|
||||||
'rotWithShape' => '0',
|
|
||||||
),
|
|
||||||
21 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '76200',
|
|
||||||
'direction' => '13500000',
|
|
||||||
'size' => array(
|
|
||||||
'sy' => '23000',
|
|
||||||
'kx' => '1200000',
|
|
||||||
),
|
|
||||||
'algn' => 'br',
|
|
||||||
'rotWithShape' => '0',
|
|
||||||
),
|
|
||||||
22 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '76200',
|
|
||||||
'distance' => '12700',
|
|
||||||
'direction' => '2700000',
|
|
||||||
'size' => array(
|
|
||||||
'sy' => '-23000',
|
|
||||||
'kx' => '-800400',
|
|
||||||
),
|
|
||||||
'algn' => 'bl',
|
|
||||||
'rotWithShape' => '0',
|
|
||||||
),
|
|
||||||
23 => array(
|
|
||||||
'effect' => 'outerShdw',
|
|
||||||
'blur' => '76200',
|
|
||||||
'distance' => '12700',
|
|
||||||
'direction' => '8100000',
|
|
||||||
'size' => array(
|
|
||||||
'sy' => '-23000',
|
|
||||||
'kx' => '800400',
|
|
||||||
),
|
|
||||||
'algn' => 'br',
|
|
||||||
'rotWithShape' => '0',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return $presets_options[$shadow_presets_option];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getArrayElementsValue($properties, $elements) {
|
|
||||||
$reference = & $properties;
|
|
||||||
if (!is_array($elements)) {
|
|
||||||
return $reference[$elements];
|
|
||||||
} else {
|
|
||||||
foreach ($elements as $keys) {
|
|
||||||
$reference = & $reference[$keys];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $reference;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
protected function getExcelPointsAngle($angle)
|
||||||
}
|
{
|
||||||
|
return $angle * 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTrueAlpha($alpha)
|
||||||
|
{
|
||||||
|
return (string) 100 - $alpha . '000';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setColorProperties($color, $alpha, $type)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'type' => (string) $type,
|
||||||
|
'value' => (string) $color,
|
||||||
|
'alpha' => (string) $this->getTrueAlpha($alpha)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) {
|
||||||
|
$sizes = array(
|
||||||
|
1 => array('w' => 'sm', 'len' => 'sm'),
|
||||||
|
2 => array('w' => 'sm', 'len' => 'med'),
|
||||||
|
3 => array('w' => 'sm', 'len' => 'lg'),
|
||||||
|
4 => array('w' => 'med', 'len' => 'sm'),
|
||||||
|
5 => array('w' => 'med', 'len' => 'med'),
|
||||||
|
6 => array('w' => 'med', 'len' => 'lg'),
|
||||||
|
7 => array('w' => 'lg', 'len' => 'sm'),
|
||||||
|
8 => array('w' => 'lg', 'len' => 'med'),
|
||||||
|
9 => array('w' => 'lg', 'len' => 'lg')
|
||||||
|
);
|
||||||
|
|
||||||
|
return $sizes[$array_selector][$array_kay_selector];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getShadowPresetsMap($shadow_presets_option) {
|
||||||
|
$presets_options = array(
|
||||||
|
//OUTER
|
||||||
|
1 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '2700000',
|
||||||
|
'algn' => 'tl',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
2 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '5400000',
|
||||||
|
'algn' => 't',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
3 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '8100000',
|
||||||
|
'algn' => 'tr',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
4 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'algn' => 'l',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
5 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'size' => array(
|
||||||
|
'sx' => '102000',
|
||||||
|
'sy' => '102000'
|
||||||
|
)
|
||||||
|
,
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '38100',
|
||||||
|
'algn' => 'ctr',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
6 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '10800000',
|
||||||
|
'algn' => 'r',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
7 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '18900000',
|
||||||
|
'algn' => 'bl',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
8 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '16200000',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
9 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '50800',
|
||||||
|
'distance' => '38100',
|
||||||
|
'direction' => '13500000',
|
||||||
|
'algn' => 'br',
|
||||||
|
'rotWithShape' => '0'
|
||||||
|
),
|
||||||
|
//INNER
|
||||||
|
10 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '2700000',
|
||||||
|
),
|
||||||
|
11 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '5400000',
|
||||||
|
),
|
||||||
|
12 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '8100000',
|
||||||
|
),
|
||||||
|
13 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
),
|
||||||
|
14 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '114300',
|
||||||
|
),
|
||||||
|
15 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '10800000',
|
||||||
|
),
|
||||||
|
16 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '18900000',
|
||||||
|
),
|
||||||
|
17 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '16200000',
|
||||||
|
),
|
||||||
|
18 => array(
|
||||||
|
'effect' => 'innerShdw',
|
||||||
|
'blur' => '63500',
|
||||||
|
'distance' => '50800',
|
||||||
|
'direction' => '13500000',
|
||||||
|
),
|
||||||
|
//perspective
|
||||||
|
19 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '152400',
|
||||||
|
'distance' => '317500',
|
||||||
|
'size' => array(
|
||||||
|
'sx' => '90000',
|
||||||
|
'sy' => '-19000',
|
||||||
|
),
|
||||||
|
'direction' => '5400000',
|
||||||
|
'rotWithShape' => '0',
|
||||||
|
),
|
||||||
|
20 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '76200',
|
||||||
|
'direction' => '18900000',
|
||||||
|
'size' => array(
|
||||||
|
'sy' => '23000',
|
||||||
|
'kx' => '-1200000',
|
||||||
|
),
|
||||||
|
'algn' => 'bl',
|
||||||
|
'rotWithShape' => '0',
|
||||||
|
),
|
||||||
|
21 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '76200',
|
||||||
|
'direction' => '13500000',
|
||||||
|
'size' => array(
|
||||||
|
'sy' => '23000',
|
||||||
|
'kx' => '1200000',
|
||||||
|
),
|
||||||
|
'algn' => 'br',
|
||||||
|
'rotWithShape' => '0',
|
||||||
|
),
|
||||||
|
22 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '76200',
|
||||||
|
'distance' => '12700',
|
||||||
|
'direction' => '2700000',
|
||||||
|
'size' => array(
|
||||||
|
'sy' => '-23000',
|
||||||
|
'kx' => '-800400',
|
||||||
|
),
|
||||||
|
'algn' => 'bl',
|
||||||
|
'rotWithShape' => '0',
|
||||||
|
),
|
||||||
|
23 => array(
|
||||||
|
'effect' => 'outerShdw',
|
||||||
|
'blur' => '76200',
|
||||||
|
'distance' => '12700',
|
||||||
|
'direction' => '8100000',
|
||||||
|
'size' => array(
|
||||||
|
'sy' => '-23000',
|
||||||
|
'kx' => '800400',
|
||||||
|
),
|
||||||
|
'algn' => 'br',
|
||||||
|
'rotWithShape' => '0',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $presets_options[$shadow_presets_option];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getArrayElementsValue($properties, $elements) {
|
||||||
|
$reference = & $properties;
|
||||||
|
if (!is_array($elements)) {
|
||||||
|
return $reference[$elements];
|
||||||
|
} else {
|
||||||
|
foreach ($elements as $keys) {
|
||||||
|
$reference = & $reference[$keys];
|
||||||
|
}
|
||||||
|
return $reference;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
@ -76,11 +76,11 @@ class PHPExcel_DocumentSecurity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is some sort of dcument security enabled?
|
* Is some sort of document security enabled?
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isSecurityEnabled()
|
public function isSecurityEnabled()
|
||||||
{
|
{
|
||||||
return $this->_lockRevision ||
|
return $this->_lockRevision ||
|
||||||
$this->_lockStructure ||
|
$this->_lockStructure ||
|
||||||
@ -92,7 +92,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getLockRevision()
|
public function getLockRevision()
|
||||||
{
|
{
|
||||||
return $this->_lockRevision;
|
return $this->_lockRevision;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
* @param boolean $pValue
|
* @param boolean $pValue
|
||||||
* @return PHPExcel_DocumentSecurity
|
* @return PHPExcel_DocumentSecurity
|
||||||
*/
|
*/
|
||||||
function setLockRevision($pValue = false)
|
public function setLockRevision($pValue = false)
|
||||||
{
|
{
|
||||||
$this->_lockRevision = $pValue;
|
$this->_lockRevision = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
@ -114,7 +114,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getLockStructure()
|
public function getLockStructure()
|
||||||
{
|
{
|
||||||
return $this->_lockStructure;
|
return $this->_lockStructure;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
* @param boolean $pValue
|
* @param boolean $pValue
|
||||||
* @return PHPExcel_DocumentSecurity
|
* @return PHPExcel_DocumentSecurity
|
||||||
*/
|
*/
|
||||||
function setLockStructure($pValue = false)
|
public function setLockStructure($pValue = false)
|
||||||
{
|
{
|
||||||
$this->_lockStructure = $pValue;
|
$this->_lockStructure = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
@ -136,7 +136,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getLockWindows()
|
public function getLockWindows()
|
||||||
{
|
{
|
||||||
return $this->_lockWindows;
|
return $this->_lockWindows;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
* @param boolean $pValue
|
* @param boolean $pValue
|
||||||
* @return PHPExcel_DocumentSecurity
|
* @return PHPExcel_DocumentSecurity
|
||||||
*/
|
*/
|
||||||
function setLockWindows($pValue = false)
|
public function setLockWindows($pValue = false)
|
||||||
{
|
{
|
||||||
$this->_lockWindows = $pValue;
|
$this->_lockWindows = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
@ -158,7 +158,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getRevisionsPassword()
|
public function getRevisionsPassword()
|
||||||
{
|
{
|
||||||
return $this->_revisionsPassword;
|
return $this->_revisionsPassword;
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||||
* @return PHPExcel_DocumentSecurity
|
* @return PHPExcel_DocumentSecurity
|
||||||
*/
|
*/
|
||||||
function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
|
public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
|
||||||
{
|
{
|
||||||
if (!$pAlreadyHashed) {
|
if (!$pAlreadyHashed) {
|
||||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||||
@ -184,7 +184,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getWorkbookPassword()
|
public function getWorkbookPassword()
|
||||||
{
|
{
|
||||||
return $this->_workbookPassword;
|
return $this->_workbookPassword;
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ class PHPExcel_DocumentSecurity
|
|||||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||||
* @return PHPExcel_DocumentSecurity
|
* @return PHPExcel_DocumentSecurity
|
||||||
*/
|
*/
|
||||||
function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
|
public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
|
||||||
{
|
{
|
||||||
if (!$pAlreadyHashed) {
|
if (!$pAlreadyHashed) {
|
||||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||||
|
@ -526,12 +526,12 @@ class PHPExcel_Helper_HTML
|
|||||||
protected $size;
|
protected $size;
|
||||||
protected $color;
|
protected $color;
|
||||||
|
|
||||||
protected $bold = false;
|
protected $bold = false;
|
||||||
protected $italic = false;
|
protected $italic = false;
|
||||||
protected $underline = false;
|
protected $underline = false;
|
||||||
protected $superscript = false;
|
protected $superscript = false;
|
||||||
protected $subscript = false;
|
protected $subscript = false;
|
||||||
protected $strikethrough = false;
|
protected $strikethrough = false;
|
||||||
|
|
||||||
protected $startTagCallbacks = array(
|
protected $startTagCallbacks = array(
|
||||||
'font' => 'startFontTag',
|
'font' => 'startFontTag',
|
||||||
@ -585,13 +585,13 @@ class PHPExcel_Helper_HTML
|
|||||||
public function toRichTextObject($html) {
|
public function toRichTextObject($html) {
|
||||||
$this->initialise();
|
$this->initialise();
|
||||||
|
|
||||||
// Create a new DOM object
|
// Create a new DOM object
|
||||||
$dom = new domDocument;
|
$dom = new domDocument;
|
||||||
// Load the HTML file into the DOM object
|
// Load the HTML file into the DOM object
|
||||||
// Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup
|
// Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup
|
||||||
$loaded = @$dom->loadHTML($html);
|
$loaded = @$dom->loadHTML($html);
|
||||||
|
|
||||||
// Discard excess white space
|
// Discard excess white space
|
||||||
$dom->preserveWhiteSpace = false;
|
$dom->preserveWhiteSpace = false;
|
||||||
|
|
||||||
$this->richTextObject = new PHPExcel_RichText();;
|
$this->richTextObject = new PHPExcel_RichText();;
|
||||||
|
@ -31,5 +31,4 @@ interface PHPExcel_IComparable
|
|||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode();
|
public function getHashCode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,500 +18,500 @@
|
|||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel2007
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Reader_Excel2007_Chart
|
* PHPExcel_Reader_Excel2007_Chart
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel2007
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel2007_Chart
|
class PHPExcel_Reader_Excel2007_Chart
|
||||||
{
|
{
|
||||||
private static function _getAttribute($component, $name, $format) {
|
private static function _getAttribute($component, $name, $format) {
|
||||||
$attributes = $component->attributes();
|
$attributes = $component->attributes();
|
||||||
if (isset($attributes[$name])) {
|
if (isset($attributes[$name])) {
|
||||||
if ($format == 'string') {
|
if ($format == 'string') {
|
||||||
return (string) $attributes[$name];
|
return (string) $attributes[$name];
|
||||||
} elseif ($format == 'integer') {
|
} elseif ($format == 'integer') {
|
||||||
return (integer) $attributes[$name];
|
return (integer) $attributes[$name];
|
||||||
} elseif ($format == 'boolean') {
|
} elseif ($format == 'boolean') {
|
||||||
return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
|
return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
|
||||||
} else {
|
} else {
|
||||||
return (float) $attributes[$name];
|
return (float) $attributes[$name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} // function _getAttribute()
|
} // function _getAttribute()
|
||||||
|
|
||||||
|
|
||||||
private static function _readColor($color,$background=false) {
|
private static function _readColor($color,$background=false) {
|
||||||
if (isset($color["rgb"])) {
|
if (isset($color["rgb"])) {
|
||||||
return (string)$color["rgb"];
|
return (string)$color["rgb"];
|
||||||
} else if (isset($color["indexed"])) {
|
} else if (isset($color["indexed"])) {
|
||||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
|
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function readChart($chartElements,$chartName) {
|
public static function readChart($chartElements,$chartName) {
|
||||||
$namespacesChartMeta = $chartElements->getNamespaces(true);
|
$namespacesChartMeta = $chartElements->getNamespaces(true);
|
||||||
$chartElementsC = $chartElements->children($namespacesChartMeta['c']);
|
$chartElementsC = $chartElements->children($namespacesChartMeta['c']);
|
||||||
|
|
||||||
$XaxisLabel = $YaxisLabel = $legend = $title = NULL;
|
$XaxisLabel = $YaxisLabel = $legend = $title = NULL;
|
||||||
$dispBlanksAs = $plotVisOnly = NULL;
|
$dispBlanksAs = $plotVisOnly = NULL;
|
||||||
|
|
||||||
foreach($chartElementsC as $chartElementKey => $chartElement) {
|
foreach($chartElementsC as $chartElementKey => $chartElement) {
|
||||||
switch ($chartElementKey) {
|
switch ($chartElementKey) {
|
||||||
case "chart":
|
case "chart":
|
||||||
foreach($chartElement as $chartDetailsKey => $chartDetails) {
|
foreach($chartElement as $chartDetailsKey => $chartDetails) {
|
||||||
$chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
|
$chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
|
||||||
switch ($chartDetailsKey) {
|
switch ($chartDetailsKey) {
|
||||||
case "plotArea":
|
case "plotArea":
|
||||||
$plotAreaLayout = $XaxisLable = $YaxisLable = null;
|
$plotAreaLayout = $XaxisLable = $YaxisLable = null;
|
||||||
$plotSeries = $plotAttributes = array();
|
$plotSeries = $plotAttributes = array();
|
||||||
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
||||||
switch ($chartDetailKey) {
|
switch ($chartDetailKey) {
|
||||||
case "layout":
|
case "layout":
|
||||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'plotArea');
|
$plotAreaLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'plotArea');
|
||||||
break;
|
break;
|
||||||
case "catAx":
|
case "catAx":
|
||||||
if (isset($chartDetail->title)) {
|
if (isset($chartDetail->title)) {
|
||||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "dateAx":
|
case "dateAx":
|
||||||
if (isset($chartDetail->title)) {
|
if (isset($chartDetail->title)) {
|
||||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "valAx":
|
case "valAx":
|
||||||
if (isset($chartDetail->title)) {
|
if (isset($chartDetail->title)) {
|
||||||
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "barChart":
|
case "barChart":
|
||||||
case "bar3DChart":
|
case "bar3DChart":
|
||||||
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string');
|
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string');
|
||||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotSer->setPlotDirection($barDirection);
|
$plotSer->setPlotDirection($barDirection);
|
||||||
$plotSeries[] = $plotSer;
|
$plotSeries[] = $plotSer;
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "lineChart":
|
case "lineChart":
|
||||||
case "line3DChart":
|
case "line3DChart":
|
||||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "areaChart":
|
case "areaChart":
|
||||||
case "area3DChart":
|
case "area3DChart":
|
||||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "doughnutChart":
|
case "doughnutChart":
|
||||||
case "pieChart":
|
case "pieChart":
|
||||||
case "pie3DChart":
|
case "pie3DChart":
|
||||||
$explosion = isset($chartDetail->ser->explosion);
|
$explosion = isset($chartDetail->ser->explosion);
|
||||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotSer->setPlotStyle($explosion);
|
$plotSer->setPlotStyle($explosion);
|
||||||
$plotSeries[] = $plotSer;
|
$plotSeries[] = $plotSer;
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "scatterChart":
|
case "scatterChart":
|
||||||
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string');
|
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string');
|
||||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotSer->setPlotStyle($scatterStyle);
|
$plotSer->setPlotStyle($scatterStyle);
|
||||||
$plotSeries[] = $plotSer;
|
$plotSeries[] = $plotSer;
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "bubbleChart":
|
case "bubbleChart":
|
||||||
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer');
|
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer');
|
||||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotSer->setPlotStyle($bubbleScale);
|
$plotSer->setPlotStyle($bubbleScale);
|
||||||
$plotSeries[] = $plotSer;
|
$plotSeries[] = $plotSer;
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "radarChart":
|
case "radarChart":
|
||||||
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string');
|
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string');
|
||||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotSer->setPlotStyle($radarStyle);
|
$plotSer->setPlotStyle($radarStyle);
|
||||||
$plotSeries[] = $plotSer;
|
$plotSeries[] = $plotSer;
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "surfaceChart":
|
case "surfaceChart":
|
||||||
case "surface3DChart":
|
case "surface3DChart":
|
||||||
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean');
|
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean');
|
||||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotSer->setPlotStyle($wireFrame);
|
$plotSer->setPlotStyle($wireFrame);
|
||||||
$plotSeries[] = $plotSer;
|
$plotSeries[] = $plotSer;
|
||||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||||
break;
|
break;
|
||||||
case "stockChart":
|
case "stockChart":
|
||||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||||
$plotAttributes = self::_readChartAttributes($plotAreaLayout);
|
$plotAttributes = self::_readChartAttributes($plotAreaLayout);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($plotAreaLayout == NULL) {
|
if ($plotAreaLayout == NULL) {
|
||||||
$plotAreaLayout = new PHPExcel_Chart_Layout();
|
$plotAreaLayout = new PHPExcel_Chart_Layout();
|
||||||
}
|
}
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries);
|
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries);
|
||||||
self::_setChartAttributes($plotAreaLayout,$plotAttributes);
|
self::_setChartAttributes($plotAreaLayout,$plotAttributes);
|
||||||
break;
|
break;
|
||||||
case "plotVisOnly":
|
case "plotVisOnly":
|
||||||
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string');
|
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string');
|
||||||
break;
|
break;
|
||||||
case "dispBlanksAs":
|
case "dispBlanksAs":
|
||||||
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
|
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
|
||||||
break;
|
break;
|
||||||
case "title":
|
case "title":
|
||||||
$title = self::_chartTitle($chartDetails,$namespacesChartMeta,'title');
|
$title = self::_chartTitle($chartDetails,$namespacesChartMeta,'title');
|
||||||
break;
|
break;
|
||||||
case "legend":
|
case "legend":
|
||||||
$legendPos = 'r';
|
$legendPos = 'r';
|
||||||
$legendLayout = null;
|
$legendLayout = null;
|
||||||
$legendOverlay = false;
|
$legendOverlay = false;
|
||||||
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
||||||
switch ($chartDetailKey) {
|
switch ($chartDetailKey) {
|
||||||
case "legendPos":
|
case "legendPos":
|
||||||
$legendPos = self::_getAttribute($chartDetail, 'val', 'string');
|
$legendPos = self::_getAttribute($chartDetail, 'val', 'string');
|
||||||
break;
|
break;
|
||||||
case "overlay":
|
case "overlay":
|
||||||
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
|
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
|
||||||
break;
|
break;
|
||||||
case "layout":
|
case "layout":
|
||||||
$legendLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'legend');
|
$legendLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'legend');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay);
|
$legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$chart = new PHPExcel_Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel);
|
$chart = new PHPExcel_Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel);
|
||||||
|
|
||||||
return $chart;
|
return $chart;
|
||||||
} // function readChart()
|
} // function readChart()
|
||||||
|
|
||||||
|
|
||||||
private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) {
|
private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) {
|
||||||
$caption = array();
|
$caption = array();
|
||||||
$titleLayout = null;
|
$titleLayout = null;
|
||||||
foreach($titleDetails as $titleDetailKey => $chartDetail) {
|
foreach($titleDetails as $titleDetailKey => $chartDetail) {
|
||||||
switch ($titleDetailKey) {
|
switch ($titleDetailKey) {
|
||||||
case "tx":
|
case "tx":
|
||||||
$titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']);
|
$titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']);
|
||||||
foreach($titleDetails as $titleKey => $titleDetail) {
|
foreach($titleDetails as $titleKey => $titleDetail) {
|
||||||
switch ($titleKey) {
|
switch ($titleKey) {
|
||||||
case "p":
|
case "p":
|
||||||
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
|
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
|
||||||
$caption[] = self::_parseRichText($titleDetailPart);
|
$caption[] = self::_parseRichText($titleDetailPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "layout":
|
case "layout":
|
||||||
$titleLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta);
|
$titleLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PHPExcel_Chart_Title($caption, $titleLayout);
|
return new PHPExcel_Chart_Title($caption, $titleLayout);
|
||||||
} // function _chartTitle()
|
} // function _chartTitle()
|
||||||
|
|
||||||
|
|
||||||
private static function _chartLayoutDetails($chartDetail,$namespacesChartMeta) {
|
private static function _chartLayoutDetails($chartDetail,$namespacesChartMeta) {
|
||||||
if (!isset($chartDetail->manualLayout)) {
|
if (!isset($chartDetail->manualLayout)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$details = $chartDetail->manualLayout->children($namespacesChartMeta['c']);
|
$details = $chartDetail->manualLayout->children($namespacesChartMeta['c']);
|
||||||
if (is_null($details)) {
|
if (is_null($details)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$layout = array();
|
$layout = array();
|
||||||
foreach($details as $detailKey => $detail) {
|
foreach($details as $detailKey => $detail) {
|
||||||
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
|
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
|
||||||
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
|
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
|
||||||
}
|
}
|
||||||
return new PHPExcel_Chart_Layout($layout);
|
return new PHPExcel_Chart_Layout($layout);
|
||||||
} // function _chartLayoutDetails()
|
} // function _chartLayoutDetails()
|
||||||
|
|
||||||
|
|
||||||
private static function _chartDataSeries($chartDetail,$namespacesChartMeta,$plotType) {
|
private static function _chartDataSeries($chartDetail,$namespacesChartMeta,$plotType) {
|
||||||
$multiSeriesType = NULL;
|
$multiSeriesType = NULL;
|
||||||
$smoothLine = false;
|
$smoothLine = false;
|
||||||
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
|
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
|
||||||
|
|
||||||
$seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']);
|
$seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']);
|
||||||
foreach($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
|
foreach($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
|
||||||
switch ($seriesDetailKey) {
|
switch ($seriesDetailKey) {
|
||||||
case "grouping":
|
case "grouping":
|
||||||
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string');
|
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string');
|
||||||
break;
|
break;
|
||||||
case "ser":
|
case "ser":
|
||||||
$marker = NULL;
|
$marker = NULL;
|
||||||
foreach($seriesDetails as $seriesKey => $seriesDetail) {
|
foreach($seriesDetails as $seriesKey => $seriesDetail) {
|
||||||
switch ($seriesKey) {
|
switch ($seriesKey) {
|
||||||
case "idx":
|
case "idx":
|
||||||
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer');
|
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer');
|
||||||
break;
|
break;
|
||||||
case "order":
|
case "order":
|
||||||
$seriesOrder = self::_getAttribute($seriesDetail, 'val', 'integer');
|
$seriesOrder = self::_getAttribute($seriesDetail, 'val', 'integer');
|
||||||
$plotOrder[$seriesIndex] = $seriesOrder;
|
$plotOrder[$seriesIndex] = $seriesOrder;
|
||||||
break;
|
break;
|
||||||
case "tx":
|
case "tx":
|
||||||
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
||||||
break;
|
break;
|
||||||
case "marker":
|
case "marker":
|
||||||
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string');
|
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string');
|
||||||
break;
|
break;
|
||||||
case "smooth":
|
case "smooth":
|
||||||
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean');
|
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean');
|
||||||
break;
|
break;
|
||||||
case "cat":
|
case "cat":
|
||||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
||||||
break;
|
break;
|
||||||
case "val":
|
case "val":
|
||||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||||
break;
|
break;
|
||||||
case "xVal":
|
case "xVal":
|
||||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||||
break;
|
break;
|
||||||
case "yVal":
|
case "yVal":
|
||||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PHPExcel_Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine);
|
return new PHPExcel_Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine);
|
||||||
} // function _chartDataSeries()
|
} // function _chartDataSeries()
|
||||||
|
|
||||||
|
|
||||||
private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) {
|
private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) {
|
||||||
if (isset($seriesDetail->strRef)) {
|
if (isset($seriesDetail->strRef)) {
|
||||||
$seriesSource = (string) $seriesDetail->strRef->f;
|
$seriesSource = (string) $seriesDetail->strRef->f;
|
||||||
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s');
|
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s');
|
||||||
|
|
||||||
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||||
} elseif (isset($seriesDetail->numRef)) {
|
} elseif (isset($seriesDetail->numRef)) {
|
||||||
$seriesSource = (string) $seriesDetail->numRef->f;
|
$seriesSource = (string) $seriesDetail->numRef->f;
|
||||||
$seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
|
$seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
|
||||||
|
|
||||||
return new PHPExcel_Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
return new PHPExcel_Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||||
} elseif (isset($seriesDetail->multiLvlStrRef)) {
|
} elseif (isset($seriesDetail->multiLvlStrRef)) {
|
||||||
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
|
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
|
||||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s');
|
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s');
|
||||||
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
||||||
|
|
||||||
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||||
} elseif (isset($seriesDetail->multiLvlNumRef)) {
|
} elseif (isset($seriesDetail->multiLvlNumRef)) {
|
||||||
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
|
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
|
||||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s');
|
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s');
|
||||||
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
||||||
|
|
||||||
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} // function _chartDataSeriesValueSet()
|
} // function _chartDataSeriesValueSet()
|
||||||
|
|
||||||
|
|
||||||
private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') {
|
private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') {
|
||||||
$seriesVal = array();
|
$seriesVal = array();
|
||||||
$formatCode = '';
|
$formatCode = '';
|
||||||
$pointCount = 0;
|
$pointCount = 0;
|
||||||
|
|
||||||
foreach($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
foreach($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
||||||
switch ($seriesValueIdx) {
|
switch ($seriesValueIdx) {
|
||||||
case 'ptCount':
|
case 'ptCount':
|
||||||
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
||||||
break;
|
break;
|
||||||
case 'formatCode':
|
case 'formatCode':
|
||||||
$formatCode = (string) $seriesValue;
|
$formatCode = (string) $seriesValue;
|
||||||
break;
|
break;
|
||||||
case 'pt':
|
case 'pt':
|
||||||
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
|
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
|
||||||
if ($dataType == 's') {
|
if ($dataType == 's') {
|
||||||
$seriesVal[$pointVal] = (string) $seriesValue->v;
|
$seriesVal[$pointVal] = (string) $seriesValue->v;
|
||||||
} else {
|
} else {
|
||||||
$seriesVal[$pointVal] = (float) $seriesValue->v;
|
$seriesVal[$pointVal] = (float) $seriesValue->v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($seriesVal)) {
|
if (empty($seriesVal)) {
|
||||||
$seriesVal = NULL;
|
$seriesVal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array( 'formatCode' => $formatCode,
|
return array( 'formatCode' => $formatCode,
|
||||||
'pointCount' => $pointCount,
|
'pointCount' => $pointCount,
|
||||||
'dataValues' => $seriesVal
|
'dataValues' => $seriesVal
|
||||||
);
|
);
|
||||||
} // function _chartDataSeriesValues()
|
} // function _chartDataSeriesValues()
|
||||||
|
|
||||||
|
|
||||||
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') {
|
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') {
|
||||||
$seriesVal = array();
|
$seriesVal = array();
|
||||||
$formatCode = '';
|
$formatCode = '';
|
||||||
$pointCount = 0;
|
$pointCount = 0;
|
||||||
|
|
||||||
foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
|
foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
|
||||||
foreach($seriesLevel as $seriesValueIdx => $seriesValue) {
|
foreach($seriesLevel as $seriesValueIdx => $seriesValue) {
|
||||||
switch ($seriesValueIdx) {
|
switch ($seriesValueIdx) {
|
||||||
case 'ptCount':
|
case 'ptCount':
|
||||||
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
||||||
break;
|
break;
|
||||||
case 'formatCode':
|
case 'formatCode':
|
||||||
$formatCode = (string) $seriesValue;
|
$formatCode = (string) $seriesValue;
|
||||||
break;
|
break;
|
||||||
case 'pt':
|
case 'pt':
|
||||||
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
|
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
|
||||||
if ($dataType == 's') {
|
if ($dataType == 's') {
|
||||||
$seriesVal[$pointVal][] = (string) $seriesValue->v;
|
$seriesVal[$pointVal][] = (string) $seriesValue->v;
|
||||||
} else {
|
} else {
|
||||||
$seriesVal[$pointVal][] = (float) $seriesValue->v;
|
$seriesVal[$pointVal][] = (float) $seriesValue->v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array( 'formatCode' => $formatCode,
|
return array( 'formatCode' => $formatCode,
|
||||||
'pointCount' => $pointCount,
|
'pointCount' => $pointCount,
|
||||||
'dataValues' => $seriesVal
|
'dataValues' => $seriesVal
|
||||||
);
|
);
|
||||||
} // function _chartDataSeriesValuesMultiLevel()
|
} // function _chartDataSeriesValuesMultiLevel()
|
||||||
|
|
||||||
private static function _parseRichText($titleDetailPart = null) {
|
private static function _parseRichText($titleDetailPart = null) {
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||||
if (isset($titleDetailElement->t)) {
|
if (isset($titleDetailElement->t)) {
|
||||||
$objText = $value->createTextRun( (string) $titleDetailElement->t );
|
$objText = $value->createTextRun( (string) $titleDetailElement->t );
|
||||||
}
|
}
|
||||||
if (isset($titleDetailElement->rPr)) {
|
if (isset($titleDetailElement->rPr)) {
|
||||||
if (isset($titleDetailElement->rPr->rFont["val"])) {
|
if (isset($titleDetailElement->rPr->rFont["val"])) {
|
||||||
$objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
|
$objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
|
$fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
|
||||||
if (!is_null($fontSize)) {
|
if (!is_null($fontSize)) {
|
||||||
$objText->getFont()->setSize(floor($fontSize / 100));
|
$objText->getFont()->setSize(floor($fontSize / 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string'));
|
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string'));
|
||||||
if (!is_null($fontColor)) {
|
if (!is_null($fontColor)) {
|
||||||
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) );
|
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean');
|
$bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean');
|
||||||
if (!is_null($bold)) {
|
if (!is_null($bold)) {
|
||||||
$objText->getFont()->setBold($bold);
|
$objText->getFont()->setBold($bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
$italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean');
|
$italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean');
|
||||||
if (!is_null($italic)) {
|
if (!is_null($italic)) {
|
||||||
$objText->getFont()->setItalic($italic);
|
$objText->getFont()->setItalic($italic);
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
|
$baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
|
||||||
if (!is_null($baseline)) {
|
if (!is_null($baseline)) {
|
||||||
if ($baseline > 0) {
|
if ($baseline > 0) {
|
||||||
$objText->getFont()->setSuperScript(true);
|
$objText->getFont()->setSuperScript(true);
|
||||||
} elseif($baseline < 0) {
|
} elseif($baseline < 0) {
|
||||||
$objText->getFont()->setSubScript(true);
|
$objText->getFont()->setSubScript(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string'));
|
$underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string'));
|
||||||
if (!is_null($underscore)) {
|
if (!is_null($underscore)) {
|
||||||
if ($underscore == 'sng') {
|
if ($underscore == 'sng') {
|
||||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
||||||
} elseif($underscore == 'dbl') {
|
} elseif($underscore == 'dbl') {
|
||||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
|
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
|
||||||
} else {
|
} else {
|
||||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
|
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string'));
|
$strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string'));
|
||||||
if (!is_null($strikethrough)) {
|
if (!is_null($strikethrough)) {
|
||||||
if ($strikethrough == 'noStrike') {
|
if ($strikethrough == 'noStrike') {
|
||||||
$objText->getFont()->setStrikethrough(false);
|
$objText->getFont()->setStrikethrough(false);
|
||||||
} else {
|
} else {
|
||||||
$objText->getFont()->setStrikethrough(true);
|
$objText->getFont()->setStrikethrough(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function _readChartAttributes($chartDetail) {
|
private static function _readChartAttributes($chartDetail) {
|
||||||
$plotAttributes = array();
|
$plotAttributes = array();
|
||||||
if (isset($chartDetail->dLbls)) {
|
if (isset($chartDetail->dLbls)) {
|
||||||
if (isset($chartDetail->dLbls->howLegendKey)) {
|
if (isset($chartDetail->dLbls->howLegendKey)) {
|
||||||
$plotAttributes['showLegendKey'] = self::_getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
|
$plotAttributes['showLegendKey'] = self::_getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
|
||||||
}
|
}
|
||||||
if (isset($chartDetail->dLbls->showVal)) {
|
if (isset($chartDetail->dLbls->showVal)) {
|
||||||
$plotAttributes['showVal'] = self::_getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
|
$plotAttributes['showVal'] = self::_getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
|
||||||
}
|
}
|
||||||
if (isset($chartDetail->dLbls->showCatName)) {
|
if (isset($chartDetail->dLbls->showCatName)) {
|
||||||
$plotAttributes['showCatName'] = self::_getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
|
$plotAttributes['showCatName'] = self::_getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
|
||||||
}
|
}
|
||||||
if (isset($chartDetail->dLbls->showSerName)) {
|
if (isset($chartDetail->dLbls->showSerName)) {
|
||||||
$plotAttributes['showSerName'] = self::_getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
|
$plotAttributes['showSerName'] = self::_getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
|
||||||
}
|
}
|
||||||
if (isset($chartDetail->dLbls->showPercent)) {
|
if (isset($chartDetail->dLbls->showPercent)) {
|
||||||
$plotAttributes['showPercent'] = self::_getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
|
$plotAttributes['showPercent'] = self::_getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
|
||||||
}
|
}
|
||||||
if (isset($chartDetail->dLbls->showBubbleSize)) {
|
if (isset($chartDetail->dLbls->showBubbleSize)) {
|
||||||
$plotAttributes['showBubbleSize'] = self::_getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
|
$plotAttributes['showBubbleSize'] = self::_getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
|
||||||
}
|
}
|
||||||
if (isset($chartDetail->dLbls->showLeaderLines)) {
|
if (isset($chartDetail->dLbls->showLeaderLines)) {
|
||||||
$plotAttributes['showLeaderLines'] = self::_getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
|
$plotAttributes['showLeaderLines'] = self::_getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $plotAttributes;
|
return $plotAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function _setChartAttributes($plotArea,$plotAttributes)
|
private static function _setChartAttributes($plotArea,$plotAttributes)
|
||||||
{
|
{
|
||||||
foreach($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
foreach($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||||
switch($plotAttributeKey) {
|
switch($plotAttributeKey) {
|
||||||
case 'showLegendKey' :
|
case 'showLegendKey' :
|
||||||
$plotArea->setShowLegendKey($plotAttributeValue);
|
$plotArea->setShowLegendKey($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
case 'showVal' :
|
case 'showVal' :
|
||||||
$plotArea->setShowVal($plotAttributeValue);
|
$plotArea->setShowVal($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
case 'showCatName' :
|
case 'showCatName' :
|
||||||
$plotArea->setShowCatName($plotAttributeValue);
|
$plotArea->setShowCatName($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
case 'showSerName' :
|
case 'showSerName' :
|
||||||
$plotArea->setShowSerName($plotAttributeValue);
|
$plotArea->setShowSerName($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
case 'showPercent' :
|
case 'showPercent' :
|
||||||
$plotArea->setShowPercent($plotAttributeValue);
|
$plotArea->setShowPercent($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
case 'showBubbleSize' :
|
case 'showBubbleSize' :
|
||||||
$plotArea->setShowBubbleSize($plotAttributeValue);
|
$plotArea->setShowBubbleSize($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
case 'showLeaderLines' :
|
case 'showLeaderLines' :
|
||||||
$plotArea->setShowLeaderLines($plotAttributeValue);
|
$plotArea->setShowLeaderLines($plotAttributeValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel2007
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,57 +35,57 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel2007_Theme
|
class PHPExcel_Reader_Excel2007_Theme
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Theme Name
|
* Theme Name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_themeName;
|
private $_themeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Colour Scheme Name
|
* Colour Scheme Name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_colourSchemeName;
|
private $_colourSchemeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Colour Map indexed by position
|
* Colour Map indexed by position
|
||||||
*
|
*
|
||||||
* @var array of string
|
* @var array of string
|
||||||
*/
|
*/
|
||||||
private $_colourMapValues;
|
private $_colourMapValues;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Colour Map
|
* Colour Map
|
||||||
*
|
*
|
||||||
* @var array of string
|
* @var array of string
|
||||||
*/
|
*/
|
||||||
private $_colourMap;
|
private $_colourMap;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Theme
|
* Create a new PHPExcel_Theme
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __construct($themeName,$colourSchemeName,$colourMap)
|
public function __construct($themeName,$colourSchemeName,$colourMap)
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_themeName = $themeName;
|
$this->_themeName = $themeName;
|
||||||
$this->_colourSchemeName = $colourSchemeName;
|
$this->_colourSchemeName = $colourSchemeName;
|
||||||
$this->_colourMap = $colourMap;
|
$this->_colourMap = $colourMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Theme Name
|
* Get Theme Name
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getThemeName()
|
public function getThemeName()
|
||||||
{
|
{
|
||||||
return $this->_themeName;
|
return $this->_themeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get colour Scheme Name
|
* Get colour Scheme Name
|
||||||
@ -93,7 +93,7 @@ class PHPExcel_Reader_Excel2007_Theme
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getColourSchemeName() {
|
public function getColourSchemeName() {
|
||||||
return $this->_colourSchemeName;
|
return $this->_colourSchemeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,23 +102,23 @@ class PHPExcel_Reader_Excel2007_Theme
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getColourByIndex($index=0) {
|
public function getColourByIndex($index=0) {
|
||||||
if (isset($this->_colourMap[$index])) {
|
if (isset($this->_colourMap[$index])) {
|
||||||
return $this->_colourMap[$index];
|
return $this->_colourMap[$index];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if ((is_object($value)) && ($key != '_parent')) {
|
if ((is_object($value)) && ($key != '_parent')) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -21,68 +21,68 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel5
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Reader_Excel5_RC4
|
* PHPExcel_Reader_Excel5_RC4
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel5
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel5_RC4
|
class PHPExcel_Reader_Excel5_RC4
|
||||||
{
|
{
|
||||||
// Context
|
// Context
|
||||||
var $s = array();
|
var $s = array();
|
||||||
var $i = 0;
|
var $i = 0;
|
||||||
var $j = 0;
|
var $j = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RC4 stream decryption/encryption constrcutor
|
* RC4 stream decryption/encryption constrcutor
|
||||||
*
|
*
|
||||||
* @param string $key Encryption key/passphrase
|
* @param string $key Encryption key/passphrase
|
||||||
*/
|
*/
|
||||||
public function __construct($key)
|
public function __construct($key)
|
||||||
{
|
{
|
||||||
$len = strlen($key);
|
$len = strlen($key);
|
||||||
|
|
||||||
for ($this->i = 0; $this->i < 256; $this->i++) {
|
for ($this->i = 0; $this->i < 256; $this->i++) {
|
||||||
$this->s[$this->i] = $this->i;
|
$this->s[$this->i] = $this->i;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->j = 0;
|
$this->j = 0;
|
||||||
for ($this->i = 0; $this->i < 256; $this->i++) {
|
for ($this->i = 0; $this->i < 256; $this->i++) {
|
||||||
$this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
|
$this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
|
||||||
$t = $this->s[$this->i];
|
$t = $this->s[$this->i];
|
||||||
$this->s[$this->i] = $this->s[$this->j];
|
$this->s[$this->i] = $this->s[$this->j];
|
||||||
$this->s[$this->j] = $t;
|
$this->s[$this->j] = $t;
|
||||||
}
|
}
|
||||||
$this->i = $this->j = 0;
|
$this->i = $this->j = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Symmetric decryption/encryption function
|
* Symmetric decryption/encryption function
|
||||||
*
|
*
|
||||||
* @param string $data Data to encrypt/decrypt
|
* @param string $data Data to encrypt/decrypt
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function RC4($data)
|
public function RC4($data)
|
||||||
{
|
{
|
||||||
$len = strlen($data);
|
$len = strlen($data);
|
||||||
for ($c = 0; $c < $len; $c++) {
|
for ($c = 0; $c < $len; $c++) {
|
||||||
$this->i = ($this->i + 1) % 256;
|
$this->i = ($this->i + 1) % 256;
|
||||||
$this->j = ($this->j + $this->s[$this->i]) % 256;
|
$this->j = ($this->j + $this->s[$this->i]) % 256;
|
||||||
$t = $this->s[$this->i];
|
$t = $this->s[$this->i];
|
||||||
$this->s[$this->i] = $this->s[$this->j];
|
$this->s[$this->i] = $this->s[$this->j];
|
||||||
$this->s[$this->j] = $t;
|
$this->s[$this->j] = $t;
|
||||||
|
|
||||||
$t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
|
$t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
|
||||||
|
|
||||||
$data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
|
$data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,6 @@ class PHPExcel_Shared_CodePage
|
|||||||
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
|
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
|
||||||
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new PHPExcel_Exception('Unknown codepage: ' . $codePage);
|
throw new PHPExcel_Exception('Unknown codepage: ' . $codePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,20 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Shared_Date
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Shared
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
@ -38,6 +52,7 @@ class PHPExcel_Shared_Date
|
|||||||
* @public
|
* @public
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static $monthNames = array(
|
public static $monthNames = array(
|
||||||
'Jan' => 'January',
|
'Jan' => 'January',
|
||||||
'Feb' => 'February',
|
'Feb' => 'February',
|
||||||
@ -52,6 +67,21 @@ class PHPExcel_Shared_Date
|
|||||||
'Nov' => 'November',
|
'Nov' => 'November',
|
||||||
'Dec' => 'December',
|
'Dec' => 'December',
|
||||||
);
|
);
|
||||||
|
=======
|
||||||
|
public static $_monthNames = array( 'Jan' => 'January',
|
||||||
|
'Feb' => 'February',
|
||||||
|
'Mar' => 'March',
|
||||||
|
'Apr' => 'April',
|
||||||
|
'May' => 'May',
|
||||||
|
'Jun' => 'June',
|
||||||
|
'Jul' => 'July',
|
||||||
|
'Aug' => 'August',
|
||||||
|
'Sep' => 'September',
|
||||||
|
'Oct' => 'October',
|
||||||
|
'Nov' => 'November',
|
||||||
|
'Dec' => 'December',
|
||||||
|
);
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Names of the months of the year, indexed by shortname
|
* Names of the months of the year, indexed by shortname
|
||||||
@ -60,12 +90,20 @@ class PHPExcel_Shared_Date
|
|||||||
* @public
|
* @public
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static $numberSuffixes = array(
|
public static $numberSuffixes = array(
|
||||||
'st',
|
'st',
|
||||||
'nd',
|
'nd',
|
||||||
'rd',
|
'rd',
|
||||||
'th',
|
'th',
|
||||||
);
|
);
|
||||||
|
=======
|
||||||
|
public static $_numberSuffixes = array( 'st',
|
||||||
|
'nd',
|
||||||
|
'rd',
|
||||||
|
'th',
|
||||||
|
);
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base calendar year to use for calculations
|
* Base calendar year to use for calculations
|
||||||
@ -73,7 +111,11 @@ class PHPExcel_Shared_Date
|
|||||||
* @private
|
* @private
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900;
|
protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900;
|
||||||
|
=======
|
||||||
|
protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
||||||
@ -81,6 +123,7 @@ class PHPExcel_Shared_Date
|
|||||||
* @param integer $baseDate Excel base date (1900 or 1904)
|
* @param integer $baseDate Excel base date (1900 or 1904)
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function setExcelCalendar($baseDate)
|
public static function setExcelCalendar($baseDate)
|
||||||
{
|
{
|
||||||
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
|
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
|
||||||
@ -90,6 +133,16 @@ class PHPExcel_Shared_Date
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
public static function setExcelCalendar($baseDate) {
|
||||||
|
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
|
||||||
|
($baseDate == self::CALENDAR_MAC_1904)) {
|
||||||
|
self::$_excelBaseDate = $baseDate;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
} // function setExcelCalendar()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,10 +150,16 @@ class PHPExcel_Shared_Date
|
|||||||
*
|
*
|
||||||
* @return integer Excel base date (1900 or 1904)
|
* @return integer Excel base date (1900 or 1904)
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function getExcelCalendar()
|
public static function getExcelCalendar()
|
||||||
{
|
{
|
||||||
return self::$excelBaseDate;
|
return self::$excelBaseDate;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
public static function getExcelCalendar() {
|
||||||
|
return self::$_excelBaseDate;
|
||||||
|
} // function getExcelCalendar()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,6 +171,7 @@ class PHPExcel_Shared_Date
|
|||||||
* @param string $timezone The timezone for finding the adjustment from UST
|
* @param string $timezone The timezone for finding the adjustment from UST
|
||||||
* @return long PHP serialized date/time
|
* @return long PHP serialized date/time
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null)
|
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null)
|
||||||
{
|
{
|
||||||
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||||
@ -122,11 +182,26 @@ class PHPExcel_Shared_Date
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$myexcelBaseDate = 24107;
|
$myexcelBaseDate = 24107;
|
||||||
|
=======
|
||||||
|
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
|
||||||
|
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||||
|
$my_excelBaseDate = 25569;
|
||||||
|
// Adjust for the spurious 29-Feb-1900 (Day 60)
|
||||||
|
if ($dateValue < 60) {
|
||||||
|
--$my_excelBaseDate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$my_excelBaseDate = 24107;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform conversion
|
// Perform conversion
|
||||||
if ($dateValue >= 1) {
|
if ($dateValue >= 1) {
|
||||||
|
<<<<<<< HEAD
|
||||||
$utcDays = $dateValue - $myexcelBaseDate;
|
$utcDays = $dateValue - $myexcelBaseDate;
|
||||||
|
=======
|
||||||
|
$utcDays = $dateValue - $my_excelBaseDate;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
$returnValue = round($utcDays * 86400);
|
$returnValue = round($utcDays * 86400);
|
||||||
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
|
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
|
||||||
$returnValue = (integer) $returnValue;
|
$returnValue = (integer) $returnValue;
|
||||||
@ -142,8 +217,14 @@ class PHPExcel_Shared_Date
|
|||||||
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
|
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
|
||||||
0;
|
0;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
return $returnValue + $timezoneAdjustment;
|
return $returnValue + $timezoneAdjustment;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
// Return
|
||||||
|
return $returnValue + $timezoneAdjustment;
|
||||||
|
} // function ExcelToPHP()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,8 +233,12 @@ class PHPExcel_Shared_Date
|
|||||||
* @param integer $dateValue Excel date/time value
|
* @param integer $dateValue Excel date/time value
|
||||||
* @return DateTime PHP date/time object
|
* @return DateTime PHP date/time object
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function ExcelToPHPObject($dateValue = 0)
|
public static function ExcelToPHPObject($dateValue = 0)
|
||||||
{
|
{
|
||||||
|
=======
|
||||||
|
public static function ExcelToPHPObject($dateValue = 0) {
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
$dateTime = self::ExcelToPHP($dateValue);
|
$dateTime = self::ExcelToPHP($dateValue);
|
||||||
$days = floor($dateTime / 86400);
|
$days = floor($dateTime / 86400);
|
||||||
$time = round((($dateTime / 86400) - $days) * 86400);
|
$time = round((($dateTime / 86400) - $days) * 86400);
|
||||||
@ -165,7 +250,11 @@ class PHPExcel_Shared_Date
|
|||||||
$dateObj->setTime($hours,$minutes,$seconds);
|
$dateObj->setTime($hours,$minutes,$seconds);
|
||||||
|
|
||||||
return $dateObj;
|
return $dateObj;
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
} // function ExcelToPHPObject()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,11 +267,18 @@ class PHPExcel_Shared_Date
|
|||||||
* @return mixed Excel date/time value
|
* @return mixed Excel date/time value
|
||||||
* or boolean FALSE on failure
|
* or boolean FALSE on failure
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)
|
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)
|
||||||
{
|
{
|
||||||
$saveTimeZone = date_default_timezone_get();
|
$saveTimeZone = date_default_timezone_get();
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
$retValue = false;
|
$retValue = false;
|
||||||
|
=======
|
||||||
|
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
|
||||||
|
$saveTimeZone = date_default_timezone_get();
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
$retValue = FALSE;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||||
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
||||||
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
||||||
@ -195,7 +291,11 @@ class PHPExcel_Shared_Date
|
|||||||
date_default_timezone_set($saveTimeZone);
|
date_default_timezone_set($saveTimeZone);
|
||||||
|
|
||||||
return $retValue;
|
return $retValue;
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
} // function PHPToExcel()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,13 +309,19 @@ class PHPExcel_Shared_Date
|
|||||||
* @param long $seconds
|
* @param long $seconds
|
||||||
* @return long Excel date/time value
|
* @return long Excel date/time value
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)
|
public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)
|
||||||
{
|
{
|
||||||
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||||
|
=======
|
||||||
|
public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
|
||||||
|
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
//
|
//
|
||||||
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
|
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
|
||||||
// This affects every date following 28th February 1900
|
// This affects every date following 28th February 1900
|
||||||
//
|
//
|
||||||
|
<<<<<<< HEAD
|
||||||
$excel1900isLeapYear = true;
|
$excel1900isLeapYear = true;
|
||||||
if (($year == 1900) && ($month <= 2)) {
|
if (($year == 1900) && ($month <= 2)) {
|
||||||
$excel1900isLeapYear = false;
|
$excel1900isLeapYear = false;
|
||||||
@ -224,6 +330,14 @@ class PHPExcel_Shared_Date
|
|||||||
} else {
|
} else {
|
||||||
$myexcelBaseDate = 2416481;
|
$myexcelBaseDate = 2416481;
|
||||||
$excel1900isLeapYear = false;
|
$excel1900isLeapYear = false;
|
||||||
|
=======
|
||||||
|
$excel1900isLeapYear = TRUE;
|
||||||
|
if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; }
|
||||||
|
$my_excelBaseDate = 2415020;
|
||||||
|
} else {
|
||||||
|
$my_excelBaseDate = 2416481;
|
||||||
|
$excel1900isLeapYear = FALSE;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Julian base date Adjustment
|
// Julian base date Adjustment
|
||||||
@ -237,12 +351,20 @@ class PHPExcel_Shared_Date
|
|||||||
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
|
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
|
||||||
$century = substr($year,0,2);
|
$century = substr($year,0,2);
|
||||||
$decade = substr($year,2,2);
|
$decade = substr($year,2,2);
|
||||||
|
<<<<<<< HEAD
|
||||||
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;
|
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;
|
||||||
|
=======
|
||||||
|
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $my_excelBaseDate + $excel1900isLeapYear;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
|
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
|
||||||
|
|
||||||
return (float) $excelDate + $excelTime;
|
return (float) $excelDate + $excelTime;
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
} // function FormattedPHPToExcel()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -251,14 +373,22 @@ class PHPExcel_Shared_Date
|
|||||||
* @param PHPExcel_Cell $pCell
|
* @param PHPExcel_Cell $pCell
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function isDateTime(PHPExcel_Cell $pCell)
|
public static function isDateTime(PHPExcel_Cell $pCell)
|
||||||
{
|
{
|
||||||
|
=======
|
||||||
|
public static function isDateTime(PHPExcel_Cell $pCell) {
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
return self::isDateTimeFormat(
|
return self::isDateTimeFormat(
|
||||||
$pCell->getWorksheet()->getStyle(
|
$pCell->getWorksheet()->getStyle(
|
||||||
$pCell->getCoordinate()
|
$pCell->getCoordinate()
|
||||||
)->getNumberFormat()
|
)->getNumberFormat()
|
||||||
);
|
);
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
} // function isDateTime()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,10 +397,16 @@ class PHPExcel_Shared_Date
|
|||||||
* @param PHPExcel_Style_NumberFormat $pFormat
|
* @param PHPExcel_Style_NumberFormat $pFormat
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)
|
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)
|
||||||
{
|
{
|
||||||
return self::isDateTimeFormatCode($pFormat->getFormatCode());
|
return self::isDateTimeFormatCode($pFormat->getFormatCode());
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) {
|
||||||
|
return self::isDateTimeFormatCode($pFormat->getFormatCode());
|
||||||
|
} // function isDateTimeFormat()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
private static $possibleDateFormatCharacters = 'eymdHs';
|
private static $possibleDateFormatCharacters = 'eymdHs';
|
||||||
@ -281,6 +417,7 @@ class PHPExcel_Shared_Date
|
|||||||
* @param string $pFormatCode
|
* @param string $pFormatCode
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function isDateTimeFormatCode($pFormatCode = '')
|
public static function isDateTimeFormatCode($pFormatCode = '')
|
||||||
{
|
{
|
||||||
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
|
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
|
||||||
@ -289,6 +426,15 @@ class PHPExcel_Shared_Date
|
|||||||
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
|
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
|
||||||
// Scientific format
|
// Scientific format
|
||||||
return false;
|
return false;
|
||||||
|
=======
|
||||||
|
public static function isDateTimeFormatCode($pFormatCode = '') {
|
||||||
|
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
|
||||||
|
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
|
||||||
|
return FALSE;
|
||||||
|
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
|
||||||
|
// Scientific format
|
||||||
|
return FALSE;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
// Switch on formatcode
|
// Switch on formatcode
|
||||||
switch ($pFormatCode) {
|
switch ($pFormatCode) {
|
||||||
// Explicitly defined date formats
|
// Explicitly defined date formats
|
||||||
@ -314,6 +460,7 @@ class PHPExcel_Shared_Date
|
|||||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16:
|
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16:
|
||||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:
|
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:
|
||||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22:
|
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22:
|
||||||
|
<<<<<<< HEAD
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +489,36 @@ class PHPExcel_Shared_Date
|
|||||||
// No date...
|
// No date...
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Typically number, currency or accounting (or occasionally fraction) formats
|
||||||
|
if ((substr($pFormatCode,0,1) == '_') || (substr($pFormatCode,0,2) == '0 ')) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
// Try checking for any of the date formatting characters that don't appear within square braces
|
||||||
|
if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) {
|
||||||
|
// We might also have a format mask containing quoted strings...
|
||||||
|
// we don't want to test for any of our characters within the quoted blocks
|
||||||
|
if (strpos($pFormatCode,'"') !== FALSE) {
|
||||||
|
$segMatcher = FALSE;
|
||||||
|
foreach(explode('"',$pFormatCode) as $subVal) {
|
||||||
|
// Only test in alternate array entries (the non-quoted blocks)
|
||||||
|
if (($segMatcher = !$segMatcher) &&
|
||||||
|
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No date...
|
||||||
|
return FALSE;
|
||||||
|
} // function isDateTimeFormatCode()
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -350,16 +527,25 @@ class PHPExcel_Shared_Date
|
|||||||
* @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
|
* @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
|
||||||
* @return float|FALSE Excel date/time serial value
|
* @return float|FALSE Excel date/time serial value
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function stringToExcel($dateValue = '')
|
public static function stringToExcel($dateValue = '')
|
||||||
{
|
{
|
||||||
if (strlen($dateValue) < 2)
|
if (strlen($dateValue) < 2)
|
||||||
return false;
|
return false;
|
||||||
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
|
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
|
||||||
return false;
|
return false;
|
||||||
|
=======
|
||||||
|
public static function stringToExcel($dateValue = '') {
|
||||||
|
if (strlen($dateValue) < 2)
|
||||||
|
return FALSE;
|
||||||
|
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
|
||||||
|
return FALSE;
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
$dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
|
$dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
|
||||||
|
|
||||||
if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
|
if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
|
||||||
|
<<<<<<< HEAD
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,6 +561,24 @@ class PHPExcel_Shared_Date
|
|||||||
|
|
||||||
public static function monthStringToNumber($month)
|
public static function monthStringToNumber($month)
|
||||||
{
|
{
|
||||||
|
=======
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
if (strpos($dateValue, ':') !== FALSE) {
|
||||||
|
$timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);
|
||||||
|
if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
$dateValueNew += $timeValue;
|
||||||
|
}
|
||||||
|
return $dateValueNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function monthStringToNumber($month) {
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
$monthIndex = 1;
|
$monthIndex = 1;
|
||||||
foreach(self::$monthNames as $shortMonthName => $longMonthName) {
|
foreach(self::$monthNames as $shortMonthName => $longMonthName) {
|
||||||
if (($month === $longMonthName) || ($month === $shortMonthName)) {
|
if (($month === $longMonthName) || ($month === $shortMonthName)) {
|
||||||
@ -385,9 +589,14 @@ class PHPExcel_Shared_Date
|
|||||||
return $month;
|
return $month;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
public static function dayStringToNumber($day)
|
public static function dayStringToNumber($day)
|
||||||
{
|
{
|
||||||
$strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
|
$strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
|
||||||
|
=======
|
||||||
|
public static function dayStringToNumber($day) {
|
||||||
|
$strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day));
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
if (is_numeric($strippedDayValue)) {
|
if (is_numeric($strippedDayValue)) {
|
||||||
return $strippedDayValue;
|
return $strippedDayValue;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,149 +35,149 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Drawing
|
class PHPExcel_Shared_Drawing
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Convert pixels to EMU
|
* Convert pixels to EMU
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in pixels
|
* @param int $pValue Value in pixels
|
||||||
* @return int Value in EMU
|
* @return int Value in EMU
|
||||||
*/
|
*/
|
||||||
public static function pixelsToEMU($pValue = 0) {
|
public static function pixelsToEMU($pValue = 0) {
|
||||||
return round($pValue * 9525);
|
return round($pValue * 9525);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert EMU to pixels
|
* Convert EMU to pixels
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in EMU
|
* @param int $pValue Value in EMU
|
||||||
* @return int Value in pixels
|
* @return int Value in pixels
|
||||||
*/
|
*/
|
||||||
public static function EMUToPixels($pValue = 0) {
|
public static function EMUToPixels($pValue = 0) {
|
||||||
if ($pValue != 0) {
|
if ($pValue != 0) {
|
||||||
return round($pValue / 9525);
|
return round($pValue / 9525);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert pixels to column width. Exact algorithm not known.
|
* Convert pixels to column width. Exact algorithm not known.
|
||||||
* By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875
|
* By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875
|
||||||
* This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional.
|
* This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional.
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in pixels
|
* @param int $pValue Value in pixels
|
||||||
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||||
* @return int Value in cell dimension
|
* @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
|
// Font name and size
|
||||||
$name = $pDefaultFont->getName();
|
$name = $pDefaultFont->getName();
|
||||||
$size = $pDefaultFont->getSize();
|
$size = $pDefaultFont->getSize();
|
||||||
|
|
||||||
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||||
// Exact width can be determined
|
// Exact width can be determined
|
||||||
$colWidth = $pValue
|
$colWidth = $pValue
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
|
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
||||||
} else {
|
} else {
|
||||||
// We don't have data for this particular font and size, use approximation by
|
// We don't have data for this particular font and size, use approximation by
|
||||||
// extrapolating from Calibri 11
|
// extrapolating from Calibri 11
|
||||||
$colWidth = $pValue * 11
|
$colWidth = $pValue * 11
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
|
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $colWidth;
|
return $colWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert column width from (intrinsic) Excel units to pixels
|
* Convert column width from (intrinsic) Excel units to pixels
|
||||||
*
|
*
|
||||||
* @param float $pValue Value in cell dimension
|
* @param float $pValue Value in cell dimension
|
||||||
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||||
* @return int Value in pixels
|
* @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
|
// Font name and size
|
||||||
$name = $pDefaultFont->getName();
|
$name = $pDefaultFont->getName();
|
||||||
$size = $pDefaultFont->getSize();
|
$size = $pDefaultFont->getSize();
|
||||||
|
|
||||||
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||||
// Exact width can be determined
|
// Exact width can be determined
|
||||||
$colWidth = $pValue
|
$colWidth = $pValue
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
|
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We don't have data for this particular font and size, use approximation by
|
// We don't have data for this particular font and size, use approximation by
|
||||||
// extrapolating from Calibri 11
|
// extrapolating from Calibri 11
|
||||||
$colWidth = $pValue * $size
|
$colWidth = $pValue * $size
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
|
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Round pixels to closest integer
|
// Round pixels to closest integer
|
||||||
$colWidth = (int) round($colWidth);
|
$colWidth = (int) round($colWidth);
|
||||||
|
|
||||||
return $colWidth;
|
return $colWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert pixels to points
|
* Convert pixels to points
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in pixels
|
* @param int $pValue Value in pixels
|
||||||
* @return int Value in points
|
* @return int Value in points
|
||||||
*/
|
*/
|
||||||
public static function pixelsToPoints($pValue = 0) {
|
public static function pixelsToPoints($pValue = 0) {
|
||||||
return $pValue * 0.67777777;
|
return $pValue * 0.67777777;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert points to pixels
|
* Convert points to pixels
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in points
|
* @param int $pValue Value in points
|
||||||
* @return int Value in pixels
|
* @return int Value in pixels
|
||||||
*/
|
*/
|
||||||
public static function pointsToPixels($pValue = 0) {
|
public static function pointsToPixels($pValue = 0) {
|
||||||
if ($pValue != 0) {
|
if ($pValue != 0) {
|
||||||
return (int) ceil($pValue * 1.333333333);
|
return (int) ceil($pValue * 1.333333333);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert degrees to angle
|
* Convert degrees to angle
|
||||||
*
|
*
|
||||||
* @param int $pValue Degrees
|
* @param int $pValue Degrees
|
||||||
* @return int Angle
|
* @return int Angle
|
||||||
*/
|
*/
|
||||||
public static function degreesToAngle($pValue = 0) {
|
public static function degreesToAngle($pValue = 0) {
|
||||||
return (int)round($pValue * 60000);
|
return (int)round($pValue * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert angle to degrees
|
* Convert angle to degrees
|
||||||
*
|
*
|
||||||
* @param int $pValue Angle
|
* @param int $pValue Angle
|
||||||
* @return int Degrees
|
* @return int Degrees
|
||||||
*/
|
*/
|
||||||
public static function angleToDegrees($pValue = 0) {
|
public static function angleToDegrees($pValue = 0) {
|
||||||
if ($pValue != 0) {
|
if ($pValue != 0) {
|
||||||
return round($pValue / 60000);
|
return round($pValue / 60000);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new image from file. By alexander at alexauto dot nl
|
* Create a new image from file. By alexander at alexauto dot nl
|
||||||
*
|
*
|
||||||
* @link http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214
|
* @link http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214
|
||||||
* @param string $filename Path to Windows DIB (BMP) image
|
* @param string $filename Path to Windows DIB (BMP) image
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
public static function imagecreatefrombmp($p_sFile)
|
public static function imagecreatefrombmp($p_sFile)
|
||||||
{
|
{
|
||||||
// Load the image into a string
|
// Load the image into a string
|
||||||
$file = fopen($p_sFile,"rb");
|
$file = fopen($p_sFile,"rb");
|
||||||
$read = fread($file,10);
|
$read = fread($file,10);
|
||||||
@ -267,6 +267,6 @@ class PHPExcel_Shared_Drawing
|
|||||||
|
|
||||||
// Return image-object
|
// Return image-object
|
||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,58 +34,58 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher
|
class PHPExcel_Shared_Escher
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Drawing Group Container
|
* Drawing Group Container
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DggContainer
|
* @var PHPExcel_Shared_Escher_DggContainer
|
||||||
*/
|
*/
|
||||||
private $_dggContainer;
|
private $_dggContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drawing Container
|
* Drawing Container
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DgContainer
|
* @var PHPExcel_Shared_Escher_DgContainer
|
||||||
*/
|
*/
|
||||||
private $_dgContainer;
|
private $_dgContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Drawing Group Container
|
* Get Drawing Group Container
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DgContainer
|
* @return PHPExcel_Shared_Escher_DgContainer
|
||||||
*/
|
*/
|
||||||
public function getDggContainer()
|
public function getDggContainer()
|
||||||
{
|
{
|
||||||
return $this->_dggContainer;
|
return $this->_dggContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Drawing Group Container
|
* Set Drawing Group Container
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DggContainer $dggContainer
|
* @param PHPExcel_Shared_Escher_DggContainer $dggContainer
|
||||||
*/
|
*/
|
||||||
public function setDggContainer($dggContainer)
|
public function setDggContainer($dggContainer)
|
||||||
{
|
{
|
||||||
return $this->_dggContainer = $dggContainer;
|
return $this->_dggContainer = $dggContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Drawing Container
|
* Get Drawing Container
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DgContainer
|
* @return PHPExcel_Shared_Escher_DgContainer
|
||||||
*/
|
*/
|
||||||
public function getDgContainer()
|
public function getDgContainer()
|
||||||
{
|
{
|
||||||
return $this->_dgContainer;
|
return $this->_dgContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Drawing Container
|
* Set Drawing Container
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DgContainer $dgContainer
|
* @param PHPExcel_Shared_Escher_DgContainer $dgContainer
|
||||||
*/
|
*/
|
||||||
public function setDgContainer($dgContainer)
|
public function setDgContainer($dgContainer)
|
||||||
{
|
{
|
||||||
return $this->_dgContainer = $dgContainer;
|
return $this->_dgContainer = $dgContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,50 +34,50 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer
|
class PHPExcel_Shared_Escher_DgContainer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Drawing index, 1-based.
|
* Drawing index, 1-based.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_dgId;
|
private $_dgId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last shape index in this drawing
|
* Last shape index in this drawing
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_lastSpId;
|
private $_lastSpId;
|
||||||
|
|
||||||
private $_spgrContainer = null;
|
private $_spgrContainer = null;
|
||||||
|
|
||||||
public function getDgId()
|
public function getDgId()
|
||||||
{
|
{
|
||||||
return $this->_dgId;
|
return $this->_dgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDgId($value)
|
public function setDgId($value)
|
||||||
{
|
{
|
||||||
$this->_dgId = $value;
|
$this->_dgId = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastSpId()
|
public function getLastSpId()
|
||||||
{
|
{
|
||||||
return $this->_lastSpId;
|
return $this->_lastSpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLastSpId($value)
|
public function setLastSpId($value)
|
||||||
{
|
{
|
||||||
$this->_lastSpId = $value;
|
$this->_lastSpId = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSpgrContainer()
|
public function getSpgrContainer()
|
||||||
{
|
{
|
||||||
return $this->_spgrContainer;
|
return $this->_spgrContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSpgrContainer($spgrContainer)
|
public function setSpgrContainer($spgrContainer)
|
||||||
{
|
{
|
||||||
return $this->_spgrContainer = $spgrContainer;
|
return $this->_spgrContainer = $spgrContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,76 +34,76 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Parent Shape Group Container
|
* Parent Shape Group Container
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||||
*/
|
*/
|
||||||
private $_parent;
|
private $_parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shape Container collection
|
* Shape Container collection
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $_children = array();
|
private $_children = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parent Shape Group Container
|
* Set parent Shape Group Container
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
|
* @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
|
||||||
*/
|
*/
|
||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the parent Shape Group Container if any
|
* Get the parent Shape Group Container if any
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null
|
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null
|
||||||
*/
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a child. This will be either spgrContainer or spContainer
|
* Add a child. This will be either spgrContainer or spContainer
|
||||||
*
|
*
|
||||||
* @param mixed $child
|
* @param mixed $child
|
||||||
*/
|
*/
|
||||||
public function addChild($child)
|
public function addChild($child)
|
||||||
{
|
{
|
||||||
$this->_children[] = $child;
|
$this->_children[] = $child;
|
||||||
$child->setParent($this);
|
$child->setParent($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get collection of Shape Containers
|
* Get collection of Shape Containers
|
||||||
*/
|
*/
|
||||||
public function getChildren()
|
public function getChildren()
|
||||||
{
|
{
|
||||||
return $this->_children;
|
return $this->_children;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively get all spContainers within this spgrContainer
|
* Recursively get all spContainers within this spgrContainer
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[]
|
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[]
|
||||||
*/
|
*/
|
||||||
public function getAllSpContainers()
|
public function getAllSpContainers()
|
||||||
{
|
{
|
||||||
$allSpContainers = array();
|
$allSpContainers = array();
|
||||||
|
|
||||||
foreach ($this->_children as $child) {
|
foreach ($this->_children as $child) {
|
||||||
if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
|
if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
|
||||||
$allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
|
$allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
|
||||||
} else {
|
} else {
|
||||||
$allSpContainers[] = $child;
|
$allSpContainers[] = $child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $allSpContainers;
|
return $allSpContainers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,362 +34,362 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Parent Shape Group Container
|
* Parent Shape Group Container
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||||
*/
|
*/
|
||||||
private $_parent;
|
private $_parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this a group shape?
|
* Is this a group shape?
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_spgr = false;
|
private $_spgr = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shape type
|
* Shape type
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_spType;
|
private $_spType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shape flag
|
* Shape flag
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_spFlag;
|
private $_spFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shape index (usually group shape has index 0, and the rest: 1,2,3...)
|
* Shape index (usually group shape has index 0, and the rest: 1,2,3...)
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_spId;
|
private $_spId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of options
|
* Array of options
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $_OPT;
|
private $_OPT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cell coordinates of upper-left corner of shape, e.g. 'A1'
|
* Cell coordinates of upper-left corner of shape, e.g. 'A1'
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_startCoordinates;
|
private $_startCoordinates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
|
* Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_startOffsetX;
|
private $_startOffsetX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertical offset of upper-left corner of shape measured in 1/256 of row height
|
* Vertical offset of upper-left corner of shape measured in 1/256 of row height
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_startOffsetY;
|
private $_startOffsetY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cell coordinates of bottom-right corner of shape, e.g. 'B2'
|
* Cell coordinates of bottom-right corner of shape, e.g. 'B2'
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_endCoordinates;
|
private $_endCoordinates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
|
* Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_endOffsetX;
|
private $_endOffsetX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertical offset of bottom-right corner of shape measured in 1/256 of row height
|
* Vertical offset of bottom-right corner of shape measured in 1/256 of row height
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_endOffsetY;
|
private $_endOffsetY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parent Shape Group Container
|
* Set parent Shape Group Container
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
|
* @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
|
||||||
*/
|
*/
|
||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the parent Shape Group Container
|
* Get the parent Shape Group Container
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||||
*/
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether this is a group shape
|
* Set whether this is a group shape
|
||||||
*
|
*
|
||||||
* @param boolean $value
|
* @param boolean $value
|
||||||
*/
|
*/
|
||||||
public function setSpgr($value = false)
|
public function setSpgr($value = false)
|
||||||
{
|
{
|
||||||
$this->_spgr = $value;
|
$this->_spgr = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether this is a group shape
|
* Get whether this is a group shape
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getSpgr()
|
public function getSpgr()
|
||||||
{
|
{
|
||||||
return $this->_spgr;
|
return $this->_spgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the shape type
|
* Set the shape type
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
*/
|
*/
|
||||||
public function setSpType($value)
|
public function setSpType($value)
|
||||||
{
|
{
|
||||||
$this->_spType = $value;
|
$this->_spType = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the shape type
|
* Get the shape type
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSpType()
|
public function getSpType()
|
||||||
{
|
{
|
||||||
return $this->_spType;
|
return $this->_spType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the shape flag
|
* Set the shape flag
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
*/
|
*/
|
||||||
public function setSpFlag($value)
|
public function setSpFlag($value)
|
||||||
{
|
{
|
||||||
$this->_spFlag = $value;
|
$this->_spFlag = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the shape flag
|
* Get the shape flag
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSpFlag()
|
public function getSpFlag()
|
||||||
{
|
{
|
||||||
return $this->_spFlag;
|
return $this->_spFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the shape index
|
* Set the shape index
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
*/
|
*/
|
||||||
public function setSpId($value)
|
public function setSpId($value)
|
||||||
{
|
{
|
||||||
$this->_spId = $value;
|
$this->_spId = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the shape index
|
* Get the shape index
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSpId()
|
public function getSpId()
|
||||||
{
|
{
|
||||||
return $this->_spId;
|
return $this->_spId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an option for the Shape Group Container
|
* Set an option for the Shape Group Container
|
||||||
*
|
*
|
||||||
* @param int $property The number specifies the option
|
* @param int $property The number specifies the option
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function setOPT($property, $value)
|
public function setOPT($property, $value)
|
||||||
{
|
{
|
||||||
$this->_OPT[$property] = $value;
|
$this->_OPT[$property] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an option for the Shape Group Container
|
* Get an option for the Shape Group Container
|
||||||
*
|
*
|
||||||
* @param int $property The number specifies the option
|
* @param int $property The number specifies the option
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getOPT($property)
|
public function getOPT($property)
|
||||||
{
|
{
|
||||||
if (isset($this->_OPT[$property])) {
|
if (isset($this->_OPT[$property])) {
|
||||||
return $this->_OPT[$property];
|
return $this->_OPT[$property];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the collection of options
|
* Get the collection of options
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getOPTCollection()
|
public function getOPTCollection()
|
||||||
{
|
{
|
||||||
return $this->_OPT;
|
return $this->_OPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cell coordinates of upper-left corner of shape
|
* Set cell coordinates of upper-left corner of shape
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setStartCoordinates($value = 'A1')
|
public function setStartCoordinates($value = 'A1')
|
||||||
{
|
{
|
||||||
$this->_startCoordinates = $value;
|
$this->_startCoordinates = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get cell coordinates of upper-left corner of shape
|
* Get cell coordinates of upper-left corner of shape
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStartCoordinates()
|
public function getStartCoordinates()
|
||||||
{
|
{
|
||||||
return $this->_startCoordinates;
|
return $this->_startCoordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
|
* Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
|
||||||
*
|
*
|
||||||
* @param int $startOffsetX
|
* @param int $startOffsetX
|
||||||
*/
|
*/
|
||||||
public function setStartOffsetX($startOffsetX = 0)
|
public function setStartOffsetX($startOffsetX = 0)
|
||||||
{
|
{
|
||||||
$this->_startOffsetX = $startOffsetX;
|
$this->_startOffsetX = $startOffsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
|
* Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getStartOffsetX()
|
public function getStartOffsetX()
|
||||||
{
|
{
|
||||||
return $this->_startOffsetX;
|
return $this->_startOffsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height
|
* Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height
|
||||||
*
|
*
|
||||||
* @param int $startOffsetY
|
* @param int $startOffsetY
|
||||||
*/
|
*/
|
||||||
public function setStartOffsetY($startOffsetY = 0)
|
public function setStartOffsetY($startOffsetY = 0)
|
||||||
{
|
{
|
||||||
$this->_startOffsetY = $startOffsetY;
|
$this->_startOffsetY = $startOffsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height
|
* Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getStartOffsetY()
|
public function getStartOffsetY()
|
||||||
{
|
{
|
||||||
return $this->_startOffsetY;
|
return $this->_startOffsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cell coordinates of bottom-right corner of shape
|
* Set cell coordinates of bottom-right corner of shape
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setEndCoordinates($value = 'A1')
|
public function setEndCoordinates($value = 'A1')
|
||||||
{
|
{
|
||||||
$this->_endCoordinates = $value;
|
$this->_endCoordinates = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get cell coordinates of bottom-right corner of shape
|
* Get cell coordinates of bottom-right corner of shape
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEndCoordinates()
|
public function getEndCoordinates()
|
||||||
{
|
{
|
||||||
return $this->_endCoordinates;
|
return $this->_endCoordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
|
* Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
|
||||||
*
|
*
|
||||||
* @param int $startOffsetX
|
* @param int $startOffsetX
|
||||||
*/
|
*/
|
||||||
public function setEndOffsetX($endOffsetX = 0)
|
public function setEndOffsetX($endOffsetX = 0)
|
||||||
{
|
{
|
||||||
$this->_endOffsetX = $endOffsetX;
|
$this->_endOffsetX = $endOffsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
|
* Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getEndOffsetX()
|
public function getEndOffsetX()
|
||||||
{
|
{
|
||||||
return $this->_endOffsetX;
|
return $this->_endOffsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
|
* Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
|
||||||
*
|
*
|
||||||
* @param int $endOffsetY
|
* @param int $endOffsetY
|
||||||
*/
|
*/
|
||||||
public function setEndOffsetY($endOffsetY = 0)
|
public function setEndOffsetY($endOffsetY = 0)
|
||||||
{
|
{
|
||||||
$this->_endOffsetY = $endOffsetY;
|
$this->_endOffsetY = $endOffsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
|
* Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getEndOffsetY()
|
public function getEndOffsetY()
|
||||||
{
|
{
|
||||||
return $this->_endOffsetY;
|
return $this->_endOffsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
|
* Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
|
||||||
* the dgContainer. A value of 1 = immediately within first spgrContainer
|
* the dgContainer. A value of 1 = immediately within first spgrContainer
|
||||||
* Higher nesting level occurs if and only if spContainer is part of a shape group
|
* Higher nesting level occurs if and only if spContainer is part of a shape group
|
||||||
*
|
*
|
||||||
* @return int Nesting level
|
* @return int Nesting level
|
||||||
*/
|
*/
|
||||||
public function getNestingLevel()
|
public function getNestingLevel()
|
||||||
{
|
{
|
||||||
$nestingLevel = 0;
|
$nestingLevel = 0;
|
||||||
|
|
||||||
$parent = $this->getParent();
|
$parent = $this->getParent();
|
||||||
while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
|
while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
|
||||||
++$nestingLevel;
|
++$nestingLevel;
|
||||||
$parent = $parent->getParent();
|
$parent = $parent->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $nestingLevel;
|
return $nestingLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,170 +34,170 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer
|
class PHPExcel_Shared_Escher_DggContainer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Maximum shape index of all shapes in all drawings increased by one
|
* Maximum shape index of all shapes in all drawings increased by one
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_spIdMax;
|
private $_spIdMax;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Total number of drawings saved
|
* Total number of drawings saved
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_cDgSaved;
|
private $_cDgSaved;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Total number of shapes saved (including group shapes)
|
* Total number of shapes saved (including group shapes)
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_cSpSaved;
|
private $_cSpSaved;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BLIP Store Container
|
* BLIP Store Container
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||||
*/
|
*/
|
||||||
private $_bstoreContainer;
|
private $_bstoreContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of options for the drawing group
|
* Array of options for the drawing group
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $_OPT = array();
|
private $_OPT = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of identifier clusters containg information about the maximum shape identifiers
|
* Array of identifier clusters containg information about the maximum shape identifiers
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $_IDCLs = array();
|
private $_IDCLs = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get maximum shape index of all shapes in all drawings (plus one)
|
* Get maximum shape index of all shapes in all drawings (plus one)
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSpIdMax()
|
public function getSpIdMax()
|
||||||
{
|
{
|
||||||
return $this->_spIdMax;
|
return $this->_spIdMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set maximum shape index of all shapes in all drawings (plus one)
|
* Set maximum shape index of all shapes in all drawings (plus one)
|
||||||
*
|
*
|
||||||
* @param int
|
* @param int
|
||||||
*/
|
*/
|
||||||
public function setSpIdMax($value)
|
public function setSpIdMax($value)
|
||||||
{
|
{
|
||||||
$this->_spIdMax = $value;
|
$this->_spIdMax = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get total number of drawings saved
|
* Get total number of drawings saved
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getCDgSaved()
|
public function getCDgSaved()
|
||||||
{
|
{
|
||||||
return $this->_cDgSaved;
|
return $this->_cDgSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set total number of drawings saved
|
* Set total number of drawings saved
|
||||||
*
|
*
|
||||||
* @param int
|
* @param int
|
||||||
*/
|
*/
|
||||||
public function setCDgSaved($value)
|
public function setCDgSaved($value)
|
||||||
{
|
{
|
||||||
$this->_cDgSaved = $value;
|
$this->_cDgSaved = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get total number of shapes saved (including group shapes)
|
* Get total number of shapes saved (including group shapes)
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getCSpSaved()
|
public function getCSpSaved()
|
||||||
{
|
{
|
||||||
return $this->_cSpSaved;
|
return $this->_cSpSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set total number of shapes saved (including group shapes)
|
* Set total number of shapes saved (including group shapes)
|
||||||
*
|
*
|
||||||
* @param int
|
* @param int
|
||||||
*/
|
*/
|
||||||
public function setCSpSaved($value)
|
public function setCSpSaved($value)
|
||||||
{
|
{
|
||||||
$this->_cSpSaved = $value;
|
$this->_cSpSaved = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get BLIP Store Container
|
* Get BLIP Store Container
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||||
*/
|
*/
|
||||||
public function getBstoreContainer()
|
public function getBstoreContainer()
|
||||||
{
|
{
|
||||||
return $this->_bstoreContainer;
|
return $this->_bstoreContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set BLIP Store Container
|
* Set BLIP Store Container
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $bstoreContainer
|
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $bstoreContainer
|
||||||
*/
|
*/
|
||||||
public function setBstoreContainer($bstoreContainer)
|
public function setBstoreContainer($bstoreContainer)
|
||||||
{
|
{
|
||||||
$this->_bstoreContainer = $bstoreContainer;
|
$this->_bstoreContainer = $bstoreContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an option for the drawing group
|
* Set an option for the drawing group
|
||||||
*
|
*
|
||||||
* @param int $property The number specifies the option
|
* @param int $property The number specifies the option
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function setOPT($property, $value)
|
public function setOPT($property, $value)
|
||||||
{
|
{
|
||||||
$this->_OPT[$property] = $value;
|
$this->_OPT[$property] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an option for the drawing group
|
* Get an option for the drawing group
|
||||||
*
|
*
|
||||||
* @param int $property The number specifies the option
|
* @param int $property The number specifies the option
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getOPT($property)
|
public function getOPT($property)
|
||||||
{
|
{
|
||||||
if (isset($this->_OPT[$property])) {
|
if (isset($this->_OPT[$property])) {
|
||||||
return $this->_OPT[$property];
|
return $this->_OPT[$property];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get identifier clusters
|
* Get identifier clusters
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getIDCLs()
|
public function getIDCLs()
|
||||||
{
|
{
|
||||||
return $this->_IDCLs;
|
return $this->_IDCLs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set identifier clusters. array(<drawingId> => <max shape id>, ...)
|
* Set identifier clusters. array(<drawingId> => <max shape id>, ...)
|
||||||
*
|
*
|
||||||
* @param array $pValue
|
* @param array $pValue
|
||||||
*/
|
*/
|
||||||
public function setIDCLs($pValue)
|
public function setIDCLs($pValue)
|
||||||
{
|
{
|
||||||
$this->_IDCLs = $pValue;
|
$this->_IDCLs = $pValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,32 +34,32 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture)
|
* BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture)
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $_BSECollection = array();
|
private $_BSECollection = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a BLIP Store Entry
|
* Add a BLIP Store Entry
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $BSE
|
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $BSE
|
||||||
*/
|
*/
|
||||||
public function addBSE($BSE)
|
public function addBSE($BSE)
|
||||||
{
|
{
|
||||||
$this->_BSECollection[] = $BSE;
|
$this->_BSECollection[] = $BSE;
|
||||||
$BSE->setParent($this);
|
$BSE->setParent($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the collection of BLIP Store Entries
|
* Get the collection of BLIP Store Entries
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[]
|
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[]
|
||||||
*/
|
*/
|
||||||
public function getBSECollection()
|
public function getBSECollection()
|
||||||
{
|
{
|
||||||
return $this->_BSECollection;
|
return $this->_BSECollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,87 +34,87 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||||
{
|
{
|
||||||
const BLIPTYPE_ERROR = 0x00;
|
const BLIPTYPE_ERROR = 0x00;
|
||||||
const BLIPTYPE_UNKNOWN = 0x01;
|
const BLIPTYPE_UNKNOWN = 0x01;
|
||||||
const BLIPTYPE_EMF = 0x02;
|
const BLIPTYPE_EMF = 0x02;
|
||||||
const BLIPTYPE_WMF = 0x03;
|
const BLIPTYPE_WMF = 0x03;
|
||||||
const BLIPTYPE_PICT = 0x04;
|
const BLIPTYPE_PICT = 0x04;
|
||||||
const BLIPTYPE_JPEG = 0x05;
|
const BLIPTYPE_JPEG = 0x05;
|
||||||
const BLIPTYPE_PNG = 0x06;
|
const BLIPTYPE_PNG = 0x06;
|
||||||
const BLIPTYPE_DIB = 0x07;
|
const BLIPTYPE_DIB = 0x07;
|
||||||
const BLIPTYPE_TIFF = 0x11;
|
const BLIPTYPE_TIFF = 0x11;
|
||||||
const BLIPTYPE_CMYKJPEG = 0x12;
|
const BLIPTYPE_CMYKJPEG = 0x12;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent BLIP Store Entry Container
|
* The parent BLIP Store Entry Container
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||||
*/
|
*/
|
||||||
private $_parent;
|
private $_parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The BLIP (Big Large Image or Picture)
|
* The BLIP (Big Large Image or Picture)
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||||
*/
|
*/
|
||||||
private $_blip;
|
private $_blip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The BLIP type
|
* The BLIP type
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_blipType;
|
private $_blipType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parent BLIP Store Entry Container
|
* Set parent BLIP Store Entry Container
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $parent
|
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $parent
|
||||||
*/
|
*/
|
||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the BLIP
|
* Get the BLIP
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||||
*/
|
*/
|
||||||
public function getBlip()
|
public function getBlip()
|
||||||
{
|
{
|
||||||
return $this->_blip;
|
return $this->_blip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the BLIP
|
* Set the BLIP
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip
|
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip
|
||||||
*/
|
*/
|
||||||
public function setBlip($blip)
|
public function setBlip($blip)
|
||||||
{
|
{
|
||||||
$this->_blip = $blip;
|
$this->_blip = $blip;
|
||||||
$blip->setParent($this);
|
$blip->setParent($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the BLIP type
|
* Get the BLIP type
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getBlipType()
|
public function getBlipType()
|
||||||
{
|
{
|
||||||
return $this->_blipType;
|
return $this->_blipType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the BLIP type
|
* Set the BLIP type
|
||||||
*
|
*
|
||||||
* @param int
|
* @param int
|
||||||
*/
|
*/
|
||||||
public function setBlipType($blipType)
|
public function setBlipType($blipType)
|
||||||
{
|
{
|
||||||
$this->_blipType = $blipType;
|
$this->_blipType = $blipType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,58 +34,58 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The parent BSE
|
* The parent BSE
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||||
*/
|
*/
|
||||||
private $_parent;
|
private $_parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raw image data
|
* Raw image data
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_data;
|
private $_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the raw image data
|
* Get the raw image data
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData()
|
||||||
{
|
{
|
||||||
return $this->_data;
|
return $this->_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the raw image data
|
* Set the raw image data
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
public function setData($data)
|
public function setData($data)
|
||||||
{
|
{
|
||||||
$this->_data = $data;
|
$this->_data = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parent BSE
|
* Set parent BSE
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
|
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
|
||||||
*/
|
*/
|
||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get parent BSE
|
* Get parent BSE
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
|
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
|
||||||
*/
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,284 +34,284 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Excel5
|
class PHPExcel_Shared_Excel5
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the width of a column in pixels. We use the relationship y = ceil(7x) where
|
* Get the width of a column in pixels. We use the relationship y = ceil(7x) where
|
||||||
* x is the width in intrinsic Excel units (measuring width in number of normal characters)
|
* x is the width in intrinsic Excel units (measuring width in number of normal characters)
|
||||||
* This holds for Arial 10
|
* This holds for Arial 10
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet The sheet
|
* @param PHPExcel_Worksheet $sheet The sheet
|
||||||
* @param string $col The column
|
* @param string $col The column
|
||||||
* @return integer The width in pixels
|
* @return integer The width in pixels
|
||||||
*/
|
*/
|
||||||
public static function sizeCol($sheet, $col = 'A')
|
public static function sizeCol($sheet, $col = 'A')
|
||||||
{
|
{
|
||||||
// default font of the workbook
|
// default font of the workbook
|
||||||
$font = $sheet->getParent()->getDefaultStyle()->getFont();
|
$font = $sheet->getParent()->getDefaultStyle()->getFont();
|
||||||
|
|
||||||
$columnDimensions = $sheet->getColumnDimensions();
|
$columnDimensions = $sheet->getColumnDimensions();
|
||||||
|
|
||||||
// first find the true column width in pixels (uncollapsed and unhidden)
|
// first find the true column width in pixels (uncollapsed and unhidden)
|
||||||
if ( isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1 ) {
|
if ( isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1 ) {
|
||||||
|
|
||||||
// then we have column dimension with explicit width
|
// then we have column dimension with explicit width
|
||||||
$columnDimension = $columnDimensions[$col];
|
$columnDimension = $columnDimensions[$col];
|
||||||
$width = $columnDimension->getWidth();
|
$width = $columnDimension->getWidth();
|
||||||
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
|
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
|
||||||
|
|
||||||
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
|
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
|
||||||
|
|
||||||
// then we have default column dimension with explicit width
|
// then we have default column dimension with explicit width
|
||||||
$defaultColumnDimension = $sheet->getDefaultColumnDimension();
|
$defaultColumnDimension = $sheet->getDefaultColumnDimension();
|
||||||
$width = $defaultColumnDimension->getWidth();
|
$width = $defaultColumnDimension->getWidth();
|
||||||
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
|
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// we don't even have any default column dimension. Width depends on default font
|
// we don't even have any default column dimension. Width depends on default font
|
||||||
$pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true);
|
$pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now find the effective column width in pixels
|
// now find the effective column width in pixels
|
||||||
if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) {
|
if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) {
|
||||||
$effectivePixelWidth = 0;
|
$effectivePixelWidth = 0;
|
||||||
} else {
|
} else {
|
||||||
$effectivePixelWidth = $pixelWidth;
|
$effectivePixelWidth = $pixelWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $effectivePixelWidth;
|
return $effectivePixelWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the height of a cell from user's units to pixels. By interpolation
|
* Convert the height of a cell from user's units to pixels. By interpolation
|
||||||
* the relationship is: y = 4/3x. If the height hasn't been set by the user we
|
* the relationship is: y = 4/3x. If the height hasn't been set by the user we
|
||||||
* use the default value. If the row is hidden we use a value of zero.
|
* use the default value. If the row is hidden we use a value of zero.
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet The sheet
|
* @param PHPExcel_Worksheet $sheet The sheet
|
||||||
* @param integer $row The row index (1-based)
|
* @param integer $row The row index (1-based)
|
||||||
* @return integer The width in pixels
|
* @return integer The width in pixels
|
||||||
*/
|
*/
|
||||||
public static function sizeRow($sheet, $row = 1)
|
public static function sizeRow($sheet, $row = 1)
|
||||||
{
|
{
|
||||||
// default font of the workbook
|
// default font of the workbook
|
||||||
$font = $sheet->getParent()->getDefaultStyle()->getFont();
|
$font = $sheet->getParent()->getDefaultStyle()->getFont();
|
||||||
|
|
||||||
$rowDimensions = $sheet->getRowDimensions();
|
$rowDimensions = $sheet->getRowDimensions();
|
||||||
|
|
||||||
// first find the true row height in pixels (uncollapsed and unhidden)
|
// first find the true row height in pixels (uncollapsed and unhidden)
|
||||||
if ( isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) {
|
if ( isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) {
|
||||||
|
|
||||||
// then we have a row dimension
|
// then we have a row dimension
|
||||||
$rowDimension = $rowDimensions[$row];
|
$rowDimension = $rowDimensions[$row];
|
||||||
$rowHeight = $rowDimension->getRowHeight();
|
$rowHeight = $rowDimension->getRowHeight();
|
||||||
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10
|
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10
|
||||||
|
|
||||||
} else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
|
} else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
|
||||||
|
|
||||||
// then we have a default row dimension with explicit height
|
// then we have a default row dimension with explicit height
|
||||||
$defaultRowDimension = $sheet->getDefaultRowDimension();
|
$defaultRowDimension = $sheet->getDefaultRowDimension();
|
||||||
$rowHeight = $defaultRowDimension->getRowHeight();
|
$rowHeight = $defaultRowDimension->getRowHeight();
|
||||||
$pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
|
$pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// we don't even have any default row dimension. Height depends on default font
|
// we don't even have any default row dimension. Height depends on default font
|
||||||
$pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
|
$pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
|
||||||
$pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
|
$pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now find the effective row height in pixels
|
// now find the effective row height in pixels
|
||||||
if ( isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible() ) {
|
if ( isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible() ) {
|
||||||
$effectivePixelRowHeight = 0;
|
$effectivePixelRowHeight = 0;
|
||||||
} else {
|
} else {
|
||||||
$effectivePixelRowHeight = $pixelRowHeight;
|
$effectivePixelRowHeight = $pixelRowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $effectivePixelRowHeight;
|
return $effectivePixelRowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the horizontal distance in pixels between two anchors
|
* Get the horizontal distance in pixels between two anchors
|
||||||
* The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets
|
* The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet
|
* @param PHPExcel_Worksheet $sheet
|
||||||
* @param string $startColumn
|
* @param string $startColumn
|
||||||
* @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width
|
* @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width
|
||||||
* @param string $endColumn
|
* @param string $endColumn
|
||||||
* @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width
|
* @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width
|
||||||
* @return integer Horizontal measured in pixels
|
* @return integer Horizontal measured in pixels
|
||||||
*/
|
*/
|
||||||
public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0)
|
public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0)
|
||||||
{
|
{
|
||||||
$distanceX = 0;
|
$distanceX = 0;
|
||||||
|
|
||||||
// add the widths of the spanning columns
|
// add the widths of the spanning columns
|
||||||
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // 1-based
|
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // 1-based
|
||||||
$endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; // 1-based
|
$endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; // 1-based
|
||||||
for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) {
|
for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) {
|
||||||
$distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i));
|
$distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct for offsetX in startcell
|
// correct for offsetX in startcell
|
||||||
$distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024);
|
$distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024);
|
||||||
|
|
||||||
// correct for offsetX in endcell
|
// correct for offsetX in endcell
|
||||||
$distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024));
|
$distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024));
|
||||||
|
|
||||||
return $distanceX;
|
return $distanceX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the vertical distance in pixels between two anchors
|
* Get the vertical distance in pixels between two anchors
|
||||||
* The distanceY is found as sum of all the spanning rows minus two offsets
|
* The distanceY is found as sum of all the spanning rows minus two offsets
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet
|
* @param PHPExcel_Worksheet $sheet
|
||||||
* @param integer $startRow (1-based)
|
* @param integer $startRow (1-based)
|
||||||
* @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height
|
* @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height
|
||||||
* @param integer $endRow (1-based)
|
* @param integer $endRow (1-based)
|
||||||
* @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height
|
* @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height
|
||||||
* @return integer Vertical distance measured in pixels
|
* @return integer Vertical distance measured in pixels
|
||||||
*/
|
*/
|
||||||
public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
|
public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
|
||||||
{
|
{
|
||||||
$distanceY = 0;
|
$distanceY = 0;
|
||||||
|
|
||||||
// add the widths of the spanning rows
|
// add the widths of the spanning rows
|
||||||
for ($row = $startRow; $row <= $endRow; ++$row) {
|
for ($row = $startRow; $row <= $endRow; ++$row) {
|
||||||
$distanceY += self::sizeRow($sheet, $row);
|
$distanceY += self::sizeRow($sheet, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct for offsetX in startcell
|
// correct for offsetX in startcell
|
||||||
$distanceY -= (int) floor(self::sizeRow($sheet, $startRow) * $startOffsetY / 256);
|
$distanceY -= (int) floor(self::sizeRow($sheet, $startRow) * $startOffsetY / 256);
|
||||||
|
|
||||||
// correct for offsetX in endcell
|
// correct for offsetX in endcell
|
||||||
$distanceY -= (int) floor(self::sizeRow($sheet, $endRow) * (1 - $endOffsetY / 256));
|
$distanceY -= (int) floor(self::sizeRow($sheet, $endRow) * (1 - $endOffsetY / 256));
|
||||||
|
|
||||||
return $distanceY;
|
return $distanceY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert 1-cell anchor coordinates to 2-cell anchor coordinates
|
* Convert 1-cell anchor coordinates to 2-cell anchor coordinates
|
||||||
* This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications
|
* This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications
|
||||||
*
|
*
|
||||||
* Calculate the vertices that define the position of the image as required by
|
* Calculate the vertices that define the position of the image as required by
|
||||||
* the OBJ record.
|
* the OBJ record.
|
||||||
*
|
*
|
||||||
* +------------+------------+
|
* +------------+------------+
|
||||||
* | A | B |
|
* | A | B |
|
||||||
* +-----+------------+------------+
|
* +-----+------------+------------+
|
||||||
* | |(x1,y1) | |
|
* | |(x1,y1) | |
|
||||||
* | 1 |(A1)._______|______ |
|
* | 1 |(A1)._______|______ |
|
||||||
* | | | | |
|
* | | | | |
|
||||||
* | | | | |
|
* | | | | |
|
||||||
* +-----+----| BITMAP |-----+
|
* +-----+----| BITMAP |-----+
|
||||||
* | | | | |
|
* | | | | |
|
||||||
* | 2 | |______________. |
|
* | 2 | |______________. |
|
||||||
* | | | (B2)|
|
* | | | (B2)|
|
||||||
* | | | (x2,y2)|
|
* | | | (x2,y2)|
|
||||||
* +---- +------------+------------+
|
* +---- +------------+------------+
|
||||||
*
|
*
|
||||||
* Example of a bitmap that covers some of the area from cell A1 to cell B2.
|
* Example of a bitmap that covers some of the area from cell A1 to cell B2.
|
||||||
*
|
*
|
||||||
* Based on the width and height of the bitmap we need to calculate 8 vars:
|
* Based on the width and height of the bitmap we need to calculate 8 vars:
|
||||||
* $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
|
* $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
|
||||||
* The width and height of the cells are also variable and have to be taken into
|
* The width and height of the cells are also variable and have to be taken into
|
||||||
* account.
|
* account.
|
||||||
* The values of $col_start and $row_start are passed in from the calling
|
* The values of $col_start and $row_start are passed in from the calling
|
||||||
* function. The values of $col_end and $row_end are calculated by subtracting
|
* function. The values of $col_end and $row_end are calculated by subtracting
|
||||||
* the width and height of the bitmap from the width and height of the
|
* the width and height of the bitmap from the width and height of the
|
||||||
* underlying cells.
|
* underlying cells.
|
||||||
* The vertices are expressed as a percentage of the underlying cell width as
|
* The vertices are expressed as a percentage of the underlying cell width as
|
||||||
* follows (rhs values are in pixels):
|
* follows (rhs values are in pixels):
|
||||||
*
|
*
|
||||||
* x1 = X / W *1024
|
* x1 = X / W *1024
|
||||||
* y1 = Y / H *256
|
* y1 = Y / H *256
|
||||||
* x2 = (X-1) / W *1024
|
* x2 = (X-1) / W *1024
|
||||||
* y2 = (Y-1) / H *256
|
* y2 = (Y-1) / H *256
|
||||||
*
|
*
|
||||||
* Where: X is distance from the left side of the underlying cell
|
* Where: X is distance from the left side of the underlying cell
|
||||||
* Y is distance from the top of the underlying cell
|
* Y is distance from the top of the underlying cell
|
||||||
* W is the width of the cell
|
* W is the width of the cell
|
||||||
* H is the height of the cell
|
* H is the height of the cell
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet
|
* @param PHPExcel_Worksheet $sheet
|
||||||
* @param string $coordinates E.g. 'A1'
|
* @param string $coordinates E.g. 'A1'
|
||||||
* @param integer $offsetX Horizontal offset in pixels
|
* @param integer $offsetX Horizontal offset in pixels
|
||||||
* @param integer $offsetY Vertical offset in pixels
|
* @param integer $offsetY Vertical offset in pixels
|
||||||
* @param integer $width Width in pixels
|
* @param integer $width Width in pixels
|
||||||
* @param integer $height Height in pixels
|
* @param integer $height Height in pixels
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height)
|
public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height)
|
||||||
{
|
{
|
||||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinates);
|
list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinates);
|
||||||
$col_start = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
$col_start = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||||
$row_start = $row - 1;
|
$row_start = $row - 1;
|
||||||
|
|
||||||
$x1 = $offsetX;
|
$x1 = $offsetX;
|
||||||
$y1 = $offsetY;
|
$y1 = $offsetY;
|
||||||
|
|
||||||
// Initialise end cell to the same as the start cell
|
// Initialise end cell to the same as the start cell
|
||||||
$col_end = $col_start; // Col containing lower right corner of object
|
$col_end = $col_start; // Col containing lower right corner of object
|
||||||
$row_end = $row_start; // Row containing bottom right corner of object
|
$row_end = $row_start; // Row containing bottom right corner of object
|
||||||
|
|
||||||
// Zero the specified offset if greater than the cell dimensions
|
// Zero the specified offset if greater than the cell dimensions
|
||||||
if ($x1 >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) {
|
if ($x1 >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) {
|
||||||
$x1 = 0;
|
$x1 = 0;
|
||||||
}
|
}
|
||||||
if ($y1 >= self::sizeRow($sheet, $row_start + 1)) {
|
if ($y1 >= self::sizeRow($sheet, $row_start + 1)) {
|
||||||
$y1 = 0;
|
$y1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $width + $x1 -1;
|
$width = $width + $x1 -1;
|
||||||
$height = $height + $y1 -1;
|
$height = $height + $y1 -1;
|
||||||
|
|
||||||
// Subtract the underlying cell widths to find the end cell of the image
|
// Subtract the underlying cell widths to find the end cell of the image
|
||||||
while ($width >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) {
|
while ($width >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) {
|
||||||
$width -= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end));
|
$width -= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end));
|
||||||
++$col_end;
|
++$col_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subtract the underlying cell heights to find the end cell of the image
|
// Subtract the underlying cell heights to find the end cell of the image
|
||||||
while ($height >= self::sizeRow($sheet, $row_end + 1)) {
|
while ($height >= self::sizeRow($sheet, $row_end + 1)) {
|
||||||
$height -= self::sizeRow($sheet, $row_end + 1);
|
$height -= self::sizeRow($sheet, $row_end + 1);
|
||||||
++$row_end;
|
++$row_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
|
// Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
|
||||||
// with zero height or width.
|
// with zero height or width.
|
||||||
if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) {
|
if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) {
|
if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self::sizeRow($sheet, $row_start + 1) == 0) {
|
if (self::sizeRow($sheet, $row_start + 1) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self::sizeRow($sheet, $row_end + 1) == 0) {
|
if (self::sizeRow($sheet, $row_end + 1) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert the pixel values to the percentage value expected by Excel
|
// Convert the pixel values to the percentage value expected by Excel
|
||||||
$x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
|
$x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
|
||||||
$y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256;
|
$y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256;
|
||||||
$x2 = ($width + 1) / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
|
$x2 = ($width + 1) / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
|
||||||
$y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object
|
$y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object
|
||||||
|
|
||||||
$startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1);
|
$startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1);
|
||||||
$endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1);
|
$endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1);
|
||||||
|
|
||||||
$twoAnchor = array(
|
$twoAnchor = array(
|
||||||
'startCoordinates' => $startCoordinates,
|
'startCoordinates' => $startCoordinates,
|
||||||
'startOffsetX' => $x1,
|
'startOffsetX' => $x1,
|
||||||
'startOffsetY' => $y1,
|
'startOffsetY' => $y1,
|
||||||
'endCoordinates' => $endCoordinates,
|
'endCoordinates' => $endCoordinates,
|
||||||
'endOffsetX' => $x2,
|
'endOffsetX' => $x2,
|
||||||
'endOffsetY' => $y2,
|
'endOffsetY' => $y2,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $twoAnchor;
|
return $twoAnchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,144 +35,144 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_File
|
class PHPExcel_Shared_File
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Use Temp or File Upload Temp for temporary files
|
* Use Temp or File Upload Temp for temporary files
|
||||||
*
|
*
|
||||||
* @protected
|
* @protected
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected static $_useUploadTempDirectory = FALSE;
|
protected static $_useUploadTempDirectory = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the flag indicating whether the File Upload Temp directory should be used for temporary files
|
* Set the flag indicating whether the File Upload Temp directory should be used for temporary files
|
||||||
*
|
*
|
||||||
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
|
* @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;
|
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
|
||||||
} // function setUseUploadTempDirectory()
|
} // function setUseUploadTempDirectory()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flag indicating whether the File Upload Temp directory should be used for temporary files
|
* Get the flag indicating whether the File Upload Temp directory should be used for temporary files
|
||||||
*
|
*
|
||||||
* @return boolean Use File Upload Temporary directory (true or false)
|
* @return boolean Use File Upload Temporary directory (true or false)
|
||||||
*/
|
*/
|
||||||
public static function getUseUploadTempDirectory() {
|
public static function getUseUploadTempDirectory() {
|
||||||
return self::$_useUploadTempDirectory;
|
return self::$_useUploadTempDirectory;
|
||||||
} // function getUseUploadTempDirectory()
|
} // function getUseUploadTempDirectory()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if a file exists
|
* Verify if a file exists
|
||||||
*
|
*
|
||||||
* @param string $pFilename Filename
|
* @param string $pFilename Filename
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function file_exists($pFilename) {
|
public static function file_exists($pFilename) {
|
||||||
// Sick construction, but it seems that
|
// Sick construction, but it seems that
|
||||||
// file_exists returns strange values when
|
// file_exists returns strange values when
|
||||||
// doing the original file_exists on ZIP archives...
|
// 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
|
// Open ZIP file and verify if the file exists
|
||||||
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
|
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
|
||||||
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
|
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
if ($zip->open($zipFile) === true) {
|
if ($zip->open($zipFile) === true) {
|
||||||
$returnValue = ($zip->getFromName($archiveFile) !== false);
|
$returnValue = ($zip->getFromName($archiveFile) !== false);
|
||||||
$zip->close();
|
$zip->close();
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Regular file_exists
|
// Regular file_exists
|
||||||
return file_exists($pFilename);
|
return file_exists($pFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns canonicalized absolute pathname, also for ZIP archives
|
* Returns canonicalized absolute pathname, also for ZIP archives
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function realpath($pFilename) {
|
public static function realpath($pFilename) {
|
||||||
// Returnvalue
|
// Returnvalue
|
||||||
$returnValue = '';
|
$returnValue = '';
|
||||||
|
|
||||||
// Try using realpath()
|
// Try using realpath()
|
||||||
if (file_exists($pFilename)) {
|
if (file_exists($pFilename)) {
|
||||||
$returnValue = realpath($pFilename);
|
$returnValue = realpath($pFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Found something?
|
// Found something?
|
||||||
if ($returnValue == '' || ($returnValue === NULL)) {
|
if ($returnValue == '' || ($returnValue === NULL)) {
|
||||||
$pathArray = explode('/' , $pFilename);
|
$pathArray = explode('/' , $pFilename);
|
||||||
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
|
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||||
for ($i = 0; $i < count($pathArray); ++$i) {
|
for ($i = 0; $i < count($pathArray); ++$i) {
|
||||||
if ($pathArray[$i] == '..' && $i > 0) {
|
if ($pathArray[$i] == '..' && $i > 0) {
|
||||||
unset($pathArray[$i]);
|
unset($pathArray[$i]);
|
||||||
unset($pathArray[$i - 1]);
|
unset($pathArray[$i - 1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$returnValue = implode('/', $pathArray);
|
$returnValue = implode('/', $pathArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the systems temporary directory.
|
* Get the systems temporary directory.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function sys_get_temp_dir()
|
public static function sys_get_temp_dir()
|
||||||
{
|
{
|
||||||
if (self::$_useUploadTempDirectory) {
|
if (self::$_useUploadTempDirectory) {
|
||||||
// use upload-directory when defined to allow running on environments having very restricted
|
// use upload-directory when defined to allow running on environments having very restricted
|
||||||
// open_basedir configs
|
// 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 ($temp = ini_get('upload_tmp_dir')) {
|
||||||
if (file_exists($temp))
|
if (file_exists($temp))
|
||||||
return realpath($temp);
|
return realpath($temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sys_get_temp_dir is only available since PHP 5.2.1
|
// sys_get_temp_dir is only available since PHP 5.2.1
|
||||||
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||||
if ( !function_exists('sys_get_temp_dir')) {
|
if ( !function_exists('sys_get_temp_dir')) {
|
||||||
if ($temp = getenv('TMP') ) {
|
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 ($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 ($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
|
// trick for creating a file in system's temporary dir
|
||||||
// without knowing the path of the system's temporary dir
|
// without knowing the path of the system's temporary dir
|
||||||
$temp = tempnam(__FILE__, '');
|
$temp = tempnam(__FILE__, '');
|
||||||
if (file_exists($temp)) {
|
if (file_exists($temp)) {
|
||||||
unlink($temp);
|
unlink($temp);
|
||||||
return realpath(dirname($temp));
|
return realpath(dirname($temp));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use ordinary built-in PHP function
|
// use ordinary built-in PHP function
|
||||||
// There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only
|
// There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only
|
||||||
// be called if we're running 5.2.1 or earlier
|
// be called if we're running 5.2.1 or earlier
|
||||||
return realpath(sys_get_temp_dir());
|
return realpath(sys_get_temp_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,149 +1,149 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package JAMA
|
* @package JAMA
|
||||||
*
|
*
|
||||||
* Cholesky decomposition class
|
* Cholesky decomposition class
|
||||||
*
|
*
|
||||||
* For a symmetric, positive definite matrix A, the Cholesky decomposition
|
* For a symmetric, positive definite matrix A, the Cholesky decomposition
|
||||||
* is an lower triangular matrix L so that A = L*L'.
|
* is an lower triangular matrix L so that A = L*L'.
|
||||||
*
|
*
|
||||||
* If the matrix is not symmetric or positive definite, the constructor
|
* If the matrix is not symmetric or positive definite, the constructor
|
||||||
* returns a partial decomposition and sets an internal flag that may
|
* returns a partial decomposition and sets an internal flag that may
|
||||||
* be queried by the isSPD() method.
|
* be queried by the isSPD() method.
|
||||||
*
|
*
|
||||||
* @author Paul Meagher
|
* @author Paul Meagher
|
||||||
* @author Michael Bommarito
|
* @author Michael Bommarito
|
||||||
* @version 1.2
|
* @version 1.2
|
||||||
*/
|
*/
|
||||||
class CholeskyDecomposition {
|
class CholeskyDecomposition {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decomposition storage
|
* Decomposition storage
|
||||||
* @var array
|
* @var array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private $L = array();
|
private $L = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Matrix row and column dimension
|
* Matrix row and column dimension
|
||||||
* @var int
|
* @var int
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private $m;
|
private $m;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Symmetric positive definite flag
|
* Symmetric positive definite flag
|
||||||
* @var boolean
|
* @var boolean
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private $isspd = true;
|
private $isspd = true;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CholeskyDecomposition
|
* CholeskyDecomposition
|
||||||
*
|
*
|
||||||
* Class constructor - decomposes symmetric positive definite matrix
|
* Class constructor - decomposes symmetric positive definite matrix
|
||||||
* @param mixed Matrix square symmetric positive definite matrix
|
* @param mixed Matrix square symmetric positive definite matrix
|
||||||
*/
|
*/
|
||||||
public function __construct($A = null) {
|
public function __construct($A = null) {
|
||||||
if ($A instanceof Matrix) {
|
if ($A instanceof Matrix) {
|
||||||
$this->L = $A->getArray();
|
$this->L = $A->getArray();
|
||||||
$this->m = $A->getRowDimension();
|
$this->m = $A->getRowDimension();
|
||||||
|
|
||||||
for($i = 0; $i < $this->m; ++$i) {
|
for($i = 0; $i < $this->m; ++$i) {
|
||||||
for($j = $i; $j < $this->m; ++$j) {
|
for($j = $i; $j < $this->m; ++$j) {
|
||||||
for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
|
for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
|
||||||
$sum -= $this->L[$i][$k] * $this->L[$j][$k];
|
$sum -= $this->L[$i][$k] * $this->L[$j][$k];
|
||||||
}
|
}
|
||||||
if ($i == $j) {
|
if ($i == $j) {
|
||||||
if ($sum >= 0) {
|
if ($sum >= 0) {
|
||||||
$this->L[$i][$i] = sqrt($sum);
|
$this->L[$i][$i] = sqrt($sum);
|
||||||
} else {
|
} else {
|
||||||
$this->isspd = false;
|
$this->isspd = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->L[$i][$i] != 0) {
|
if ($this->L[$i][$i] != 0) {
|
||||||
$this->L[$j][$i] = $sum / $this->L[$i][$i];
|
$this->L[$j][$i] = $sum / $this->L[$i][$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($k = $i+1; $k < $this->m; ++$k) {
|
for ($k = $i+1; $k < $this->m; ++$k) {
|
||||||
$this->L[$i][$k] = 0.0;
|
$this->L[$i][$k] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the matrix symmetric and positive definite?
|
* Is the matrix symmetric and positive definite?
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isSPD() {
|
public function isSPD() {
|
||||||
return $this->isspd;
|
return $this->isspd;
|
||||||
} // function isSPD()
|
} // function isSPD()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getL
|
* getL
|
||||||
*
|
*
|
||||||
* Return triangular factor.
|
* Return triangular factor.
|
||||||
* @return Matrix Lower triangular matrix
|
* @return Matrix Lower triangular matrix
|
||||||
*/
|
*/
|
||||||
public function getL() {
|
public function getL() {
|
||||||
return new Matrix($this->L);
|
return new Matrix($this->L);
|
||||||
} // function getL()
|
} // function getL()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Solve A*X = B
|
* Solve A*X = B
|
||||||
*
|
*
|
||||||
* @param $B Row-equal matrix
|
* @param $B Row-equal matrix
|
||||||
* @return Matrix L * L' * X = B
|
* @return Matrix L * L' * X = B
|
||||||
*/
|
*/
|
||||||
public function solve($B = null) {
|
public function solve($B = null) {
|
||||||
if ($B instanceof Matrix) {
|
if ($B instanceof Matrix) {
|
||||||
if ($B->getRowDimension() == $this->m) {
|
if ($B->getRowDimension() == $this->m) {
|
||||||
if ($this->isspd) {
|
if ($this->isspd) {
|
||||||
$X = $B->getArrayCopy();
|
$X = $B->getArrayCopy();
|
||||||
$nx = $B->getColumnDimension();
|
$nx = $B->getColumnDimension();
|
||||||
|
|
||||||
for ($k = 0; $k < $this->m; ++$k) {
|
for ($k = 0; $k < $this->m; ++$k) {
|
||||||
for ($i = $k + 1; $i < $this->m; ++$i) {
|
for ($i = $k + 1; $i < $this->m; ++$i) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X[$i][$j] -= $X[$k][$j] * $this->L[$i][$k];
|
$X[$i][$j] -= $X[$k][$j] * $this->L[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X[$k][$j] /= $this->L[$k][$k];
|
$X[$k][$j] /= $this->L[$k][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($k = $this->m - 1; $k >= 0; --$k) {
|
for ($k = $this->m - 1; $k >= 0; --$k) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X[$k][$j] /= $this->L[$k][$k];
|
$X[$k][$j] /= $this->L[$k][$k];
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < $k; ++$i) {
|
for ($i = 0; $i < $k; ++$i) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X[$i][$j] -= $X[$k][$j] * $this->L[$k][$i];
|
$X[$i][$j] -= $X[$k][$j] * $this->L[$k][$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Matrix($X, $this->m, $nx);
|
return new Matrix($X, $this->m, $nx);
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionException));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||||
}
|
}
|
||||||
} // function solve()
|
} // function solve()
|
||||||
|
|
||||||
} // class CholeskyDecomposition
|
} // class CholeskyDecomposition
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,258 +1,258 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package JAMA
|
* @package JAMA
|
||||||
*
|
*
|
||||||
* For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
|
* For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
|
||||||
* unit lower triangular matrix L, an n-by-n upper triangular matrix U,
|
* unit lower triangular matrix L, an n-by-n upper triangular matrix U,
|
||||||
* and a permutation vector piv of length m so that A(piv,:) = L*U.
|
* and a permutation vector piv of length m so that A(piv,:) = L*U.
|
||||||
* If m < n, then L is m-by-m and U is m-by-n.
|
* If m < n, then L is m-by-m and U is m-by-n.
|
||||||
*
|
*
|
||||||
* The LU decompostion with pivoting always exists, even if the matrix is
|
* The LU decompostion with pivoting always exists, even if the matrix is
|
||||||
* singular, so the constructor will never fail. The primary use of the
|
* singular, so the constructor will never fail. The primary use of the
|
||||||
* LU decomposition is in the solution of square systems of simultaneous
|
* LU decomposition is in the solution of square systems of simultaneous
|
||||||
* linear equations. This will fail if isNonsingular() returns false.
|
* linear equations. This will fail if isNonsingular() returns false.
|
||||||
*
|
*
|
||||||
* @author Paul Meagher
|
* @author Paul Meagher
|
||||||
* @author Bartosz Matosiuk
|
* @author Bartosz Matosiuk
|
||||||
* @author Michael Bommarito
|
* @author Michael Bommarito
|
||||||
* @version 1.1
|
* @version 1.1
|
||||||
* @license PHP v3.0
|
* @license PHP v3.0
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_JAMA_LUDecomposition {
|
class PHPExcel_Shared_JAMA_LUDecomposition {
|
||||||
|
|
||||||
const MatrixSingularException = "Can only perform operation on singular matrix.";
|
const MatrixSingularException = "Can only perform operation on singular matrix.";
|
||||||
const MatrixSquareException = "Mismatched Row dimension";
|
const MatrixSquareException = "Mismatched Row dimension";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decomposition storage
|
* Decomposition storage
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $LU = array();
|
private $LU = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Row dimension.
|
* Row dimension.
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $m;
|
private $m;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Column dimension.
|
* Column dimension.
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $n;
|
private $n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pivot sign.
|
* Pivot sign.
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $pivsign;
|
private $pivsign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal storage of pivot vector.
|
* Internal storage of pivot vector.
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $piv = array();
|
private $piv = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LU Decomposition constructor.
|
* LU Decomposition constructor.
|
||||||
*
|
*
|
||||||
* @param $A Rectangular matrix
|
* @param $A Rectangular matrix
|
||||||
* @return Structure to access L, U and piv.
|
* @return Structure to access L, U and piv.
|
||||||
*/
|
*/
|
||||||
public function __construct($A) {
|
public function __construct($A) {
|
||||||
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||||
// Use a "left-looking", dot-product, Crout/Doolittle algorithm.
|
// Use a "left-looking", dot-product, Crout/Doolittle algorithm.
|
||||||
$this->LU = $A->getArray();
|
$this->LU = $A->getArray();
|
||||||
$this->m = $A->getRowDimension();
|
$this->m = $A->getRowDimension();
|
||||||
$this->n = $A->getColumnDimension();
|
$this->n = $A->getColumnDimension();
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
$this->piv[$i] = $i;
|
$this->piv[$i] = $i;
|
||||||
}
|
}
|
||||||
$this->pivsign = 1;
|
$this->pivsign = 1;
|
||||||
$LUrowi = $LUcolj = array();
|
$LUrowi = $LUcolj = array();
|
||||||
|
|
||||||
// Outer loop.
|
// Outer loop.
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
// Make a copy of the j-th column to localize references.
|
// Make a copy of the j-th column to localize references.
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
$LUcolj[$i] = &$this->LU[$i][$j];
|
$LUcolj[$i] = &$this->LU[$i][$j];
|
||||||
}
|
}
|
||||||
// Apply previous transformations.
|
// Apply previous transformations.
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
$LUrowi = $this->LU[$i];
|
$LUrowi = $this->LU[$i];
|
||||||
// Most of the time is spent in the following dot product.
|
// Most of the time is spent in the following dot product.
|
||||||
$kmax = min($i,$j);
|
$kmax = min($i,$j);
|
||||||
$s = 0.0;
|
$s = 0.0;
|
||||||
for ($k = 0; $k < $kmax; ++$k) {
|
for ($k = 0; $k < $kmax; ++$k) {
|
||||||
$s += $LUrowi[$k] * $LUcolj[$k];
|
$s += $LUrowi[$k] * $LUcolj[$k];
|
||||||
}
|
}
|
||||||
$LUrowi[$j] = $LUcolj[$i] -= $s;
|
$LUrowi[$j] = $LUcolj[$i] -= $s;
|
||||||
}
|
}
|
||||||
// Find pivot and exchange if necessary.
|
// Find pivot and exchange if necessary.
|
||||||
$p = $j;
|
$p = $j;
|
||||||
for ($i = $j+1; $i < $this->m; ++$i) {
|
for ($i = $j+1; $i < $this->m; ++$i) {
|
||||||
if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
|
if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
|
||||||
$p = $i;
|
$p = $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($p != $j) {
|
if ($p != $j) {
|
||||||
for ($k = 0; $k < $this->n; ++$k) {
|
for ($k = 0; $k < $this->n; ++$k) {
|
||||||
$t = $this->LU[$p][$k];
|
$t = $this->LU[$p][$k];
|
||||||
$this->LU[$p][$k] = $this->LU[$j][$k];
|
$this->LU[$p][$k] = $this->LU[$j][$k];
|
||||||
$this->LU[$j][$k] = $t;
|
$this->LU[$j][$k] = $t;
|
||||||
}
|
}
|
||||||
$k = $this->piv[$p];
|
$k = $this->piv[$p];
|
||||||
$this->piv[$p] = $this->piv[$j];
|
$this->piv[$p] = $this->piv[$j];
|
||||||
$this->piv[$j] = $k;
|
$this->piv[$j] = $k;
|
||||||
$this->pivsign = $this->pivsign * -1;
|
$this->pivsign = $this->pivsign * -1;
|
||||||
}
|
}
|
||||||
// Compute multipliers.
|
// Compute multipliers.
|
||||||
if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
|
if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
|
||||||
for ($i = $j+1; $i < $this->m; ++$i) {
|
for ($i = $j+1; $i < $this->m; ++$i) {
|
||||||
$this->LU[$i][$j] /= $this->LU[$j][$j];
|
$this->LU[$i][$j] /= $this->LU[$j][$j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get lower triangular factor.
|
* Get lower triangular factor.
|
||||||
*
|
*
|
||||||
* @return array Lower triangular factor
|
* @return array Lower triangular factor
|
||||||
*/
|
*/
|
||||||
public function getL() {
|
public function getL() {
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
if ($i > $j) {
|
if ($i > $j) {
|
||||||
$L[$i][$j] = $this->LU[$i][$j];
|
$L[$i][$j] = $this->LU[$i][$j];
|
||||||
} elseif ($i == $j) {
|
} elseif ($i == $j) {
|
||||||
$L[$i][$j] = 1.0;
|
$L[$i][$j] = 1.0;
|
||||||
} else {
|
} else {
|
||||||
$L[$i][$j] = 0.0;
|
$L[$i][$j] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PHPExcel_Shared_JAMA_Matrix($L);
|
return new PHPExcel_Shared_JAMA_Matrix($L);
|
||||||
} // function getL()
|
} // function getL()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get upper triangular factor.
|
* Get upper triangular factor.
|
||||||
*
|
*
|
||||||
* @return array Upper triangular factor
|
* @return array Upper triangular factor
|
||||||
*/
|
*/
|
||||||
public function getU() {
|
public function getU() {
|
||||||
for ($i = 0; $i < $this->n; ++$i) {
|
for ($i = 0; $i < $this->n; ++$i) {
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
if ($i <= $j) {
|
if ($i <= $j) {
|
||||||
$U[$i][$j] = $this->LU[$i][$j];
|
$U[$i][$j] = $this->LU[$i][$j];
|
||||||
} else {
|
} else {
|
||||||
$U[$i][$j] = 0.0;
|
$U[$i][$j] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PHPExcel_Shared_JAMA_Matrix($U);
|
return new PHPExcel_Shared_JAMA_Matrix($U);
|
||||||
} // function getU()
|
} // function getU()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return pivot permutation vector.
|
* Return pivot permutation vector.
|
||||||
*
|
*
|
||||||
* @return array Pivot vector
|
* @return array Pivot vector
|
||||||
*/
|
*/
|
||||||
public function getPivot() {
|
public function getPivot() {
|
||||||
return $this->piv;
|
return $this->piv;
|
||||||
} // function getPivot()
|
} // function getPivot()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for getPivot
|
* Alias for getPivot
|
||||||
*
|
*
|
||||||
* @see getPivot
|
* @see getPivot
|
||||||
*/
|
*/
|
||||||
public function getDoublePivot() {
|
public function getDoublePivot() {
|
||||||
return $this->getPivot();
|
return $this->getPivot();
|
||||||
} // function getDoublePivot()
|
} // function getDoublePivot()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the matrix nonsingular?
|
* Is the matrix nonsingular?
|
||||||
*
|
*
|
||||||
* @return true if U, and hence A, is nonsingular.
|
* @return true if U, and hence A, is nonsingular.
|
||||||
*/
|
*/
|
||||||
public function isNonsingular() {
|
public function isNonsingular() {
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
if ($this->LU[$j][$j] == 0) {
|
if ($this->LU[$j][$j] == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} // function isNonsingular()
|
} // function isNonsingular()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count determinants
|
* Count determinants
|
||||||
*
|
*
|
||||||
* @return array d matrix deterninat
|
* @return array d matrix deterninat
|
||||||
*/
|
*/
|
||||||
public function det() {
|
public function det() {
|
||||||
if ($this->m == $this->n) {
|
if ($this->m == $this->n) {
|
||||||
$d = $this->pivsign;
|
$d = $this->pivsign;
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
$d *= $this->LU[$j][$j];
|
$d *= $this->LU[$j][$j];
|
||||||
}
|
}
|
||||||
return $d;
|
return $d;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||||
}
|
}
|
||||||
} // function det()
|
} // function det()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Solve A*X = B
|
* Solve A*X = B
|
||||||
*
|
*
|
||||||
* @param $B A Matrix with as many rows as A and any number of columns.
|
* @param $B A Matrix with as many rows as A and any number of columns.
|
||||||
* @return X so that L*U*X = B(piv,:)
|
* @return X so that L*U*X = B(piv,:)
|
||||||
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
|
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
|
||||||
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
|
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
|
||||||
*/
|
*/
|
||||||
public function solve($B) {
|
public function solve($B) {
|
||||||
if ($B->getRowDimension() == $this->m) {
|
if ($B->getRowDimension() == $this->m) {
|
||||||
if ($this->isNonsingular()) {
|
if ($this->isNonsingular()) {
|
||||||
// Copy right hand side with pivoting
|
// Copy right hand side with pivoting
|
||||||
$nx = $B->getColumnDimension();
|
$nx = $B->getColumnDimension();
|
||||||
$X = $B->getMatrix($this->piv, 0, $nx-1);
|
$X = $B->getMatrix($this->piv, 0, $nx-1);
|
||||||
// Solve L*Y = B(piv,:)
|
// Solve L*Y = B(piv,:)
|
||||||
for ($k = 0; $k < $this->n; ++$k) {
|
for ($k = 0; $k < $this->n; ++$k) {
|
||||||
for ($i = $k+1; $i < $this->n; ++$i) {
|
for ($i = $k+1; $i < $this->n; ++$i) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
|
$X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Solve U*X = Y;
|
// Solve U*X = Y;
|
||||||
for ($k = $this->n-1; $k >= 0; --$k) {
|
for ($k = $this->n-1; $k >= 0; --$k) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X->A[$k][$j] /= $this->LU[$k][$k];
|
$X->A[$k][$j] /= $this->LU[$k][$k];
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < $k; ++$i) {
|
for ($i = 0; $i < $k; ++$i) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
|
$X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $X;
|
return $X;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(self::MatrixSingularException);
|
throw new PHPExcel_Calculation_Exception(self::MatrixSingularException);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
|
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
|
||||||
}
|
}
|
||||||
} // function solve()
|
} // function solve()
|
||||||
|
|
||||||
} // class PHPExcel_Shared_JAMA_LUDecomposition
|
} // class PHPExcel_Shared_JAMA_LUDecomposition
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,234 +1,234 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package JAMA
|
* @package JAMA
|
||||||
*
|
*
|
||||||
* For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
|
* For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
|
||||||
* orthogonal matrix Q and an n-by-n upper triangular matrix R so that
|
* orthogonal matrix Q and an n-by-n upper triangular matrix R so that
|
||||||
* A = Q*R.
|
* A = Q*R.
|
||||||
*
|
*
|
||||||
* The QR decompostion always exists, even if the matrix does not have
|
* The QR decompostion always exists, even if the matrix does not have
|
||||||
* full rank, so the constructor will never fail. The primary use of the
|
* full rank, so the constructor will never fail. The primary use of the
|
||||||
* QR decomposition is in the least squares solution of nonsquare systems
|
* QR decomposition is in the least squares solution of nonsquare systems
|
||||||
* of simultaneous linear equations. This will fail if isFullRank()
|
* of simultaneous linear equations. This will fail if isFullRank()
|
||||||
* returns false.
|
* returns false.
|
||||||
*
|
*
|
||||||
* @author Paul Meagher
|
* @author Paul Meagher
|
||||||
* @license PHP v3.0
|
* @license PHP v3.0
|
||||||
* @version 1.1
|
* @version 1.1
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_JAMA_QRDecomposition {
|
class PHPExcel_Shared_JAMA_QRDecomposition {
|
||||||
|
|
||||||
const MatrixRankException = "Can only perform operation on full-rank matrix.";
|
const MatrixRankException = "Can only perform operation on full-rank matrix.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array for internal storage of decomposition.
|
* Array for internal storage of decomposition.
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $QR = array();
|
private $QR = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Row dimension.
|
* Row dimension.
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $m;
|
private $m;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Column dimension.
|
* Column dimension.
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $n;
|
private $n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array for internal storage of diagonal of R.
|
* Array for internal storage of diagonal of R.
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $Rdiag = array();
|
private $Rdiag = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QR Decomposition computed by Householder reflections.
|
* QR Decomposition computed by Householder reflections.
|
||||||
*
|
*
|
||||||
* @param matrix $A Rectangular matrix
|
* @param matrix $A Rectangular matrix
|
||||||
* @return Structure to access R and the Householder vectors and compute Q.
|
* @return Structure to access R and the Householder vectors and compute Q.
|
||||||
*/
|
*/
|
||||||
public function __construct($A) {
|
public function __construct($A) {
|
||||||
if($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
if($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||||
// Initialize.
|
// Initialize.
|
||||||
$this->QR = $A->getArrayCopy();
|
$this->QR = $A->getArrayCopy();
|
||||||
$this->m = $A->getRowDimension();
|
$this->m = $A->getRowDimension();
|
||||||
$this->n = $A->getColumnDimension();
|
$this->n = $A->getColumnDimension();
|
||||||
// Main loop.
|
// Main loop.
|
||||||
for ($k = 0; $k < $this->n; ++$k) {
|
for ($k = 0; $k < $this->n; ++$k) {
|
||||||
// Compute 2-norm of k-th column without under/overflow.
|
// Compute 2-norm of k-th column without under/overflow.
|
||||||
$nrm = 0.0;
|
$nrm = 0.0;
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$nrm = hypo($nrm, $this->QR[$i][$k]);
|
$nrm = hypo($nrm, $this->QR[$i][$k]);
|
||||||
}
|
}
|
||||||
if ($nrm != 0.0) {
|
if ($nrm != 0.0) {
|
||||||
// Form k-th Householder vector.
|
// Form k-th Householder vector.
|
||||||
if ($this->QR[$k][$k] < 0) {
|
if ($this->QR[$k][$k] < 0) {
|
||||||
$nrm = -$nrm;
|
$nrm = -$nrm;
|
||||||
}
|
}
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$this->QR[$i][$k] /= $nrm;
|
$this->QR[$i][$k] /= $nrm;
|
||||||
}
|
}
|
||||||
$this->QR[$k][$k] += 1.0;
|
$this->QR[$k][$k] += 1.0;
|
||||||
// Apply transformation to remaining columns.
|
// Apply transformation to remaining columns.
|
||||||
for ($j = $k+1; $j < $this->n; ++$j) {
|
for ($j = $k+1; $j < $this->n; ++$j) {
|
||||||
$s = 0.0;
|
$s = 0.0;
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$s += $this->QR[$i][$k] * $this->QR[$i][$j];
|
$s += $this->QR[$i][$k] * $this->QR[$i][$j];
|
||||||
}
|
}
|
||||||
$s = -$s/$this->QR[$k][$k];
|
$s = -$s/$this->QR[$k][$k];
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$this->QR[$i][$j] += $s * $this->QR[$i][$k];
|
$this->QR[$i][$j] += $s * $this->QR[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->Rdiag[$k] = -$nrm;
|
$this->Rdiag[$k] = -$nrm;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the matrix full rank?
|
* Is the matrix full rank?
|
||||||
*
|
*
|
||||||
* @return boolean true if R, and hence A, has full rank, else false.
|
* @return boolean true if R, and hence A, has full rank, else false.
|
||||||
*/
|
*/
|
||||||
public function isFullRank() {
|
public function isFullRank() {
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
if ($this->Rdiag[$j] == 0) {
|
if ($this->Rdiag[$j] == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} // function isFullRank()
|
} // function isFullRank()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Householder vectors
|
* Return the Householder vectors
|
||||||
*
|
*
|
||||||
* @return Matrix Lower trapezoidal matrix whose columns define the reflections
|
* @return Matrix Lower trapezoidal matrix whose columns define the reflections
|
||||||
*/
|
*/
|
||||||
public function getH() {
|
public function getH() {
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
if ($i >= $j) {
|
if ($i >= $j) {
|
||||||
$H[$i][$j] = $this->QR[$i][$j];
|
$H[$i][$j] = $this->QR[$i][$j];
|
||||||
} else {
|
} else {
|
||||||
$H[$i][$j] = 0.0;
|
$H[$i][$j] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PHPExcel_Shared_JAMA_Matrix($H);
|
return new PHPExcel_Shared_JAMA_Matrix($H);
|
||||||
} // function getH()
|
} // function getH()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the upper triangular factor
|
* Return the upper triangular factor
|
||||||
*
|
*
|
||||||
* @return Matrix upper triangular factor
|
* @return Matrix upper triangular factor
|
||||||
*/
|
*/
|
||||||
public function getR() {
|
public function getR() {
|
||||||
for ($i = 0; $i < $this->n; ++$i) {
|
for ($i = 0; $i < $this->n; ++$i) {
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
if ($i < $j) {
|
if ($i < $j) {
|
||||||
$R[$i][$j] = $this->QR[$i][$j];
|
$R[$i][$j] = $this->QR[$i][$j];
|
||||||
} elseif ($i == $j) {
|
} elseif ($i == $j) {
|
||||||
$R[$i][$j] = $this->Rdiag[$i];
|
$R[$i][$j] = $this->Rdiag[$i];
|
||||||
} else {
|
} else {
|
||||||
$R[$i][$j] = 0.0;
|
$R[$i][$j] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PHPExcel_Shared_JAMA_Matrix($R);
|
return new PHPExcel_Shared_JAMA_Matrix($R);
|
||||||
} // function getR()
|
} // function getR()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate and return the (economy-sized) orthogonal factor
|
* Generate and return the (economy-sized) orthogonal factor
|
||||||
*
|
*
|
||||||
* @return Matrix orthogonal factor
|
* @return Matrix orthogonal factor
|
||||||
*/
|
*/
|
||||||
public function getQ() {
|
public function getQ() {
|
||||||
for ($k = $this->n-1; $k >= 0; --$k) {
|
for ($k = $this->n-1; $k >= 0; --$k) {
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
$Q[$i][$k] = 0.0;
|
$Q[$i][$k] = 0.0;
|
||||||
}
|
}
|
||||||
$Q[$k][$k] = 1.0;
|
$Q[$k][$k] = 1.0;
|
||||||
for ($j = $k; $j < $this->n; ++$j) {
|
for ($j = $k; $j < $this->n; ++$j) {
|
||||||
if ($this->QR[$k][$k] != 0) {
|
if ($this->QR[$k][$k] != 0) {
|
||||||
$s = 0.0;
|
$s = 0.0;
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$s += $this->QR[$i][$k] * $Q[$i][$j];
|
$s += $this->QR[$i][$k] * $Q[$i][$j];
|
||||||
}
|
}
|
||||||
$s = -$s/$this->QR[$k][$k];
|
$s = -$s/$this->QR[$k][$k];
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$Q[$i][$j] += $s * $this->QR[$i][$k];
|
$Q[$i][$j] += $s * $this->QR[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
for($i = 0; $i < count($Q); ++$i) {
|
for($i = 0; $i < count($Q); ++$i) {
|
||||||
for($j = 0; $j < count($Q); ++$j) {
|
for($j = 0; $j < count($Q); ++$j) {
|
||||||
if(! isset($Q[$i][$j]) ) {
|
if(! isset($Q[$i][$j]) ) {
|
||||||
$Q[$i][$j] = 0;
|
$Q[$i][$j] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return new PHPExcel_Shared_JAMA_Matrix($Q);
|
return new PHPExcel_Shared_JAMA_Matrix($Q);
|
||||||
} // function getQ()
|
} // function getQ()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Least squares solution of A*X = B
|
* Least squares solution of A*X = B
|
||||||
*
|
*
|
||||||
* @param Matrix $B A Matrix with as many rows as A and any number of columns.
|
* @param Matrix $B A Matrix with as many rows as A and any number of columns.
|
||||||
* @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
|
* @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
|
||||||
*/
|
*/
|
||||||
public function solve($B) {
|
public function solve($B) {
|
||||||
if ($B->getRowDimension() == $this->m) {
|
if ($B->getRowDimension() == $this->m) {
|
||||||
if ($this->isFullRank()) {
|
if ($this->isFullRank()) {
|
||||||
// Copy right hand side
|
// Copy right hand side
|
||||||
$nx = $B->getColumnDimension();
|
$nx = $B->getColumnDimension();
|
||||||
$X = $B->getArrayCopy();
|
$X = $B->getArrayCopy();
|
||||||
// Compute Y = transpose(Q)*B
|
// Compute Y = transpose(Q)*B
|
||||||
for ($k = 0; $k < $this->n; ++$k) {
|
for ($k = 0; $k < $this->n; ++$k) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$s = 0.0;
|
$s = 0.0;
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$s += $this->QR[$i][$k] * $X[$i][$j];
|
$s += $this->QR[$i][$k] * $X[$i][$j];
|
||||||
}
|
}
|
||||||
$s = -$s/$this->QR[$k][$k];
|
$s = -$s/$this->QR[$k][$k];
|
||||||
for ($i = $k; $i < $this->m; ++$i) {
|
for ($i = $k; $i < $this->m; ++$i) {
|
||||||
$X[$i][$j] += $s * $this->QR[$i][$k];
|
$X[$i][$j] += $s * $this->QR[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Solve R*X = Y;
|
// Solve R*X = Y;
|
||||||
for ($k = $this->n-1; $k >= 0; --$k) {
|
for ($k = $this->n-1; $k >= 0; --$k) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X[$k][$j] /= $this->Rdiag[$k];
|
$X[$k][$j] /= $this->Rdiag[$k];
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < $k; ++$i) {
|
for ($i = 0; $i < $k; ++$i) {
|
||||||
for ($j = 0; $j < $nx; ++$j) {
|
for ($j = 0; $j < $nx; ++$j) {
|
||||||
$X[$i][$j] -= $X[$k][$j]* $this->QR[$i][$k];
|
$X[$i][$j] -= $X[$k][$j]* $this->QR[$i][$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$X = new PHPExcel_Shared_JAMA_Matrix($X);
|
$X = new PHPExcel_Shared_JAMA_Matrix($X);
|
||||||
return ($X->getMatrix(0, $this->n-1, 0, $nx));
|
return ($X->getMatrix(0, $this->n-1, 0, $nx));
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(self::MatrixRankException);
|
throw new PHPExcel_Calculation_Exception(self::MatrixRankException);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||||
}
|
}
|
||||||
} // function solve()
|
} // function solve()
|
||||||
|
|
||||||
} // PHPExcel_Shared_JAMA_class QRDecomposition
|
} // PHPExcel_Shared_JAMA_class QRDecomposition
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package JAMA
|
* @package JAMA
|
||||||
*
|
*
|
||||||
* Error handling
|
* Error handling
|
||||||
* @author Michael Bommarito
|
* @author Michael Bommarito
|
||||||
* @version 01292005
|
* @version 01292005
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Language constant
|
//Language constant
|
||||||
@ -64,19 +64,19 @@ define('RowLengthException', -10);
|
|||||||
$error['EN'][RowLengthException] = "All rows must have the same length.";
|
$error['EN'][RowLengthException] = "All rows must have the same length.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom error handler
|
* Custom error handler
|
||||||
* @param int $num Error number
|
* @param int $num Error number
|
||||||
*/
|
*/
|
||||||
function JAMAError($errorNumber = null) {
|
function JAMAError($errorNumber = null) {
|
||||||
global $error;
|
global $error;
|
||||||
|
|
||||||
if (isset($errorNumber)) {
|
if (isset($errorNumber)) {
|
||||||
if (isset($error[JAMALANG][$errorNumber])) {
|
if (isset($error[JAMALANG][$errorNumber])) {
|
||||||
return $error[JAMALANG][$errorNumber];
|
return $error[JAMALANG][$errorNumber];
|
||||||
} else {
|
} else {
|
||||||
return $error['EN'][$errorNumber];
|
return $error['EN'][$errorNumber];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return ("Invalid argument to JAMAError()");
|
return ("Invalid argument to JAMAError()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package JAMA
|
* @package JAMA
|
||||||
*
|
*
|
||||||
* Pythagorean Theorem:
|
* Pythagorean Theorem:
|
||||||
*
|
*
|
||||||
* a = 3
|
* a = 3
|
||||||
* b = 4
|
* b = 4
|
||||||
* r = sqrt(square(a) + square(b))
|
* r = sqrt(square(a) + square(b))
|
||||||
* r = 5
|
* r = 5
|
||||||
*
|
*
|
||||||
* r = sqrt(a^2 + b^2) without under/overflow.
|
* r = sqrt(a^2 + b^2) without under/overflow.
|
||||||
*/
|
*/
|
||||||
function hypo($a, $b) {
|
function hypo($a, $b) {
|
||||||
if (abs($a) > abs($b)) {
|
if (abs($a) > abs($b)) {
|
||||||
$r = $b / $a;
|
$r = $b / $a;
|
||||||
$r = abs($a) * sqrt(1 + $r * $r);
|
$r = abs($a) * sqrt(1 + $r * $r);
|
||||||
} elseif ($b != 0) {
|
} elseif ($b != 0) {
|
||||||
$r = $a / $b;
|
$r = $a / $b;
|
||||||
$r = abs($b) * sqrt(1 + $r * $r);
|
$r = abs($b) * sqrt(1 + $r * $r);
|
||||||
} else {
|
} else {
|
||||||
$r = 0.0;
|
$r = 0.0;
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
} // function hypo()
|
} // function hypo()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mike Bommarito's version.
|
* Mike Bommarito's version.
|
||||||
* Compute n-dimensional hyotheneuse.
|
* Compute n-dimensional hyotheneuse.
|
||||||
*
|
*
|
||||||
function hypot() {
|
function hypot() {
|
||||||
$s = 0;
|
$s = 0;
|
||||||
foreach (func_get_args() as $d) {
|
foreach (func_get_args() as $d) {
|
||||||
if (is_numeric($d)) {
|
if (is_numeric($d)) {
|
||||||
$s += pow($d, 2);
|
$s += pow($d, 2);
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sqrt($s);
|
return sqrt($s);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -37,495 +37,495 @@ $GLOBALS['_OLE_INSTANCES'] = array();
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_OLE
|
class PHPExcel_Shared_OLE
|
||||||
{
|
{
|
||||||
const OLE_PPS_TYPE_ROOT = 5;
|
const OLE_PPS_TYPE_ROOT = 5;
|
||||||
const OLE_PPS_TYPE_DIR = 1;
|
const OLE_PPS_TYPE_DIR = 1;
|
||||||
const OLE_PPS_TYPE_FILE = 2;
|
const OLE_PPS_TYPE_FILE = 2;
|
||||||
const OLE_DATA_SIZE_SMALL = 0x1000;
|
const OLE_DATA_SIZE_SMALL = 0x1000;
|
||||||
const OLE_LONG_INT_SIZE = 4;
|
const OLE_LONG_INT_SIZE = 4;
|
||||||
const OLE_PPS_SIZE = 0x80;
|
const OLE_PPS_SIZE = 0x80;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The file handle for reading an OLE container
|
* The file handle for reading an OLE container
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
public $_file_handle;
|
public $_file_handle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of PPS's found on the OLE container
|
* Array of PPS's found on the OLE container
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $_list = array();
|
public $_list = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Root directory of OLE container
|
* Root directory of OLE container
|
||||||
* @var OLE_PPS_Root
|
* @var OLE_PPS_Root
|
||||||
*/
|
*/
|
||||||
public $root;
|
public $root;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Big Block Allocation Table
|
* Big Block Allocation Table
|
||||||
* @var array (blockId => nextBlockId)
|
* @var array (blockId => nextBlockId)
|
||||||
*/
|
*/
|
||||||
public $bbat;
|
public $bbat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short Block Allocation Table
|
* Short Block Allocation Table
|
||||||
* @var array (blockId => nextBlockId)
|
* @var array (blockId => nextBlockId)
|
||||||
*/
|
*/
|
||||||
public $sbat;
|
public $sbat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of big blocks. This is usually 512.
|
* Size of big blocks. This is usually 512.
|
||||||
* @var int number of octets per block.
|
* @var int number of octets per block.
|
||||||
*/
|
*/
|
||||||
public $bigBlockSize;
|
public $bigBlockSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of small blocks. This is usually 64.
|
* Size of small blocks. This is usually 64.
|
||||||
* @var int number of octets per block
|
* @var int number of octets per block
|
||||||
*/
|
*/
|
||||||
public $smallBlockSize;
|
public $smallBlockSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads an OLE container from the contents of the file given.
|
* Reads an OLE container from the contents of the file given.
|
||||||
*
|
*
|
||||||
* @acces public
|
* @acces public
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @return mixed true on success, PEAR_Error on failure
|
* @return mixed true on success, PEAR_Error on failure
|
||||||
*/
|
*/
|
||||||
public function read($file)
|
public function read($file)
|
||||||
{
|
{
|
||||||
$fh = fopen($file, "r");
|
$fh = fopen($file, "r");
|
||||||
if (!$fh) {
|
if (!$fh) {
|
||||||
throw new PHPExcel_Reader_Exception("Can't open file $file");
|
throw new PHPExcel_Reader_Exception("Can't open file $file");
|
||||||
}
|
}
|
||||||
$this->_file_handle = $fh;
|
$this->_file_handle = $fh;
|
||||||
|
|
||||||
$signature = fread($fh, 8);
|
$signature = fread($fh, 8);
|
||||||
if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
|
if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
|
||||||
throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container.");
|
throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container.");
|
||||||
}
|
}
|
||||||
fseek($fh, 28);
|
fseek($fh, 28);
|
||||||
if (fread($fh, 2) != "\xFE\xFF") {
|
if (fread($fh, 2) != "\xFE\xFF") {
|
||||||
// This shouldn't be a problem in practice
|
// This shouldn't be a problem in practice
|
||||||
throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported.");
|
throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported.");
|
||||||
}
|
}
|
||||||
// Size of blocks and short blocks in bytes
|
// Size of blocks and short blocks in bytes
|
||||||
$this->bigBlockSize = pow(2, self::_readInt2($fh));
|
$this->bigBlockSize = pow(2, self::_readInt2($fh));
|
||||||
$this->smallBlockSize = pow(2, self::_readInt2($fh));
|
$this->smallBlockSize = pow(2, self::_readInt2($fh));
|
||||||
|
|
||||||
// Skip UID, revision number and version number
|
// Skip UID, revision number and version number
|
||||||
fseek($fh, 44);
|
fseek($fh, 44);
|
||||||
// Number of blocks in Big Block Allocation Table
|
// Number of blocks in Big Block Allocation Table
|
||||||
$bbatBlockCount = self::_readInt4($fh);
|
$bbatBlockCount = self::_readInt4($fh);
|
||||||
|
|
||||||
// Root chain 1st block
|
// Root chain 1st block
|
||||||
$directoryFirstBlockId = self::_readInt4($fh);
|
$directoryFirstBlockId = self::_readInt4($fh);
|
||||||
|
|
||||||
// Skip unused bytes
|
// Skip unused bytes
|
||||||
fseek($fh, 56);
|
fseek($fh, 56);
|
||||||
// Streams shorter than this are stored using small blocks
|
// Streams shorter than this are stored using small blocks
|
||||||
$this->bigBlockThreshold = self::_readInt4($fh);
|
$this->bigBlockThreshold = self::_readInt4($fh);
|
||||||
// Block id of first sector in Short Block Allocation Table
|
// Block id of first sector in Short Block Allocation Table
|
||||||
$sbatFirstBlockId = self::_readInt4($fh);
|
$sbatFirstBlockId = self::_readInt4($fh);
|
||||||
// Number of blocks in Short Block Allocation Table
|
// Number of blocks in Short Block Allocation Table
|
||||||
$sbbatBlockCount = self::_readInt4($fh);
|
$sbbatBlockCount = self::_readInt4($fh);
|
||||||
// Block id of first sector in Master Block Allocation Table
|
// Block id of first sector in Master Block Allocation Table
|
||||||
$mbatFirstBlockId = self::_readInt4($fh);
|
$mbatFirstBlockId = self::_readInt4($fh);
|
||||||
// Number of blocks in Master Block Allocation Table
|
// Number of blocks in Master Block Allocation Table
|
||||||
$mbbatBlockCount = self::_readInt4($fh);
|
$mbbatBlockCount = self::_readInt4($fh);
|
||||||
$this->bbat = array();
|
$this->bbat = array();
|
||||||
|
|
||||||
// Remaining 4 * 109 bytes of current block is beginning of Master
|
// Remaining 4 * 109 bytes of current block is beginning of Master
|
||||||
// Block Allocation Table
|
// Block Allocation Table
|
||||||
$mbatBlocks = array();
|
$mbatBlocks = array();
|
||||||
for ($i = 0; $i < 109; ++$i) {
|
for ($i = 0; $i < 109; ++$i) {
|
||||||
$mbatBlocks[] = self::_readInt4($fh);
|
$mbatBlocks[] = self::_readInt4($fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read rest of Master Block Allocation Table (if any is left)
|
// Read rest of Master Block Allocation Table (if any is left)
|
||||||
$pos = $this->_getBlockOffset($mbatFirstBlockId);
|
$pos = $this->_getBlockOffset($mbatFirstBlockId);
|
||||||
for ($i = 0; $i < $mbbatBlockCount; ++$i) {
|
for ($i = 0; $i < $mbbatBlockCount; ++$i) {
|
||||||
fseek($fh, $pos);
|
fseek($fh, $pos);
|
||||||
for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
|
for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
|
||||||
$mbatBlocks[] = self::_readInt4($fh);
|
$mbatBlocks[] = self::_readInt4($fh);
|
||||||
}
|
}
|
||||||
// Last block id in each block points to next block
|
// Last block id in each block points to next block
|
||||||
$pos = $this->_getBlockOffset(self::_readInt4($fh));
|
$pos = $this->_getBlockOffset(self::_readInt4($fh));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read Big Block Allocation Table according to chain specified by
|
// Read Big Block Allocation Table according to chain specified by
|
||||||
// $mbatBlocks
|
// $mbatBlocks
|
||||||
for ($i = 0; $i < $bbatBlockCount; ++$i) {
|
for ($i = 0; $i < $bbatBlockCount; ++$i) {
|
||||||
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
|
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
|
||||||
fseek($fh, $pos);
|
fseek($fh, $pos);
|
||||||
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
|
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
|
||||||
$this->bbat[] = self::_readInt4($fh);
|
$this->bbat[] = self::_readInt4($fh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read short block allocation table (SBAT)
|
// Read short block allocation table (SBAT)
|
||||||
$this->sbat = array();
|
$this->sbat = array();
|
||||||
$shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
|
$shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
|
||||||
$sbatFh = $this->getStream($sbatFirstBlockId);
|
$sbatFh = $this->getStream($sbatFirstBlockId);
|
||||||
for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
|
for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
|
||||||
$this->sbat[$blockId] = self::_readInt4($sbatFh);
|
$this->sbat[$blockId] = self::_readInt4($sbatFh);
|
||||||
}
|
}
|
||||||
fclose($sbatFh);
|
fclose($sbatFh);
|
||||||
|
|
||||||
$this->_readPpsWks($directoryFirstBlockId);
|
$this->_readPpsWks($directoryFirstBlockId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int block id
|
* @param int block id
|
||||||
* @param int byte offset from beginning of file
|
* @param int byte offset from beginning of file
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function _getBlockOffset($blockId)
|
public function _getBlockOffset($blockId)
|
||||||
{
|
{
|
||||||
return 512 + $blockId * $this->bigBlockSize;
|
return 512 + $blockId * $this->bigBlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a stream for use with fread() etc. External callers should
|
* Returns a stream for use with fread() etc. External callers should
|
||||||
* use PHPExcel_Shared_OLE_PPS_File::getStream().
|
* use PHPExcel_Shared_OLE_PPS_File::getStream().
|
||||||
* @param int|PPS block id or PPS
|
* @param int|PPS block id or PPS
|
||||||
* @return resource read-only stream
|
* @return resource read-only stream
|
||||||
*/
|
*/
|
||||||
public function getStream($blockIdOrPps)
|
public function getStream($blockIdOrPps)
|
||||||
{
|
{
|
||||||
static $isRegistered = false;
|
static $isRegistered = false;
|
||||||
if (!$isRegistered) {
|
if (!$isRegistered) {
|
||||||
stream_wrapper_register('ole-chainedblockstream',
|
stream_wrapper_register('ole-chainedblockstream',
|
||||||
'PHPExcel_Shared_OLE_ChainedBlockStream');
|
'PHPExcel_Shared_OLE_ChainedBlockStream');
|
||||||
$isRegistered = true;
|
$isRegistered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store current instance in global array, so that it can be accessed
|
// Store current instance in global array, so that it can be accessed
|
||||||
// in OLE_ChainedBlockStream::stream_open().
|
// in OLE_ChainedBlockStream::stream_open().
|
||||||
// Object is removed from self::$instances in OLE_Stream::close().
|
// Object is removed from self::$instances in OLE_Stream::close().
|
||||||
$GLOBALS['_OLE_INSTANCES'][] = $this;
|
$GLOBALS['_OLE_INSTANCES'][] = $this;
|
||||||
$instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
|
$instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
|
||||||
|
|
||||||
$path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
|
$path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
|
||||||
if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
|
if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
|
||||||
$path .= '&blockId=' . $blockIdOrPps->_StartBlock;
|
$path .= '&blockId=' . $blockIdOrPps->_StartBlock;
|
||||||
$path .= '&size=' . $blockIdOrPps->Size;
|
$path .= '&size=' . $blockIdOrPps->Size;
|
||||||
} else {
|
} else {
|
||||||
$path .= '&blockId=' . $blockIdOrPps;
|
$path .= '&blockId=' . $blockIdOrPps;
|
||||||
}
|
}
|
||||||
return fopen($path, 'r');
|
return fopen($path, 'r');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a signed char.
|
* Reads a signed char.
|
||||||
* @param resource file handle
|
* @param resource file handle
|
||||||
* @return int
|
* @return int
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
private static function _readInt1($fh)
|
private static function _readInt1($fh)
|
||||||
{
|
{
|
||||||
list(, $tmp) = unpack("c", fread($fh, 1));
|
list(, $tmp) = unpack("c", fread($fh, 1));
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads an unsigned short (2 octets).
|
* Reads an unsigned short (2 octets).
|
||||||
* @param resource file handle
|
* @param resource file handle
|
||||||
* @return int
|
* @return int
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
private static function _readInt2($fh)
|
private static function _readInt2($fh)
|
||||||
{
|
{
|
||||||
list(, $tmp) = unpack("v", fread($fh, 2));
|
list(, $tmp) = unpack("v", fread($fh, 2));
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads an unsigned long (4 octets).
|
* Reads an unsigned long (4 octets).
|
||||||
* @param resource file handle
|
* @param resource file handle
|
||||||
* @return int
|
* @return int
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
private static function _readInt4($fh)
|
private static function _readInt4($fh)
|
||||||
{
|
{
|
||||||
list(, $tmp) = unpack("V", fread($fh, 4));
|
list(, $tmp) = unpack("V", fread($fh, 4));
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets information about all PPS's on the OLE container from the PPS WK's
|
* Gets information about all PPS's on the OLE container from the PPS WK's
|
||||||
* creates an OLE_PPS object for each one.
|
* creates an OLE_PPS object for each one.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer the block id of the first block
|
* @param integer the block id of the first block
|
||||||
* @return mixed true on success, PEAR_Error on failure
|
* @return mixed true on success, PEAR_Error on failure
|
||||||
*/
|
*/
|
||||||
public function _readPpsWks($blockId)
|
public function _readPpsWks($blockId)
|
||||||
{
|
{
|
||||||
$fh = $this->getStream($blockId);
|
$fh = $this->getStream($blockId);
|
||||||
for ($pos = 0; ; $pos += 128) {
|
for ($pos = 0; ; $pos += 128) {
|
||||||
fseek($fh, $pos, SEEK_SET);
|
fseek($fh, $pos, SEEK_SET);
|
||||||
$nameUtf16 = fread($fh, 64);
|
$nameUtf16 = fread($fh, 64);
|
||||||
$nameLength = self::_readInt2($fh);
|
$nameLength = self::_readInt2($fh);
|
||||||
$nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
|
$nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
|
||||||
// Simple conversion from UTF-16LE to ISO-8859-1
|
// Simple conversion from UTF-16LE to ISO-8859-1
|
||||||
$name = str_replace("\x00", "", $nameUtf16);
|
$name = str_replace("\x00", "", $nameUtf16);
|
||||||
$type = self::_readInt1($fh);
|
$type = self::_readInt1($fh);
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::OLE_PPS_TYPE_ROOT:
|
case self::OLE_PPS_TYPE_ROOT:
|
||||||
$pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
|
$pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
|
||||||
$this->root = $pps;
|
$this->root = $pps;
|
||||||
break;
|
break;
|
||||||
case self::OLE_PPS_TYPE_DIR:
|
case self::OLE_PPS_TYPE_DIR:
|
||||||
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
|
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
|
||||||
null, null, null, null, array());
|
null, null, null, null, array());
|
||||||
break;
|
break;
|
||||||
case self::OLE_PPS_TYPE_FILE:
|
case self::OLE_PPS_TYPE_FILE:
|
||||||
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
|
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fseek($fh, 1, SEEK_CUR);
|
fseek($fh, 1, SEEK_CUR);
|
||||||
$pps->Type = $type;
|
$pps->Type = $type;
|
||||||
$pps->Name = $name;
|
$pps->Name = $name;
|
||||||
$pps->PrevPps = self::_readInt4($fh);
|
$pps->PrevPps = self::_readInt4($fh);
|
||||||
$pps->NextPps = self::_readInt4($fh);
|
$pps->NextPps = self::_readInt4($fh);
|
||||||
$pps->DirPps = self::_readInt4($fh);
|
$pps->DirPps = self::_readInt4($fh);
|
||||||
fseek($fh, 20, SEEK_CUR);
|
fseek($fh, 20, SEEK_CUR);
|
||||||
$pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
|
$pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
|
||||||
$pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
|
$pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
|
||||||
$pps->_StartBlock = self::_readInt4($fh);
|
$pps->_StartBlock = self::_readInt4($fh);
|
||||||
$pps->Size = self::_readInt4($fh);
|
$pps->Size = self::_readInt4($fh);
|
||||||
$pps->No = count($this->_list);
|
$pps->No = count($this->_list);
|
||||||
$this->_list[] = $pps;
|
$this->_list[] = $pps;
|
||||||
|
|
||||||
// check if the PPS tree (starting from root) is complete
|
// check if the PPS tree (starting from root) is complete
|
||||||
if (isset($this->root) &&
|
if (isset($this->root) &&
|
||||||
$this->_ppsTreeComplete($this->root->No)) {
|
$this->_ppsTreeComplete($this->root->No)) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
|
||||||
// Initialize $pps->children on directories
|
// Initialize $pps->children on directories
|
||||||
foreach ($this->_list as $pps) {
|
foreach ($this->_list as $pps) {
|
||||||
if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) {
|
if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) {
|
||||||
$nos = array($pps->DirPps);
|
$nos = array($pps->DirPps);
|
||||||
$pps->children = array();
|
$pps->children = array();
|
||||||
while ($nos) {
|
while ($nos) {
|
||||||
$no = array_pop($nos);
|
$no = array_pop($nos);
|
||||||
if ($no != -1) {
|
if ($no != -1) {
|
||||||
$childPps = $this->_list[$no];
|
$childPps = $this->_list[$no];
|
||||||
$nos[] = $childPps->PrevPps;
|
$nos[] = $childPps->PrevPps;
|
||||||
$nos[] = $childPps->NextPps;
|
$nos[] = $childPps->NextPps;
|
||||||
$pps->children[] = $childPps;
|
$pps->children[] = $childPps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It checks whether the PPS tree is complete (all PPS's read)
|
* It checks whether the PPS tree is complete (all PPS's read)
|
||||||
* starting with the given PPS (not necessarily root)
|
* starting with the given PPS (not necessarily root)
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $index The index of the PPS from which we are checking
|
* @param integer $index The index of the PPS from which we are checking
|
||||||
* @return boolean Whether the PPS tree for the given PPS is complete
|
* @return boolean Whether the PPS tree for the given PPS is complete
|
||||||
*/
|
*/
|
||||||
public function _ppsTreeComplete($index)
|
public function _ppsTreeComplete($index)
|
||||||
{
|
{
|
||||||
return isset($this->_list[$index]) &&
|
return isset($this->_list[$index]) &&
|
||||||
($pps = $this->_list[$index]) &&
|
($pps = $this->_list[$index]) &&
|
||||||
($pps->PrevPps == -1 ||
|
($pps->PrevPps == -1 ||
|
||||||
$this->_ppsTreeComplete($pps->PrevPps)) &&
|
$this->_ppsTreeComplete($pps->PrevPps)) &&
|
||||||
($pps->NextPps == -1 ||
|
($pps->NextPps == -1 ||
|
||||||
$this->_ppsTreeComplete($pps->NextPps)) &&
|
$this->_ppsTreeComplete($pps->NextPps)) &&
|
||||||
($pps->DirPps == -1 ||
|
($pps->DirPps == -1 ||
|
||||||
$this->_ppsTreeComplete($pps->DirPps));
|
$this->_ppsTreeComplete($pps->DirPps));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a PPS is a File PPS or not.
|
* Checks whether a PPS is a File PPS or not.
|
||||||
* If there is no PPS for the index given, it will return false.
|
* If there is no PPS for the index given, it will return false.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $index The index for the PPS
|
* @param integer $index The index for the PPS
|
||||||
* @return bool true if it's a File PPS, false otherwise
|
* @return bool true if it's a File PPS, false otherwise
|
||||||
*/
|
*/
|
||||||
public function isFile($index)
|
public function isFile($index)
|
||||||
{
|
{
|
||||||
if (isset($this->_list[$index])) {
|
if (isset($this->_list[$index])) {
|
||||||
return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
|
return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a PPS is a Root PPS or not.
|
* Checks whether a PPS is a Root PPS or not.
|
||||||
* If there is no PPS for the index given, it will return false.
|
* If there is no PPS for the index given, it will return false.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $index The index for the PPS.
|
* @param integer $index The index for the PPS.
|
||||||
* @return bool true if it's a Root PPS, false otherwise
|
* @return bool true if it's a Root PPS, false otherwise
|
||||||
*/
|
*/
|
||||||
public function isRoot($index)
|
public function isRoot($index)
|
||||||
{
|
{
|
||||||
if (isset($this->_list[$index])) {
|
if (isset($this->_list[$index])) {
|
||||||
return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT);
|
return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the total number of PPS's found in the OLE container.
|
* Gives the total number of PPS's found in the OLE container.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return integer The total number of PPS's found in the OLE container
|
* @return integer The total number of PPS's found in the OLE container
|
||||||
*/
|
*/
|
||||||
public function ppsTotal()
|
public function ppsTotal()
|
||||||
{
|
{
|
||||||
return count($this->_list);
|
return count($this->_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets data from a PPS
|
* Gets data from a PPS
|
||||||
* If there is no PPS for the index given, it will return an empty string.
|
* If there is no PPS for the index given, it will return an empty string.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $index The index for the PPS
|
* @param integer $index The index for the PPS
|
||||||
* @param integer $position The position from which to start reading
|
* @param integer $position The position from which to start reading
|
||||||
* (relative to the PPS)
|
* (relative to the PPS)
|
||||||
* @param integer $length The amount of bytes to read (at most)
|
* @param integer $length The amount of bytes to read (at most)
|
||||||
* @return string The binary string containing the data requested
|
* @return string The binary string containing the data requested
|
||||||
* @see OLE_PPS_File::getStream()
|
* @see OLE_PPS_File::getStream()
|
||||||
*/
|
*/
|
||||||
public function getData($index, $position, $length)
|
public function getData($index, $position, $length)
|
||||||
{
|
{
|
||||||
// if position is not valid return empty string
|
// if position is not valid return empty string
|
||||||
if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) {
|
if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$fh = $this->getStream($this->_list[$index]);
|
$fh = $this->getStream($this->_list[$index]);
|
||||||
$data = stream_get_contents($fh, $length, $position);
|
$data = stream_get_contents($fh, $length, $position);
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the data length from a PPS
|
* Gets the data length from a PPS
|
||||||
* If there is no PPS for the index given, it will return 0.
|
* If there is no PPS for the index given, it will return 0.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $index The index for the PPS
|
* @param integer $index The index for the PPS
|
||||||
* @return integer The amount of bytes in data the PPS has
|
* @return integer The amount of bytes in data the PPS has
|
||||||
*/
|
*/
|
||||||
public function getDataLength($index)
|
public function getDataLength($index)
|
||||||
{
|
{
|
||||||
if (isset($this->_list[$index])) {
|
if (isset($this->_list[$index])) {
|
||||||
return $this->_list[$index]->Size;
|
return $this->_list[$index]->Size;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function to transform ASCII text to Unicode
|
* Utility function to transform ASCII text to Unicode
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @param string $ascii The ASCII string to transform
|
* @param string $ascii The ASCII string to transform
|
||||||
* @return string The string in Unicode
|
* @return string The string in Unicode
|
||||||
*/
|
*/
|
||||||
public static function Asc2Ucs($ascii)
|
public static function Asc2Ucs($ascii)
|
||||||
{
|
{
|
||||||
$rawname = '';
|
$rawname = '';
|
||||||
for ($i = 0; $i < strlen($ascii); ++$i) {
|
for ($i = 0; $i < strlen($ascii); ++$i) {
|
||||||
$rawname .= $ascii{$i} . "\x00";
|
$rawname .= $ascii{$i} . "\x00";
|
||||||
}
|
}
|
||||||
return $rawname;
|
return $rawname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function
|
* Utility function
|
||||||
* Returns a string for the OLE container with the date given
|
* Returns a string for the OLE container with the date given
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @param integer $date A timestamp
|
* @param integer $date A timestamp
|
||||||
* @return string The string for the OLE container
|
* @return string The string for the OLE container
|
||||||
*/
|
*/
|
||||||
public static function LocalDate2OLE($date = null)
|
public static function LocalDate2OLE($date = null)
|
||||||
{
|
{
|
||||||
if (!isset($date)) {
|
if (!isset($date)) {
|
||||||
return "\x00\x00\x00\x00\x00\x00\x00\x00";
|
return "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||||
}
|
}
|
||||||
|
|
||||||
// factor used for separating numbers into 4 bytes parts
|
// factor used for separating numbers into 4 bytes parts
|
||||||
$factor = pow(2, 32);
|
$factor = pow(2, 32);
|
||||||
|
|
||||||
// days from 1-1-1601 until the beggining of UNIX era
|
// days from 1-1-1601 until the beggining of UNIX era
|
||||||
$days = 134774;
|
$days = 134774;
|
||||||
// calculate seconds
|
// calculate seconds
|
||||||
$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$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));
|
date("m",$date),date("d",$date),date("Y",$date));
|
||||||
// multiply just to make MS happy
|
// multiply just to make MS happy
|
||||||
$big_date *= 10000000;
|
$big_date *= 10000000;
|
||||||
|
|
||||||
$high_part = floor($big_date / $factor);
|
$high_part = floor($big_date / $factor);
|
||||||
// lower 4 bytes
|
// lower 4 bytes
|
||||||
$low_part = floor((($big_date / $factor) - $high_part) * $factor);
|
$low_part = floor((($big_date / $factor) - $high_part) * $factor);
|
||||||
|
|
||||||
// Make HEX string
|
// Make HEX string
|
||||||
$res = '';
|
$res = '';
|
||||||
|
|
||||||
for ($i = 0; $i < 4; ++$i) {
|
for ($i = 0; $i < 4; ++$i) {
|
||||||
$hex = $low_part % 0x100;
|
$hex = $low_part % 0x100;
|
||||||
$res .= pack('c', $hex);
|
$res .= pack('c', $hex);
|
||||||
$low_part /= 0x100;
|
$low_part /= 0x100;
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < 4; ++$i) {
|
for ($i = 0; $i < 4; ++$i) {
|
||||||
$hex = $high_part % 0x100;
|
$hex = $high_part % 0x100;
|
||||||
$res .= pack('c', $hex);
|
$res .= pack('c', $hex);
|
||||||
$high_part /= 0x100;
|
$high_part /= 0x100;
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a timestamp from an OLE container's date
|
* Returns a timestamp from an OLE container's date
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @param integer $string A binary string with the encoded date
|
* @param integer $string A binary string with the encoded date
|
||||||
* @return string The timestamp corresponding to the string
|
* @return string The timestamp corresponding to the string
|
||||||
*/
|
*/
|
||||||
public static function OLE2LocalDate($string)
|
public static function OLE2LocalDate($string)
|
||||||
{
|
{
|
||||||
if (strlen($string) != 8) {
|
if (strlen($string) != 8) {
|
||||||
return new PEAR_Error("Expecting 8 byte string");
|
return new PEAR_Error("Expecting 8 byte string");
|
||||||
}
|
}
|
||||||
|
|
||||||
// factor used for separating numbers into 4 bytes parts
|
// 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(, $high_part) = unpack('V', substr($string, 4, 4));
|
||||||
list(, $low_part) = unpack('V', substr($string, 0, 4));
|
list(, $low_part) = unpack('V', substr($string, 0, 4));
|
||||||
|
|
||||||
$big_date = ($high_part * $factor) + $low_part;
|
$big_date = ($high_part * $factor) + $low_part;
|
||||||
// translate to seconds
|
// translate to seconds
|
||||||
$big_date /= 10000000;
|
$big_date /= 10000000;
|
||||||
|
|
||||||
// days from 1-1-1601 until the beggining of UNIX era
|
// days from 1-1-1601 until the beggining of UNIX era
|
||||||
$days = 134774;
|
$days = 134774;
|
||||||
|
|
||||||
// translate to seconds from beggining of UNIX era
|
// translate to seconds from beggining of UNIX era
|
||||||
$big_date -= $days * 24 * 3600;
|
$big_date -= $days * 24 * 3600;
|
||||||
return floor($big_date);
|
return floor($big_date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_OLE
|
* @package PHPExcel_Shared_OLE
|
||||||
* @copyright Copyright (c) 2006 - 2007 Christian Schmidt
|
* @copyright Copyright (c) 2006 - 2007 Christian Schmidt
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -37,186 +37,186 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_OLE_ChainedBlockStream
|
class PHPExcel_Shared_OLE_ChainedBlockStream
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The OLE container of the file that is being read.
|
* The OLE container of the file that is being read.
|
||||||
* @var OLE
|
* @var OLE
|
||||||
*/
|
*/
|
||||||
public $ole;
|
public $ole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameters specified by fopen().
|
* Parameters specified by fopen().
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $params;
|
public $params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The binary data of the file.
|
* The binary data of the file.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The file pointer.
|
* The file pointer.
|
||||||
* @var int byte offset
|
* @var int byte offset
|
||||||
*/
|
*/
|
||||||
public $pos;
|
public $pos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements support for fopen().
|
* Implements support for fopen().
|
||||||
* For creating streams using this wrapper, use OLE_PPS_File::getStream().
|
* For creating streams using this wrapper, use OLE_PPS_File::getStream().
|
||||||
*
|
*
|
||||||
* @param string $path resource name including scheme, e.g.
|
* @param string $path resource name including scheme, e.g.
|
||||||
* ole-chainedblockstream://oleInstanceId=1
|
* ole-chainedblockstream://oleInstanceId=1
|
||||||
* @param string $mode only "r" is supported
|
* @param string $mode only "r" is supported
|
||||||
* @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH
|
* @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH
|
||||||
* @param string &$openedPath absolute path of the opened stream (out parameter)
|
* @param string &$openedPath absolute path of the opened stream (out parameter)
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
public function stream_open($path, $mode, $options, &$openedPath)
|
public function stream_open($path, $mode, $options, &$openedPath)
|
||||||
{
|
{
|
||||||
if ($mode != 'r') {
|
if ($mode != 'r') {
|
||||||
if ($options & STREAM_REPORT_ERRORS) {
|
if ($options & STREAM_REPORT_ERRORS) {
|
||||||
trigger_error('Only reading is supported', E_USER_WARNING);
|
trigger_error('Only reading is supported', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 25 is length of "ole-chainedblockstream://"
|
// 25 is length of "ole-chainedblockstream://"
|
||||||
parse_str(substr($path, 25), $this->params);
|
parse_str(substr($path, 25), $this->params);
|
||||||
if (!isset($this->params['oleInstanceId'],
|
if (!isset($this->params['oleInstanceId'],
|
||||||
$this->params['blockId'],
|
$this->params['blockId'],
|
||||||
$GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
|
$GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
|
||||||
|
|
||||||
if ($options & STREAM_REPORT_ERRORS) {
|
if ($options & STREAM_REPORT_ERRORS) {
|
||||||
trigger_error('OLE stream not found', E_USER_WARNING);
|
trigger_error('OLE stream not found', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']];
|
$this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']];
|
||||||
|
|
||||||
$blockId = $this->params['blockId'];
|
$blockId = $this->params['blockId'];
|
||||||
$this->data = '';
|
$this->data = '';
|
||||||
if (isset($this->params['size']) &&
|
if (isset($this->params['size']) &&
|
||||||
$this->params['size'] < $this->ole->bigBlockThreshold &&
|
$this->params['size'] < $this->ole->bigBlockThreshold &&
|
||||||
$blockId != $this->ole->root->_StartBlock) {
|
$blockId != $this->ole->root->_StartBlock) {
|
||||||
|
|
||||||
// Block id refers to small blocks
|
// Block id refers to small blocks
|
||||||
$rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock);
|
$rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock);
|
||||||
while ($blockId != -2) {
|
while ($blockId != -2) {
|
||||||
$pos = $rootPos + $blockId * $this->ole->bigBlockSize;
|
$pos = $rootPos + $blockId * $this->ole->bigBlockSize;
|
||||||
$blockId = $this->ole->sbat[$blockId];
|
$blockId = $this->ole->sbat[$blockId];
|
||||||
fseek($this->ole->_file_handle, $pos);
|
fseek($this->ole->_file_handle, $pos);
|
||||||
$this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
|
$this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Block id refers to big blocks
|
// Block id refers to big blocks
|
||||||
while ($blockId != -2) {
|
while ($blockId != -2) {
|
||||||
$pos = $this->ole->_getBlockOffset($blockId);
|
$pos = $this->ole->_getBlockOffset($blockId);
|
||||||
fseek($this->ole->_file_handle, $pos);
|
fseek($this->ole->_file_handle, $pos);
|
||||||
$this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
|
$this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
|
||||||
$blockId = $this->ole->bbat[$blockId];
|
$blockId = $this->ole->bbat[$blockId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($this->params['size'])) {
|
if (isset($this->params['size'])) {
|
||||||
$this->data = substr($this->data, 0, $this->params['size']);
|
$this->data = substr($this->data, 0, $this->params['size']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options & STREAM_USE_PATH) {
|
if ($options & STREAM_USE_PATH) {
|
||||||
$openedPath = $path;
|
$openedPath = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements support for fclose().
|
* Implements support for fclose().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function stream_close()
|
public function stream_close()
|
||||||
{
|
{
|
||||||
$this->ole = null;
|
$this->ole = null;
|
||||||
unset($GLOBALS['_OLE_INSTANCES']);
|
unset($GLOBALS['_OLE_INSTANCES']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements support for fread(), fgets() etc.
|
* Implements support for fread(), fgets() etc.
|
||||||
*
|
*
|
||||||
* @param int $count maximum number of bytes to read
|
* @param int $count maximum number of bytes to read
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function stream_read($count)
|
public function stream_read($count)
|
||||||
{
|
{
|
||||||
if ($this->stream_eof()) {
|
if ($this->stream_eof()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$s = substr($this->data, $this->pos, $count);
|
$s = substr($this->data, $this->pos, $count);
|
||||||
$this->pos += $count;
|
$this->pos += $count;
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements support for feof().
|
* Implements support for feof().
|
||||||
*
|
*
|
||||||
* @return bool TRUE if the file pointer is at EOF; otherwise FALSE
|
* @return bool TRUE if the file pointer is at EOF; otherwise FALSE
|
||||||
*/
|
*/
|
||||||
public function stream_eof()
|
public function stream_eof()
|
||||||
{
|
{
|
||||||
return $this->pos >= strlen($this->data);
|
return $this->pos >= strlen($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the position of the file pointer, i.e. its offset into the file
|
* Returns the position of the file pointer, i.e. its offset into the file
|
||||||
* stream. Implements support for ftell().
|
* stream. Implements support for ftell().
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function stream_tell()
|
public function stream_tell()
|
||||||
{
|
{
|
||||||
return $this->pos;
|
return $this->pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements support for fseek().
|
* Implements support for fseek().
|
||||||
*
|
*
|
||||||
* @param int $offset byte offset
|
* @param int $offset byte offset
|
||||||
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
|
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function stream_seek($offset, $whence)
|
public function stream_seek($offset, $whence)
|
||||||
{
|
{
|
||||||
if ($whence == SEEK_SET && $offset >= 0) {
|
if ($whence == SEEK_SET && $offset >= 0) {
|
||||||
$this->pos = $offset;
|
$this->pos = $offset;
|
||||||
} elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
|
} elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
|
||||||
$this->pos += $offset;
|
$this->pos += $offset;
|
||||||
} elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) {
|
} elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) {
|
||||||
$this->pos = strlen($this->data) + $offset;
|
$this->pos = strlen($this->data) + $offset;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements support for fstat(). Currently the only supported field is
|
* Implements support for fstat(). Currently the only supported field is
|
||||||
* "size".
|
* "size".
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function stream_stat()
|
public function stream_stat()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'size' => strlen($this->data),
|
'size' => strlen($this->data),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methods used by stream_wrapper_register() that are not implemented:
|
// Methods used by stream_wrapper_register() that are not implemented:
|
||||||
// bool stream_flush ( void )
|
// bool stream_flush ( void )
|
||||||
// int stream_write ( string data )
|
// int stream_write ( string data )
|
||||||
// bool rename ( string path_from, string path_to )
|
// bool rename ( string path_from, string path_to )
|
||||||
// bool mkdir ( string path, int mode, int options )
|
// bool mkdir ( string path, int mode, int options )
|
||||||
// bool rmdir ( string path, int options )
|
// bool rmdir ( string path, int options )
|
||||||
// bool dir_opendir ( string path, int options )
|
// bool dir_opendir ( string path, int options )
|
||||||
// array url_stat ( string path, int flags )
|
// array url_stat ( string path, int flags )
|
||||||
// string dir_readdir ( void )
|
// string dir_readdir ( void )
|
||||||
// bool dir_rewinddir ( void )
|
// bool dir_rewinddir ( void )
|
||||||
// bool dir_closedir ( void )
|
// bool dir_closedir ( void )
|
||||||
}
|
}
|
||||||
|
@ -29,202 +29,202 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_OLE_PPS
|
class PHPExcel_Shared_OLE_PPS
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The PPS index
|
* The PPS index
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $No;
|
public $No;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PPS name (in Unicode)
|
* The PPS name (in Unicode)
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $Name;
|
public $Name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PPS type. Dir, Root or File
|
* The PPS type. Dir, Root or File
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $Type;
|
public $Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index of the previous PPS
|
* The index of the previous PPS
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $PrevPps;
|
public $PrevPps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index of the next PPS
|
* The index of the next PPS
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $NextPps;
|
public $NextPps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index of it's first child if this is a Dir or Root PPS
|
* The index of it's first child if this is a Dir or Root PPS
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $DirPps;
|
public $DirPps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A timestamp
|
* A timestamp
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $Time1st;
|
public $Time1st;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A timestamp
|
* A timestamp
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $Time2nd;
|
public $Time2nd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starting block (small or big) for this PPS's data inside the container
|
* Starting block (small or big) for this PPS's data inside the container
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $_StartBlock;
|
public $_StartBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size of the PPS's data (in bytes)
|
* The size of the PPS's data (in bytes)
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $Size;
|
public $Size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PPS's data (only used if it's not using a temporary file)
|
* The PPS's data (only used if it's not using a temporary file)
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $_data;
|
public $_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of child PPS's (only used by Root and Dir PPS's)
|
* Array of child PPS's (only used by Root and Dir PPS's)
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $children = array();
|
public $children = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pointer to OLE container
|
* Pointer to OLE container
|
||||||
* @var OLE
|
* @var OLE
|
||||||
*/
|
*/
|
||||||
public $ole;
|
public $ole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor
|
* The constructor
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $No The PPS index
|
* @param integer $No The PPS index
|
||||||
* @param string $name The PPS name
|
* @param string $name The PPS name
|
||||||
* @param integer $type The PPS type. Dir, Root or File
|
* @param integer $type The PPS type. Dir, Root or File
|
||||||
* @param integer $prev The index of the previous PPS
|
* @param integer $prev The index of the previous PPS
|
||||||
* @param integer $next The index of the next PPS
|
* @param integer $next The index of the next PPS
|
||||||
* @param integer $dir The index of it's first child if this is a Dir or Root PPS
|
* @param integer $dir The index of it's first child if this is a Dir or Root PPS
|
||||||
* @param integer $time_1st A timestamp
|
* @param integer $time_1st A timestamp
|
||||||
* @param integer $time_2nd A timestamp
|
* @param integer $time_2nd A timestamp
|
||||||
* @param string $data The (usually binary) source data of the PPS
|
* @param string $data The (usually binary) source data of the PPS
|
||||||
* @param array $children Array containing children PPS for this PPS
|
* @param array $children Array containing children PPS for this PPS
|
||||||
*/
|
*/
|
||||||
public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
|
public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
|
||||||
{
|
{
|
||||||
$this->No = $No;
|
$this->No = $No;
|
||||||
$this->Name = $name;
|
$this->Name = $name;
|
||||||
$this->Type = $type;
|
$this->Type = $type;
|
||||||
$this->PrevPps = $prev;
|
$this->PrevPps = $prev;
|
||||||
$this->NextPps = $next;
|
$this->NextPps = $next;
|
||||||
$this->DirPps = $dir;
|
$this->DirPps = $dir;
|
||||||
$this->Time1st = $time_1st;
|
$this->Time1st = $time_1st;
|
||||||
$this->Time2nd = $time_2nd;
|
$this->Time2nd = $time_2nd;
|
||||||
$this->_data = $data;
|
$this->_data = $data;
|
||||||
$this->children = $children;
|
$this->children = $children;
|
||||||
if ($data != '') {
|
if ($data != '') {
|
||||||
$this->Size = strlen($data);
|
$this->Size = strlen($data);
|
||||||
} else {
|
} else {
|
||||||
$this->Size = 0;
|
$this->Size = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of data saved for this PPS
|
* Returns the amount of data saved for this PPS
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return integer The amount of data (in bytes)
|
* @return integer The amount of data (in bytes)
|
||||||
*/
|
*/
|
||||||
public function _DataLen()
|
public function _DataLen()
|
||||||
{
|
{
|
||||||
if (!isset($this->_data)) {
|
if (!isset($this->_data)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//if (isset($this->_PPS_FILE)) {
|
//if (isset($this->_PPS_FILE)) {
|
||||||
// fseek($this->_PPS_FILE, 0);
|
// fseek($this->_PPS_FILE, 0);
|
||||||
// $stats = fstat($this->_PPS_FILE);
|
// $stats = fstat($this->_PPS_FILE);
|
||||||
// return $stats[7];
|
// return $stats[7];
|
||||||
//} else {
|
//} else {
|
||||||
return strlen($this->_data);
|
return strlen($this->_data);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string with the PPS's WK (What is a WK?)
|
* Returns a string with the PPS's WK (What is a WK?)
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return string The binary string
|
* @return string The binary string
|
||||||
*/
|
*/
|
||||||
public function _getPpsWk()
|
public function _getPpsWk()
|
||||||
{
|
{
|
||||||
$ret = str_pad($this->Name,64,"\x00");
|
$ret = str_pad($this->Name,64,"\x00");
|
||||||
|
|
||||||
$ret .= pack("v", strlen($this->Name) + 2) // 66
|
$ret .= pack("v", strlen($this->Name) + 2) // 66
|
||||||
. pack("c", $this->Type) // 67
|
. pack("c", $this->Type) // 67
|
||||||
. pack("c", 0x00) //UK // 68
|
. pack("c", 0x00) //UK // 68
|
||||||
. pack("V", $this->PrevPps) //Prev // 72
|
. pack("V", $this->PrevPps) //Prev // 72
|
||||||
. pack("V", $this->NextPps) //Next // 76
|
. pack("V", $this->NextPps) //Next // 76
|
||||||
. pack("V", $this->DirPps) //Dir // 80
|
. pack("V", $this->DirPps) //Dir // 80
|
||||||
. "\x00\x09\x02\x00" // 84
|
. "\x00\x09\x02\x00" // 84
|
||||||
. "\x00\x00\x00\x00" // 88
|
. "\x00\x00\x00\x00" // 88
|
||||||
. "\xc0\x00\x00\x00" // 92
|
. "\xc0\x00\x00\x00" // 92
|
||||||
. "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
|
. "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
|
||||||
. "\x00\x00\x00\x00" // 100
|
. "\x00\x00\x00\x00" // 100
|
||||||
. PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
|
. PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
|
||||||
. PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
|
. PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
|
||||||
. pack("V", isset($this->_StartBlock)?
|
. pack("V", isset($this->_StartBlock)?
|
||||||
$this->_StartBlock:0) // 120
|
$this->_StartBlock:0) // 120
|
||||||
. pack("V", $this->Size) // 124
|
. pack("V", $this->Size) // 124
|
||||||
. pack("V", 0); // 128
|
. pack("V", 0); // 128
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates index and pointers to previous, next and children PPS's for this
|
* Updates index and pointers to previous, next and children PPS's for this
|
||||||
* PPS. I don't think it'll work with Dir PPS's.
|
* PPS. I don't think it'll work with Dir PPS's.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array &$raList Reference to the array of PPS's for the whole OLE
|
* @param array &$raList Reference to the array of PPS's for the whole OLE
|
||||||
* container
|
* container
|
||||||
* @return integer The index for this PPS
|
* @return integer The index for this PPS
|
||||||
*/
|
*/
|
||||||
public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
|
public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
|
||||||
{
|
{
|
||||||
if ( !is_array($to_save) || (empty($to_save)) ) {
|
if ( !is_array($to_save) || (empty($to_save)) ) {
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
} elseif( count($to_save) == 1 ) {
|
} elseif( count($to_save) == 1 ) {
|
||||||
$cnt = count($raList);
|
$cnt = count($raList);
|
||||||
// If the first entry, it's the root... Don't clone it!
|
// If the first entry, it's the root... Don't clone it!
|
||||||
$raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
|
$raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
|
||||||
$raList[$cnt]->No = $cnt;
|
$raList[$cnt]->No = $cnt;
|
||||||
$raList[$cnt]->PrevPps = 0xFFFFFFFF;
|
$raList[$cnt]->PrevPps = 0xFFFFFFFF;
|
||||||
$raList[$cnt]->NextPps = 0xFFFFFFFF;
|
$raList[$cnt]->NextPps = 0xFFFFFFFF;
|
||||||
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
|
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
|
||||||
} else {
|
} else {
|
||||||
$iPos = floor(count($to_save) / 2);
|
$iPos = floor(count($to_save) / 2);
|
||||||
$aPrev = array_slice($to_save, 0, $iPos);
|
$aPrev = array_slice($to_save, 0, $iPos);
|
||||||
$aNext = array_slice($to_save, $iPos + 1);
|
$aNext = array_slice($to_save, $iPos + 1);
|
||||||
$cnt = count($raList);
|
$cnt = count($raList);
|
||||||
// If the first entry, it's the root... Don't clone it!
|
// If the first entry, it's the root... Don't clone it!
|
||||||
$raList[$cnt] = ( $depth == 0 ) ? $to_save[$iPos] : clone $to_save[$iPos];
|
$raList[$cnt] = ( $depth == 0 ) ? $to_save[$iPos] : clone $to_save[$iPos];
|
||||||
$raList[$cnt]->No = $cnt;
|
$raList[$cnt]->No = $cnt;
|
||||||
$raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
|
$raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
|
||||||
$raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
|
$raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
|
||||||
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
|
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
|
||||||
|
|
||||||
}
|
}
|
||||||
return $cnt;
|
return $cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,57 +28,57 @@
|
|||||||
* @package PHPExcel_Shared_OLE
|
* @package PHPExcel_Shared_OLE
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
|
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The constructor
|
* The constructor
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $name The name of the file (in Unicode)
|
* @param string $name The name of the file (in Unicode)
|
||||||
* @see OLE::Asc2Ucs()
|
* @see OLE::Asc2Ucs()
|
||||||
*/
|
*/
|
||||||
public function __construct($name)
|
public function __construct($name)
|
||||||
{
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
null,
|
null,
|
||||||
$name,
|
$name,
|
||||||
PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
|
PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
'',
|
'',
|
||||||
array());
|
array());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization method. Has to be called right after OLE_PPS_File().
|
* Initialization method. Has to be called right after OLE_PPS_File().
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return mixed true on success
|
* @return mixed true on success
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append data to PPS
|
* Append data to PPS
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $data The data to append
|
* @param string $data The data to append
|
||||||
*/
|
*/
|
||||||
public function append($data)
|
public function append($data)
|
||||||
{
|
{
|
||||||
$this->_data .= $data;
|
$this->_data .= $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a stream for reading this file using fread() etc.
|
* Returns a stream for reading this file using fread() etc.
|
||||||
* @return resource a read-only stream
|
* @return resource a read-only stream
|
||||||
*/
|
*/
|
||||||
public function getStream()
|
public function getStream()
|
||||||
{
|
{
|
||||||
$this->ole->getStream($this);
|
$this->ole->getStream($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,440 +28,440 @@
|
|||||||
* @package PHPExcel_Shared_OLE
|
* @package PHPExcel_Shared_OLE
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory for temporary files
|
* Directory for temporary files
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_tmp_dir = NULL;
|
protected $_tmp_dir = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer $time_1st A timestamp
|
* @param integer $time_1st A timestamp
|
||||||
* @param integer $time_2nd A timestamp
|
* @param integer $time_2nd A timestamp
|
||||||
*/
|
*/
|
||||||
public function __construct($time_1st, $time_2nd, $raChild)
|
public function __construct($time_1st, $time_2nd, $raChild)
|
||||||
{
|
{
|
||||||
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
|
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
null,
|
null,
|
||||||
PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'),
|
PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'),
|
||||||
PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT,
|
PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$time_1st,
|
$time_1st,
|
||||||
$time_2nd,
|
$time_2nd,
|
||||||
null,
|
null,
|
||||||
$raChild);
|
$raChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for saving the whole OLE container (including files).
|
* Method for saving the whole OLE container (including files).
|
||||||
* In fact, if called with an empty argument (or '-'), it saves to a
|
* In fact, if called with an empty argument (or '-'), it saves to a
|
||||||
* temporary file and then outputs it's contents to stdout.
|
* temporary file and then outputs it's contents to stdout.
|
||||||
* If a resource pointer to a stream created by fopen() is passed
|
* If a resource pointer to a stream created by fopen() is passed
|
||||||
* it will be used, but you have to close such stream by yourself.
|
* it will be used, but you have to close such stream by yourself.
|
||||||
*
|
*
|
||||||
* @param string|resource $filename The name of the file or stream where to save the OLE container.
|
* @param string|resource $filename The name of the file or stream where to save the OLE container.
|
||||||
* @access public
|
* @access public
|
||||||
* @return mixed true on success
|
* @return mixed true on success
|
||||||
*/
|
*/
|
||||||
public function save($filename)
|
public function save($filename)
|
||||||
{
|
{
|
||||||
// Initial Setting for saving
|
// Initial Setting for saving
|
||||||
$this->_BIG_BLOCK_SIZE = pow(2,
|
$this->_BIG_BLOCK_SIZE = pow(2,
|
||||||
((isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9));
|
((isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9));
|
||||||
$this->_SMALL_BLOCK_SIZE= pow(2,
|
$this->_SMALL_BLOCK_SIZE= pow(2,
|
||||||
((isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE): 6));
|
((isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE): 6));
|
||||||
|
|
||||||
if (is_resource($filename)) {
|
if (is_resource($filename)) {
|
||||||
$this->_FILEH_ = $filename;
|
$this->_FILEH_ = $filename;
|
||||||
} else if ($filename == '-' || $filename == '') {
|
} else if ($filename == '-' || $filename == '') {
|
||||||
if ($this->_tmp_dir === NULL)
|
if ($this->_tmp_dir === NULL)
|
||||||
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
|
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
|
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
|
||||||
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b");
|
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b");
|
||||||
if ($this->_FILEH_ == false) {
|
if ($this->_FILEH_ == false) {
|
||||||
throw new PHPExcel_Writer_Exception("Can't create temporary file.");
|
throw new PHPExcel_Writer_Exception("Can't create temporary file.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_FILEH_ = fopen($filename, "wb");
|
$this->_FILEH_ = fopen($filename, "wb");
|
||||||
}
|
}
|
||||||
if ($this->_FILEH_ == false) {
|
if ($this->_FILEH_ == false) {
|
||||||
throw new PHPExcel_Writer_Exception("Can't open $filename. It may be in use or protected.");
|
throw new PHPExcel_Writer_Exception("Can't open $filename. It may be in use or protected.");
|
||||||
}
|
}
|
||||||
// Make an array of PPS's (for Save)
|
// Make an array of PPS's (for Save)
|
||||||
$aList = array();
|
$aList = array();
|
||||||
PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this));
|
PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this));
|
||||||
// calculate values for header
|
// calculate values for header
|
||||||
list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
|
list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
|
||||||
// Save Header
|
// Save Header
|
||||||
$this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);
|
$this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);
|
||||||
|
|
||||||
// Make Small Data string (write SBD)
|
// Make Small Data string (write SBD)
|
||||||
$this->_data = $this->_makeSmallData($aList);
|
$this->_data = $this->_makeSmallData($aList);
|
||||||
|
|
||||||
// Write BB
|
// Write BB
|
||||||
$this->_saveBigData($iSBDcnt, $aList);
|
$this->_saveBigData($iSBDcnt, $aList);
|
||||||
// Write PPS
|
// Write PPS
|
||||||
$this->_savePps($aList);
|
$this->_savePps($aList);
|
||||||
// Write Big Block Depot and BDList and Adding Header informations
|
// Write Big Block Depot and BDList and Adding Header informations
|
||||||
$this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
|
$this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
|
||||||
|
|
||||||
if (!is_resource($filename)) {
|
if (!is_resource($filename)) {
|
||||||
fclose($this->_FILEH_);
|
fclose($this->_FILEH_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate some numbers
|
* Calculate some numbers
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $raList Reference to an array of PPS's
|
* @param array $raList Reference to an array of PPS's
|
||||||
* @return array The array of numbers
|
* @return array The array of numbers
|
||||||
*/
|
*/
|
||||||
public function _calcSize(&$raList)
|
public function _calcSize(&$raList)
|
||||||
{
|
{
|
||||||
// Calculate Basic Setting
|
// Calculate Basic Setting
|
||||||
list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
|
list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
|
||||||
$iSmallLen = 0;
|
$iSmallLen = 0;
|
||||||
$iSBcnt = 0;
|
$iSBcnt = 0;
|
||||||
$iCount = count($raList);
|
$iCount = count($raList);
|
||||||
for ($i = 0; $i < $iCount; ++$i) {
|
for ($i = 0; $i < $iCount; ++$i) {
|
||||||
if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
|
if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
|
||||||
$raList[$i]->Size = $raList[$i]->_DataLen();
|
$raList[$i]->Size = $raList[$i]->_DataLen();
|
||||||
if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
|
if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
|
||||||
$iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
$iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
||||||
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
|
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
|
||||||
} else {
|
} else {
|
||||||
$iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
|
$iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
|
||||||
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
|
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
|
$iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
|
||||||
$iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
|
$iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
|
||||||
$iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
|
$iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
|
||||||
$iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
|
$iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
|
||||||
(( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
|
(( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
|
||||||
$iCnt = count($raList);
|
$iCnt = count($raList);
|
||||||
$iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
|
$iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
|
||||||
$iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
|
$iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
|
||||||
|
|
||||||
return array($iSBDcnt, $iBBcnt, $iPPScnt);
|
return array($iSBDcnt, $iBBcnt, $iPPScnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for caculating a magic value for block sizes
|
* Helper function for caculating a magic value for block sizes
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $i2 The argument
|
* @param integer $i2 The argument
|
||||||
* @see save()
|
* @see save()
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
private static function _adjust2($i2)
|
private static function _adjust2($i2)
|
||||||
{
|
{
|
||||||
$iWk = log($i2)/log(2);
|
$iWk = log($i2)/log(2);
|
||||||
return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
|
return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save OLE header
|
* Save OLE header
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $iSBDcnt
|
* @param integer $iSBDcnt
|
||||||
* @param integer $iBBcnt
|
* @param integer $iBBcnt
|
||||||
* @param integer $iPPScnt
|
* @param integer $iPPScnt
|
||||||
*/
|
*/
|
||||||
public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
|
public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
|
||||||
{
|
{
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->_FILEH_;
|
||||||
|
|
||||||
// Calculate Basic Setting
|
// Calculate Basic Setting
|
||||||
$iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
$iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
||||||
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
||||||
|
|
||||||
$iBdExL = 0;
|
$iBdExL = 0;
|
||||||
$iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
|
$iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
|
||||||
$iAllW = $iAll;
|
$iAllW = $iAll;
|
||||||
$iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
|
$iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
|
||||||
$iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
|
$iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
|
||||||
|
|
||||||
// Calculate BD count
|
// Calculate BD count
|
||||||
if ($iBdCnt > $i1stBdL) {
|
if ($iBdCnt > $i1stBdL) {
|
||||||
while (1) {
|
while (1) {
|
||||||
++$iBdExL;
|
++$iBdExL;
|
||||||
++$iAllW;
|
++$iAllW;
|
||||||
$iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
|
$iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
|
||||||
$iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
|
$iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
|
||||||
if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
|
if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save Header
|
// Save Header
|
||||||
fwrite($FILE,
|
fwrite($FILE,
|
||||||
"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
|
"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
|
||||||
. "\x00\x00\x00\x00"
|
. "\x00\x00\x00\x00"
|
||||||
. "\x00\x00\x00\x00"
|
. "\x00\x00\x00\x00"
|
||||||
. "\x00\x00\x00\x00"
|
. "\x00\x00\x00\x00"
|
||||||
. "\x00\x00\x00\x00"
|
. "\x00\x00\x00\x00"
|
||||||
. pack("v", 0x3b)
|
. pack("v", 0x3b)
|
||||||
. pack("v", 0x03)
|
. pack("v", 0x03)
|
||||||
. pack("v", -2)
|
. pack("v", -2)
|
||||||
. pack("v", 9)
|
. pack("v", 9)
|
||||||
. pack("v", 6)
|
. pack("v", 6)
|
||||||
. pack("v", 0)
|
. pack("v", 0)
|
||||||
. "\x00\x00\x00\x00"
|
. "\x00\x00\x00\x00"
|
||||||
. "\x00\x00\x00\x00"
|
. "\x00\x00\x00\x00"
|
||||||
. pack("V", $iBdCnt)
|
. pack("V", $iBdCnt)
|
||||||
. pack("V", $iBBcnt+$iSBDcnt) //ROOT START
|
. pack("V", $iBBcnt+$iSBDcnt) //ROOT START
|
||||||
. pack("V", 0)
|
. pack("V", 0)
|
||||||
. pack("V", 0x1000)
|
. pack("V", 0x1000)
|
||||||
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
|
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
|
||||||
. pack("V", $iSBDcnt)
|
. pack("V", $iSBDcnt)
|
||||||
);
|
);
|
||||||
// Extra BDList Start, Count
|
// Extra BDList Start, Count
|
||||||
if ($iBdCnt < $i1stBdL) {
|
if ($iBdCnt < $i1stBdL) {
|
||||||
fwrite($FILE,
|
fwrite($FILE,
|
||||||
pack("V", -2) // Extra BDList Start
|
pack("V", -2) // Extra BDList Start
|
||||||
. pack("V", 0) // Extra BDList Count
|
. pack("V", 0) // Extra BDList Count
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
|
fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
|
||||||
}
|
}
|
||||||
|
|
||||||
// BDList
|
// BDList
|
||||||
for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
|
for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
|
||||||
fwrite($FILE, pack("V", $iAll+$i));
|
fwrite($FILE, pack("V", $iAll+$i));
|
||||||
}
|
}
|
||||||
if ($i < $i1stBdL) {
|
if ($i < $i1stBdL) {
|
||||||
$jB = $i1stBdL - $i;
|
$jB = $i1stBdL - $i;
|
||||||
for ($j = 0; $j < $jB; ++$j) {
|
for ($j = 0; $j < $jB; ++$j) {
|
||||||
fwrite($FILE, (pack("V", -1)));
|
fwrite($FILE, (pack("V", -1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
|
* Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $iStBlk
|
* @param integer $iStBlk
|
||||||
* @param array &$raList Reference to array of PPS's
|
* @param array &$raList Reference to array of PPS's
|
||||||
*/
|
*/
|
||||||
public function _saveBigData($iStBlk, &$raList)
|
public function _saveBigData($iStBlk, &$raList)
|
||||||
{
|
{
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->_FILEH_;
|
||||||
|
|
||||||
// cycle through PPS's
|
// cycle through PPS's
|
||||||
$iCount = count($raList);
|
$iCount = count($raList);
|
||||||
for ($i = 0; $i < $iCount; ++$i) {
|
for ($i = 0; $i < $iCount; ++$i) {
|
||||||
if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
|
if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
|
||||||
$raList[$i]->Size = $raList[$i]->_DataLen();
|
$raList[$i]->Size = $raList[$i]->_DataLen();
|
||||||
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) ||
|
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) ||
|
||||||
(($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
|
(($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
|
||||||
{
|
{
|
||||||
// Write Data
|
// Write Data
|
||||||
//if (isset($raList[$i]->_PPS_FILE)) {
|
//if (isset($raList[$i]->_PPS_FILE)) {
|
||||||
// $iLen = 0;
|
// $iLen = 0;
|
||||||
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
|
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
|
||||||
// while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
// while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
||||||
// $iLen += strlen($sBuff);
|
// $iLen += strlen($sBuff);
|
||||||
// fwrite($FILE, $sBuff);
|
// fwrite($FILE, $sBuff);
|
||||||
// }
|
// }
|
||||||
//} else {
|
//} else {
|
||||||
fwrite($FILE, $raList[$i]->_data);
|
fwrite($FILE, $raList[$i]->_data);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
|
if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
|
||||||
fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
|
fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
|
||||||
}
|
}
|
||||||
// Set For PPS
|
// Set For PPS
|
||||||
$raList[$i]->_StartBlock = $iStBlk;
|
$raList[$i]->_StartBlock = $iStBlk;
|
||||||
$iStBlk +=
|
$iStBlk +=
|
||||||
(floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
|
(floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
|
||||||
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
|
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
|
||||||
}
|
}
|
||||||
// Close file for each PPS, and unlink it
|
// Close file for each PPS, and unlink it
|
||||||
//if (isset($raList[$i]->_PPS_FILE)) {
|
//if (isset($raList[$i]->_PPS_FILE)) {
|
||||||
// fclose($raList[$i]->_PPS_FILE);
|
// fclose($raList[$i]->_PPS_FILE);
|
||||||
// $raList[$i]->_PPS_FILE = null;
|
// $raList[$i]->_PPS_FILE = null;
|
||||||
// unlink($raList[$i]->_tmp_filename);
|
// unlink($raList[$i]->_tmp_filename);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
|
* get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array &$raList Reference to array of PPS's
|
* @param array &$raList Reference to array of PPS's
|
||||||
*/
|
*/
|
||||||
public function _makeSmallData(&$raList)
|
public function _makeSmallData(&$raList)
|
||||||
{
|
{
|
||||||
$sRes = '';
|
$sRes = '';
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->_FILEH_;
|
||||||
$iSmBlk = 0;
|
$iSmBlk = 0;
|
||||||
|
|
||||||
$iCount = count($raList);
|
$iCount = count($raList);
|
||||||
for ($i = 0; $i < $iCount; ++$i) {
|
for ($i = 0; $i < $iCount; ++$i) {
|
||||||
// Make SBD, small data string
|
// Make SBD, small data string
|
||||||
if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
|
if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
|
||||||
if ($raList[$i]->Size <= 0) {
|
if ($raList[$i]->Size <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
|
if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
|
||||||
$iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
$iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
||||||
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
|
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
|
||||||
// Add to SBD
|
// Add to SBD
|
||||||
$jB = $iSmbCnt - 1;
|
$jB = $iSmbCnt - 1;
|
||||||
for ($j = 0; $j < $jB; ++$j) {
|
for ($j = 0; $j < $jB; ++$j) {
|
||||||
fwrite($FILE, pack("V", $j+$iSmBlk+1));
|
fwrite($FILE, pack("V", $j+$iSmBlk+1));
|
||||||
}
|
}
|
||||||
fwrite($FILE, pack("V", -2));
|
fwrite($FILE, pack("V", -2));
|
||||||
|
|
||||||
//// Add to Data String(this will be written for RootEntry)
|
//// Add to Data String(this will be written for RootEntry)
|
||||||
//if ($raList[$i]->_PPS_FILE) {
|
//if ($raList[$i]->_PPS_FILE) {
|
||||||
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
|
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
|
||||||
// while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
// while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
||||||
// $sRes .= $sBuff;
|
// $sRes .= $sBuff;
|
||||||
// }
|
// }
|
||||||
//} else {
|
//} else {
|
||||||
$sRes .= $raList[$i]->_data;
|
$sRes .= $raList[$i]->_data;
|
||||||
//}
|
//}
|
||||||
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
|
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
|
||||||
$sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
$sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
||||||
}
|
}
|
||||||
// Set for PPS
|
// Set for PPS
|
||||||
$raList[$i]->_StartBlock = $iSmBlk;
|
$raList[$i]->_StartBlock = $iSmBlk;
|
||||||
$iSmBlk += $iSmbCnt;
|
$iSmBlk += $iSmbCnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
|
$iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
|
||||||
if ($iSmBlk % $iSbCnt) {
|
if ($iSmBlk % $iSbCnt) {
|
||||||
$iB = $iSbCnt - ($iSmBlk % $iSbCnt);
|
$iB = $iSbCnt - ($iSmBlk % $iSbCnt);
|
||||||
for ($i = 0; $i < $iB; ++$i) {
|
for ($i = 0; $i < $iB; ++$i) {
|
||||||
fwrite($FILE, pack("V", -1));
|
fwrite($FILE, pack("V", -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $sRes;
|
return $sRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves all the PPS's WKs
|
* Saves all the PPS's WKs
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $raList Reference to an array with all PPS's
|
* @param array $raList Reference to an array with all PPS's
|
||||||
*/
|
*/
|
||||||
public function _savePps(&$raList)
|
public function _savePps(&$raList)
|
||||||
{
|
{
|
||||||
// Save each PPS WK
|
// Save each PPS WK
|
||||||
$iC = count($raList);
|
$iC = count($raList);
|
||||||
for ($i = 0; $i < $iC; ++$i) {
|
for ($i = 0; $i < $iC; ++$i) {
|
||||||
fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
|
fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
|
||||||
}
|
}
|
||||||
// Adjust for Block
|
// Adjust for Block
|
||||||
$iCnt = count($raList);
|
$iCnt = count($raList);
|
||||||
$iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
|
$iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
|
||||||
if ($iCnt % $iBCnt) {
|
if ($iCnt % $iBCnt) {
|
||||||
fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
|
fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saving Big Block Depot
|
* Saving Big Block Depot
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $iSbdSize
|
* @param integer $iSbdSize
|
||||||
* @param integer $iBsize
|
* @param integer $iBsize
|
||||||
* @param integer $iPpsCnt
|
* @param integer $iPpsCnt
|
||||||
*/
|
*/
|
||||||
public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
|
public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
|
||||||
{
|
{
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->_FILEH_;
|
||||||
// Calculate Basic Setting
|
// Calculate Basic Setting
|
||||||
$iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
$iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
||||||
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
|
||||||
|
|
||||||
$iBdExL = 0;
|
$iBdExL = 0;
|
||||||
$iAll = $iBsize + $iPpsCnt + $iSbdSize;
|
$iAll = $iBsize + $iPpsCnt + $iSbdSize;
|
||||||
$iAllW = $iAll;
|
$iAllW = $iAll;
|
||||||
$iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
|
$iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
|
||||||
$iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
|
$iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
|
||||||
// Calculate BD count
|
// Calculate BD count
|
||||||
if ($iBdCnt >$i1stBdL) {
|
if ($iBdCnt >$i1stBdL) {
|
||||||
while (1) {
|
while (1) {
|
||||||
++$iBdExL;
|
++$iBdExL;
|
||||||
++$iAllW;
|
++$iAllW;
|
||||||
$iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
|
$iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
|
||||||
$iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
|
$iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
|
||||||
if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
|
if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Making BD
|
// Making BD
|
||||||
// Set for SBD
|
// Set for SBD
|
||||||
if ($iSbdSize > 0) {
|
if ($iSbdSize > 0) {
|
||||||
for ($i = 0; $i < ($iSbdSize - 1); ++$i) {
|
for ($i = 0; $i < ($iSbdSize - 1); ++$i) {
|
||||||
fwrite($FILE, pack("V", $i+1));
|
fwrite($FILE, pack("V", $i+1));
|
||||||
}
|
}
|
||||||
fwrite($FILE, pack("V", -2));
|
fwrite($FILE, pack("V", -2));
|
||||||
}
|
}
|
||||||
// Set for B
|
// Set for B
|
||||||
for ($i = 0; $i < ($iBsize - 1); ++$i) {
|
for ($i = 0; $i < ($iBsize - 1); ++$i) {
|
||||||
fwrite($FILE, pack("V", $i+$iSbdSize+1));
|
fwrite($FILE, pack("V", $i+$iSbdSize+1));
|
||||||
}
|
}
|
||||||
fwrite($FILE, pack("V", -2));
|
fwrite($FILE, pack("V", -2));
|
||||||
|
|
||||||
// Set for PPS
|
// Set for PPS
|
||||||
for ($i = 0; $i < ($iPpsCnt - 1); ++$i) {
|
for ($i = 0; $i < ($iPpsCnt - 1); ++$i) {
|
||||||
fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
|
fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
|
||||||
}
|
}
|
||||||
fwrite($FILE, pack("V", -2));
|
fwrite($FILE, pack("V", -2));
|
||||||
// Set for BBD itself ( 0xFFFFFFFD : BBD)
|
// Set for BBD itself ( 0xFFFFFFFD : BBD)
|
||||||
for ($i = 0; $i < $iBdCnt; ++$i) {
|
for ($i = 0; $i < $iBdCnt; ++$i) {
|
||||||
fwrite($FILE, pack("V", 0xFFFFFFFD));
|
fwrite($FILE, pack("V", 0xFFFFFFFD));
|
||||||
}
|
}
|
||||||
// Set for ExtraBDList
|
// Set for ExtraBDList
|
||||||
for ($i = 0; $i < $iBdExL; ++$i) {
|
for ($i = 0; $i < $iBdExL; ++$i) {
|
||||||
fwrite($FILE, pack("V", 0xFFFFFFFC));
|
fwrite($FILE, pack("V", 0xFFFFFFFC));
|
||||||
}
|
}
|
||||||
// Adjust for Block
|
// Adjust for Block
|
||||||
if (($iAllW + $iBdCnt) % $iBbCnt) {
|
if (($iAllW + $iBdCnt) % $iBbCnt) {
|
||||||
$iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt));
|
$iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt));
|
||||||
for ($i = 0; $i < $iBlock; ++$i) {
|
for ($i = 0; $i < $iBlock; ++$i) {
|
||||||
fwrite($FILE, pack("V", -1));
|
fwrite($FILE, pack("V", -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra BDList
|
// Extra BDList
|
||||||
if ($iBdCnt > $i1stBdL) {
|
if ($iBdCnt > $i1stBdL) {
|
||||||
$iN=0;
|
$iN=0;
|
||||||
$iNb=0;
|
$iNb=0;
|
||||||
for ($i = $i1stBdL;$i < $iBdCnt; $i++, ++$iN) {
|
for ($i = $i1stBdL;$i < $iBdCnt; $i++, ++$iN) {
|
||||||
if ($iN >= ($iBbCnt - 1)) {
|
if ($iN >= ($iBbCnt - 1)) {
|
||||||
$iN = 0;
|
$iN = 0;
|
||||||
++$iNb;
|
++$iNb;
|
||||||
fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
|
fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
|
||||||
}
|
}
|
||||||
fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
|
fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
|
||||||
}
|
}
|
||||||
if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
|
if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
|
||||||
$iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
|
$iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
|
||||||
for ($i = 0; $i < $iB; ++$i) {
|
for ($i = 0; $i < $iB; ++$i) {
|
||||||
fwrite($FILE, pack("V", -1));
|
fwrite($FILE, pack("V", -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fwrite($FILE, pack("V", -2));
|
fwrite($FILE, pack("V", -2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -29,289 +29,289 @@ defined('IDENTIFIER_OLE') ||
|
|||||||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
|
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
|
||||||
|
|
||||||
class PHPExcel_Shared_OLERead {
|
class PHPExcel_Shared_OLERead {
|
||||||
private $data = '';
|
private $data = '';
|
||||||
|
|
||||||
// OLE identifier
|
// OLE identifier
|
||||||
const IDENTIFIER_OLE = IDENTIFIER_OLE;
|
const IDENTIFIER_OLE = IDENTIFIER_OLE;
|
||||||
|
|
||||||
// Size of a sector = 512 bytes
|
// Size of a sector = 512 bytes
|
||||||
const BIG_BLOCK_SIZE = 0x200;
|
const BIG_BLOCK_SIZE = 0x200;
|
||||||
|
|
||||||
// Size of a short sector = 64 bytes
|
// Size of a short sector = 64 bytes
|
||||||
const SMALL_BLOCK_SIZE = 0x40;
|
const SMALL_BLOCK_SIZE = 0x40;
|
||||||
|
|
||||||
// Size of a directory entry always = 128 bytes
|
// Size of a directory entry always = 128 bytes
|
||||||
const PROPERTY_STORAGE_BLOCK_SIZE = 0x80;
|
const PROPERTY_STORAGE_BLOCK_SIZE = 0x80;
|
||||||
|
|
||||||
// Minimum size of a standard stream = 4096 bytes, streams smaller than this are stored as short streams
|
// Minimum size of a standard stream = 4096 bytes, streams smaller than this are stored as short streams
|
||||||
const SMALL_BLOCK_THRESHOLD = 0x1000;
|
const SMALL_BLOCK_THRESHOLD = 0x1000;
|
||||||
|
|
||||||
// header offsets
|
// header offsets
|
||||||
const NUM_BIG_BLOCK_DEPOT_BLOCKS_POS = 0x2c;
|
const NUM_BIG_BLOCK_DEPOT_BLOCKS_POS = 0x2c;
|
||||||
const ROOT_START_BLOCK_POS = 0x30;
|
const ROOT_START_BLOCK_POS = 0x30;
|
||||||
const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c;
|
const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c;
|
||||||
const EXTENSION_BLOCK_POS = 0x44;
|
const EXTENSION_BLOCK_POS = 0x44;
|
||||||
const NUM_EXTENSION_BLOCK_POS = 0x48;
|
const NUM_EXTENSION_BLOCK_POS = 0x48;
|
||||||
const BIG_BLOCK_DEPOT_BLOCKS_POS = 0x4c;
|
const BIG_BLOCK_DEPOT_BLOCKS_POS = 0x4c;
|
||||||
|
|
||||||
// property storage offsets (directory offsets)
|
// property storage offsets (directory offsets)
|
||||||
const SIZE_OF_NAME_POS = 0x40;
|
const SIZE_OF_NAME_POS = 0x40;
|
||||||
const TYPE_POS = 0x42;
|
const TYPE_POS = 0x42;
|
||||||
const START_BLOCK_POS = 0x74;
|
const START_BLOCK_POS = 0x74;
|
||||||
const SIZE_POS = 0x78;
|
const SIZE_POS = 0x78;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public $wrkbook = null;
|
public $wrkbook = null;
|
||||||
public $summaryInformation = null;
|
public $summaryInformation = null;
|
||||||
public $documentSummaryInformation = null;
|
public $documentSummaryInformation = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the file
|
* Read the file
|
||||||
*
|
*
|
||||||
* @param $sFileName string Filename
|
* @param $sFileName string Filename
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function read($sFileName)
|
public function read($sFileName)
|
||||||
{
|
{
|
||||||
// Check if file exists and is readable
|
// Check if file exists and is readable
|
||||||
if(!is_readable($sFileName)) {
|
if(!is_readable($sFileName)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the file identifier
|
// Get the file identifier
|
||||||
// Don't bother reading the whole file until we know it's a valid OLE file
|
// Don't bother reading the whole file until we know it's a valid OLE file
|
||||||
$this->data = file_get_contents($sFileName, FALSE, NULL, 0, 8);
|
$this->data = file_get_contents($sFileName, FALSE, NULL, 0, 8);
|
||||||
|
|
||||||
// Check OLE identifier
|
// Check OLE identifier
|
||||||
if ($this->data != self::IDENTIFIER_OLE) {
|
if ($this->data != self::IDENTIFIER_OLE) {
|
||||||
throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
|
throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the file data
|
// Get the file data
|
||||||
$this->data = file_get_contents($sFileName);
|
$this->data = file_get_contents($sFileName);
|
||||||
|
|
||||||
// Total number of sectors used for the SAT
|
// Total number of sectors used for the SAT
|
||||||
$this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
|
$this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
|
||||||
|
|
||||||
// SecID of the first sector of the directory stream
|
// SecID of the first sector of the directory stream
|
||||||
$this->rootStartBlock = self::_GetInt4d($this->data, self::ROOT_START_BLOCK_POS);
|
$this->rootStartBlock = self::_GetInt4d($this->data, self::ROOT_START_BLOCK_POS);
|
||||||
|
|
||||||
// SecID of the first sector of the SSAT (or -2 if not extant)
|
// SecID of the first sector of the SSAT (or -2 if not extant)
|
||||||
$this->sbdStartBlock = self::_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
|
$this->sbdStartBlock = self::_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
|
||||||
|
|
||||||
// SecID of the first sector of the MSAT (or -2 if no additional sectors are used)
|
// SecID of the first sector of the MSAT (or -2 if no additional sectors are used)
|
||||||
$this->extensionBlock = self::_GetInt4d($this->data, self::EXTENSION_BLOCK_POS);
|
$this->extensionBlock = self::_GetInt4d($this->data, self::EXTENSION_BLOCK_POS);
|
||||||
|
|
||||||
// Total number of sectors used by MSAT
|
// Total number of sectors used by MSAT
|
||||||
$this->numExtensionBlocks = self::_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
|
$this->numExtensionBlocks = self::_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
|
||||||
|
|
||||||
$bigBlockDepotBlocks = array();
|
$bigBlockDepotBlocks = array();
|
||||||
$pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS;
|
$pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS;
|
||||||
|
|
||||||
$bbdBlocks = $this->numBigBlockDepotBlocks;
|
$bbdBlocks = $this->numBigBlockDepotBlocks;
|
||||||
|
|
||||||
if ($this->numExtensionBlocks != 0) {
|
if ($this->numExtensionBlocks != 0) {
|
||||||
$bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
|
$bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $bbdBlocks; ++$i) {
|
for ($i = 0; $i < $bbdBlocks; ++$i) {
|
||||||
$bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
|
$bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
|
||||||
$pos += 4;
|
$pos += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($j = 0; $j < $this->numExtensionBlocks; ++$j) {
|
for ($j = 0; $j < $this->numExtensionBlocks; ++$j) {
|
||||||
$pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE;
|
||||||
$blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1);
|
$blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1);
|
||||||
|
|
||||||
for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) {
|
for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) {
|
||||||
$bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
|
$bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
|
||||||
$pos += 4;
|
$pos += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
$bbdBlocks += $blocksToRead;
|
$bbdBlocks += $blocksToRead;
|
||||||
if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
|
if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
|
||||||
$this->extensionBlock = self::_GetInt4d($this->data, $pos);
|
$this->extensionBlock = self::_GetInt4d($this->data, $pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
$this->bigBlockChain = '';
|
$this->bigBlockChain = '';
|
||||||
$bbs = self::BIG_BLOCK_SIZE / 4;
|
$bbs = self::BIG_BLOCK_SIZE / 4;
|
||||||
for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
|
for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
|
||||||
$pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
|
||||||
|
|
||||||
$this->bigBlockChain .= substr($this->data, $pos, 4*$bbs);
|
$this->bigBlockChain .= substr($this->data, $pos, 4*$bbs);
|
||||||
$pos += 4*$bbs;
|
$pos += 4*$bbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
$sbdBlock = $this->sbdStartBlock;
|
$sbdBlock = $this->sbdStartBlock;
|
||||||
$this->smallBlockChain = '';
|
$this->smallBlockChain = '';
|
||||||
while ($sbdBlock != -2) {
|
while ($sbdBlock != -2) {
|
||||||
$pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
|
||||||
|
|
||||||
$this->smallBlockChain .= substr($this->data, $pos, 4*$bbs);
|
$this->smallBlockChain .= substr($this->data, $pos, 4*$bbs);
|
||||||
$pos += 4*$bbs;
|
$pos += 4*$bbs;
|
||||||
|
|
||||||
$sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4);
|
$sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the directory stream
|
// read the directory stream
|
||||||
$block = $this->rootStartBlock;
|
$block = $this->rootStartBlock;
|
||||||
$this->entry = $this->_readData($block);
|
$this->entry = $this->_readData($block);
|
||||||
|
|
||||||
$this->_readPropertySets();
|
$this->_readPropertySets();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract binary stream data
|
* Extract binary stream data
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStream($stream)
|
public function getStream($stream)
|
||||||
{
|
{
|
||||||
if ($stream === NULL) {
|
if ($stream === NULL) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$streamData = '';
|
$streamData = '';
|
||||||
|
|
||||||
if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
|
if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
|
||||||
$rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
|
$rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
|
||||||
|
|
||||||
$block = $this->props[$stream]['startBlock'];
|
$block = $this->props[$stream]['startBlock'];
|
||||||
|
|
||||||
while ($block != -2) {
|
while ($block != -2) {
|
||||||
$pos = $block * self::SMALL_BLOCK_SIZE;
|
$pos = $block * self::SMALL_BLOCK_SIZE;
|
||||||
$streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
|
$streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
|
||||||
|
|
||||||
$block = self::_GetInt4d($this->smallBlockChain, $block*4);
|
$block = self::_GetInt4d($this->smallBlockChain, $block*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $streamData;
|
return $streamData;
|
||||||
} else {
|
} else {
|
||||||
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
|
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
|
||||||
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
|
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
|
||||||
++$numBlocks;
|
++$numBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($numBlocks == 0) return '';
|
if ($numBlocks == 0) return '';
|
||||||
|
|
||||||
$block = $this->props[$stream]['startBlock'];
|
$block = $this->props[$stream]['startBlock'];
|
||||||
|
|
||||||
while ($block != -2) {
|
while ($block != -2) {
|
||||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||||
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||||
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $streamData;
|
return $streamData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a standard stream (by joining sectors using information from SAT)
|
* Read a standard stream (by joining sectors using information from SAT)
|
||||||
*
|
*
|
||||||
* @param int $bl Sector ID where the stream starts
|
* @param int $bl Sector ID where the stream starts
|
||||||
* @return string Data for standard stream
|
* @return string Data for standard stream
|
||||||
*/
|
*/
|
||||||
private function _readData($bl)
|
private function _readData($bl)
|
||||||
{
|
{
|
||||||
$block = $bl;
|
$block = $bl;
|
||||||
$data = '';
|
$data = '';
|
||||||
|
|
||||||
while ($block != -2) {
|
while ($block != -2) {
|
||||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||||
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||||
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read entries in the directory stream.
|
* Read entries in the directory stream.
|
||||||
*/
|
*/
|
||||||
private function _readPropertySets() {
|
private function _readPropertySets() {
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
|
||||||
// loop through entires, each entry is 128 bytes
|
// loop through entires, each entry is 128 bytes
|
||||||
$entryLen = strlen($this->entry);
|
$entryLen = strlen($this->entry);
|
||||||
while ($offset < $entryLen) {
|
while ($offset < $entryLen) {
|
||||||
// entry data (128 bytes)
|
// entry data (128 bytes)
|
||||||
$d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
|
$d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
|
||||||
|
|
||||||
// size in bytes of name
|
// size in bytes of name
|
||||||
$nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8);
|
$nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8);
|
||||||
|
|
||||||
// type of entry
|
// type of entry
|
||||||
$type = ord($d[self::TYPE_POS]);
|
$type = ord($d[self::TYPE_POS]);
|
||||||
|
|
||||||
// sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook)
|
// sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook)
|
||||||
// sectorID of first sector of the short-stream container stream, if this entry is root entry
|
// sectorID of first sector of the short-stream container stream, if this entry is root entry
|
||||||
$startBlock = self::_GetInt4d($d, self::START_BLOCK_POS);
|
$startBlock = self::_GetInt4d($d, self::START_BLOCK_POS);
|
||||||
|
|
||||||
$size = self::_GetInt4d($d, self::SIZE_POS);
|
$size = self::_GetInt4d($d, self::SIZE_POS);
|
||||||
|
|
||||||
$name = str_replace("\x00", "", substr($d,0,$nameSize));
|
$name = str_replace("\x00", "", substr($d,0,$nameSize));
|
||||||
|
|
||||||
|
|
||||||
$this->props[] = array (
|
$this->props[] = array (
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'startBlock' => $startBlock,
|
'startBlock' => $startBlock,
|
||||||
'size' => $size);
|
'size' => $size);
|
||||||
|
|
||||||
// tmp helper to simplify checks
|
// tmp helper to simplify checks
|
||||||
$upName = strtoupper($name);
|
$upName = strtoupper($name);
|
||||||
|
|
||||||
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
|
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
|
||||||
if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
|
if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
|
||||||
$this->wrkbook = count($this->props) - 1;
|
$this->wrkbook = count($this->props) - 1;
|
||||||
}
|
}
|
||||||
else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
|
else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
|
||||||
// Root entry
|
// Root entry
|
||||||
$this->rootentry = count($this->props) - 1;
|
$this->rootentry = count($this->props) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summary information
|
// Summary information
|
||||||
if ($name == chr(5) . 'SummaryInformation') {
|
if ($name == chr(5) . 'SummaryInformation') {
|
||||||
// echo 'Summary Information<br />';
|
// echo 'Summary Information<br />';
|
||||||
$this->summaryInformation = count($this->props) - 1;
|
$this->summaryInformation = count($this->props) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional Document Summary information
|
// Additional Document Summary information
|
||||||
if ($name == chr(5) . 'DocumentSummaryInformation') {
|
if ($name == chr(5) . 'DocumentSummaryInformation') {
|
||||||
// echo 'Document Summary Information<br />';
|
// echo 'Document Summary Information<br />';
|
||||||
$this->documentSummaryInformation = count($this->props) - 1;
|
$this->documentSummaryInformation = count($this->props) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
|
$offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read 4 bytes of data at specified position
|
* Read 4 bytes of data at specified position
|
||||||
*
|
*
|
||||||
* @param string $data
|
* @param string $data
|
||||||
* @param int $pos
|
* @param int $pos
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _GetInt4d($data, $pos)
|
private static function _GetInt4d($data, $pos)
|
||||||
{
|
{
|
||||||
// FIX: represent numbers correctly on 64-bit system
|
// FIX: represent numbers correctly on 64-bit system
|
||||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
|
// http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
|
||||||
// Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
|
// Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
|
||||||
$_or_24 = ord($data[$pos + 3]);
|
$_or_24 = ord($data[$pos + 3]);
|
||||||
if ($_or_24 >= 128) {
|
if ($_or_24 >= 128) {
|
||||||
// negative number
|
// negative number
|
||||||
$_ord_24 = -abs((256 - $_or_24) << 24);
|
$_ord_24 = -abs((256 - $_or_24) << 24);
|
||||||
} else {
|
} else {
|
||||||
$_ord_24 = ($_or_24 & 127) << 24;
|
$_ord_24 = ($_or_24 & 127) << 24;
|
||||||
}
|
}
|
||||||
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
|
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@
|
|||||||
}
|
}
|
||||||
else if ($v_size > 2) {
|
else if ($v_size > 2) {
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
||||||
"Invalid number / type of arguments");
|
"Invalid number / type of arguments");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@
|
|||||||
,PCLZIP_ATT_FILE_MTIME => 'optional'
|
,PCLZIP_ATT_FILE_MTIME => 'optional'
|
||||||
,PCLZIP_ATT_FILE_CONTENT => 'optional'
|
,PCLZIP_ATT_FILE_CONTENT => 'optional'
|
||||||
,PCLZIP_ATT_FILE_COMMENT => 'optional'
|
,PCLZIP_ATT_FILE_COMMENT => 'optional'
|
||||||
);
|
);
|
||||||
foreach ($v_att_list as $v_entry) {
|
foreach ($v_att_list as $v_entry) {
|
||||||
$v_result = $this->privFileDescrParseAtt($v_entry,
|
$v_result = $this->privFileDescrParseAtt($v_entry,
|
||||||
$v_filedescr_list[],
|
$v_filedescr_list[],
|
||||||
@ -492,7 +492,7 @@
|
|||||||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||||
//, PCLZIP_OPT_CRYPT => 'optional'
|
//, PCLZIP_OPT_CRYPT => 'optional'
|
||||||
));
|
));
|
||||||
if ($v_result != 1) {
|
if ($v_result != 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -571,7 +571,7 @@
|
|||||||
,PCLZIP_ATT_FILE_MTIME => 'optional'
|
,PCLZIP_ATT_FILE_MTIME => 'optional'
|
||||||
,PCLZIP_ATT_FILE_CONTENT => 'optional'
|
,PCLZIP_ATT_FILE_CONTENT => 'optional'
|
||||||
,PCLZIP_ATT_FILE_COMMENT => 'optional'
|
,PCLZIP_ATT_FILE_COMMENT => 'optional'
|
||||||
);
|
);
|
||||||
foreach ($v_att_list as $v_entry) {
|
foreach ($v_att_list as $v_entry) {
|
||||||
$v_result = $this->privFileDescrParseAtt($v_entry,
|
$v_result = $this->privFileDescrParseAtt($v_entry,
|
||||||
$v_filedescr_list[],
|
$v_filedescr_list[],
|
||||||
@ -751,7 +751,7 @@
|
|||||||
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
|
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
|
||||||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||||
));
|
));
|
||||||
if ($v_result != 1) {
|
if ($v_result != 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -805,7 +805,7 @@
|
|||||||
// ----- Call the extracting fct
|
// ----- Call the extracting fct
|
||||||
$p_list = array();
|
$p_list = array();
|
||||||
$v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
|
$v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
|
||||||
$v_remove_all_path, $v_options);
|
$v_remove_all_path, $v_options);
|
||||||
if ($v_result < 1) {
|
if ($v_result < 1) {
|
||||||
unset($p_list);
|
unset($p_list);
|
||||||
return(0);
|
return(0);
|
||||||
@ -907,7 +907,7 @@
|
|||||||
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
|
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
|
||||||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||||
));
|
));
|
||||||
if ($v_result != 1) {
|
if ($v_result != 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1374,7 +1374,7 @@
|
|||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = true;
|
||||||
|
|
||||||
// ----- Reset the file system cache
|
// ----- Reset the file system cache
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
// ----- Reset the error handler
|
// ----- Reset the error handler
|
||||||
@ -1596,9 +1596,9 @@
|
|||||||
if (($i+1) >= $p_size) {
|
if (($i+1) >= $p_size) {
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
|
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
|
||||||
"Missing parameter value for option '"
|
"Missing parameter value for option '"
|
||||||
.PclZipUtilOptionText($p_options_list[$i])
|
.PclZipUtilOptionText($p_options_list[$i])
|
||||||
."'");
|
."'");
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
@ -1611,9 +1611,9 @@
|
|||||||
else {
|
else {
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
|
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
|
||||||
"Wrong parameter value for option '"
|
"Wrong parameter value for option '"
|
||||||
.PclZipUtilOptionText($p_options_list[$i])
|
.PclZipUtilOptionText($p_options_list[$i])
|
||||||
."'");
|
."'");
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
@ -1779,8 +1779,8 @@
|
|||||||
default :
|
default :
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
||||||
"Unknown parameter '"
|
"Unknown parameter '"
|
||||||
.$p_options_list[$i]."'");
|
.$p_options_list[$i]."'");
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
@ -1954,7 +1954,7 @@
|
|||||||
default :
|
default :
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
||||||
"Unknown parameter '".$v_key."'");
|
"Unknown parameter '".$v_key."'");
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
@ -3033,12 +3033,12 @@
|
|||||||
|
|
||||||
// ----- Packed data
|
// ----- Packed data
|
||||||
$v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
|
$v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
|
||||||
$p_header['version_extracted'], $p_header['flag'],
|
$p_header['version_extracted'], $p_header['flag'],
|
||||||
$p_header['compression'], $v_mtime, $v_mdate,
|
$p_header['compression'], $v_mtime, $v_mdate,
|
||||||
$p_header['crc'], $p_header['compressed_size'],
|
$p_header['crc'], $p_header['compressed_size'],
|
||||||
$p_header['size'],
|
$p_header['size'],
|
||||||
strlen($p_header['stored_filename']),
|
strlen($p_header['stored_filename']),
|
||||||
$p_header['extra_len']);
|
$p_header['extra_len']);
|
||||||
|
|
||||||
// ----- Write the first 148 bytes of the header in the archive
|
// ----- Write the first 148 bytes of the header in the archive
|
||||||
fputs($this->zip_fd, $v_binary_data, 30);
|
fputs($this->zip_fd, $v_binary_data, 30);
|
||||||
@ -3080,14 +3080,14 @@
|
|||||||
|
|
||||||
// ----- Packed data
|
// ----- Packed data
|
||||||
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
|
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
|
||||||
$p_header['version'], $p_header['version_extracted'],
|
$p_header['version'], $p_header['version_extracted'],
|
||||||
$p_header['flag'], $p_header['compression'],
|
$p_header['flag'], $p_header['compression'],
|
||||||
$v_mtime, $v_mdate, $p_header['crc'],
|
$v_mtime, $v_mdate, $p_header['crc'],
|
||||||
$p_header['compressed_size'], $p_header['size'],
|
$p_header['compressed_size'], $p_header['size'],
|
||||||
strlen($p_header['stored_filename']),
|
strlen($p_header['stored_filename']),
|
||||||
$p_header['extra_len'], $p_header['comment_len'],
|
$p_header['extra_len'], $p_header['comment_len'],
|
||||||
$p_header['disk'], $p_header['internal'],
|
$p_header['disk'], $p_header['internal'],
|
||||||
$p_header['external'], $p_header['offset']);
|
$p_header['external'], $p_header['offset']);
|
||||||
|
|
||||||
// ----- Write the 42 bytes of the header in the zip file
|
// ----- Write the 42 bytes of the header in the zip file
|
||||||
fputs($this->zip_fd, $v_binary_data, 46);
|
fputs($this->zip_fd, $v_binary_data, 46);
|
||||||
@ -3123,8 +3123,8 @@
|
|||||||
|
|
||||||
// ----- Packed data
|
// ----- Packed data
|
||||||
$v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
|
$v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
|
||||||
$p_nb_entries, $p_size,
|
$p_nb_entries, $p_size,
|
||||||
$p_offset, strlen($p_comment));
|
$p_offset, strlen($p_comment));
|
||||||
|
|
||||||
// ----- Write the 22 bytes of the header in the zip file
|
// ----- Write the 22 bytes of the header in the zip file
|
||||||
fputs($this->zip_fd, $v_binary_data, 22);
|
fputs($this->zip_fd, $v_binary_data, 22);
|
||||||
@ -3281,9 +3281,9 @@
|
|||||||
|
|
||||||
// ----- Check the path
|
// ----- Check the path
|
||||||
if ( ($p_path == "")
|
if ( ($p_path == "")
|
||||||
|| ( (substr($p_path, 0, 1) != "/")
|
|| ( (substr($p_path, 0, 1) != "/")
|
||||||
&& (substr($p_path, 0, 3) != "../")
|
&& (substr($p_path, 0, 3) != "../")
|
||||||
&& (substr($p_path,1,2)!=":/")))
|
&& (substr($p_path,1,2)!=":/")))
|
||||||
$p_path = "./".$p_path;
|
$p_path = "./".$p_path;
|
||||||
|
|
||||||
// ----- Reduce the path last (and duplicated) '/'
|
// ----- Reduce the path last (and duplicated) '/'
|
||||||
@ -3433,50 +3433,50 @@
|
|||||||
$v_extract = true;
|
$v_extract = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check compression method
|
// ----- Check compression method
|
||||||
if ( ($v_extract)
|
if ( ($v_extract)
|
||||||
&& ( ($v_header['compression'] != 8)
|
&& ( ($v_header['compression'] != 8)
|
||||||
&& ($v_header['compression'] != 0))) {
|
&& ($v_header['compression'] != 0))) {
|
||||||
$v_header['status'] = 'unsupported_compression';
|
$v_header['status'] = 'unsupported_compression';
|
||||||
|
|
||||||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||||
|
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
|
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
|
||||||
"Filename '".$v_header['stored_filename']."' is "
|
"Filename '".$v_header['stored_filename']."' is "
|
||||||
."compressed by an unsupported compression "
|
."compressed by an unsupported compression "
|
||||||
."method (".$v_header['compression'].") ");
|
."method (".$v_header['compression'].") ");
|
||||||
|
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check encrypted files
|
// ----- Check encrypted files
|
||||||
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
||||||
$v_header['status'] = 'unsupported_encryption';
|
$v_header['status'] = 'unsupported_encryption';
|
||||||
|
|
||||||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||||
|
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
|
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
|
||||||
"Unsupported encryption for "
|
"Unsupported encryption for "
|
||||||
." filename '".$v_header['stored_filename']
|
." filename '".$v_header['stored_filename']
|
||||||
."'");
|
."'");
|
||||||
|
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for real extraction
|
// ----- Look for real extraction
|
||||||
if (($v_extract) && ($v_header['status'] != 'ok')) {
|
if (($v_extract) && ($v_header['status'] != 'ok')) {
|
||||||
$v_result = $this->privConvertHeader2FileInfo($v_header,
|
$v_result = $this->privConvertHeader2FileInfo($v_header,
|
||||||
$p_file_list[$v_nb_extracted++]);
|
$p_file_list[$v_nb_extracted++]);
|
||||||
if ($v_result != 1) {
|
if ($v_result != 1) {
|
||||||
$this->privCloseFd();
|
$this->privCloseFd();
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
@ -3537,12 +3537,12 @@
|
|||||||
|
|
||||||
// ----- Look for user callback abort
|
// ----- Look for user callback abort
|
||||||
if ($v_result1 == 2) {
|
if ($v_result1 == 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- Look for extraction in standard output
|
// ----- Look for extraction in standard output
|
||||||
elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
|
elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
|
||||||
&& ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
|
&& ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
|
||||||
// ----- Extracting the file in standard output
|
// ----- Extracting the file in standard output
|
||||||
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
|
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
|
||||||
if ($v_result1 < 1) {
|
if ($v_result1 < 1) {
|
||||||
@ -3560,16 +3560,16 @@
|
|||||||
|
|
||||||
// ----- Look for user callback abort
|
// ----- Look for user callback abort
|
||||||
if ($v_result1 == 2) {
|
if ($v_result1 == 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- Look for normal extraction
|
// ----- Look for normal extraction
|
||||||
else {
|
else {
|
||||||
// ----- Extracting the file
|
// ----- Extracting the file
|
||||||
$v_result1 = $this->privExtractFile($v_header,
|
$v_result1 = $this->privExtractFile($v_header,
|
||||||
$p_path, $p_remove_path,
|
$p_path, $p_remove_path,
|
||||||
$p_remove_all_path,
|
$p_remove_all_path,
|
||||||
$p_options);
|
$p_options);
|
||||||
if ($v_result1 < 1) {
|
if ($v_result1 < 1) {
|
||||||
$this->privCloseFd();
|
$this->privCloseFd();
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
@ -3588,7 +3588,7 @@
|
|||||||
|
|
||||||
// ----- Look for user callback abort
|
// ----- Look for user callback abort
|
||||||
if ($v_result1 == 2) {
|
if ($v_result1 == 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3679,8 +3679,8 @@
|
|||||||
if ($v_inclusion == 0) {
|
if ($v_inclusion == 0) {
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
|
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
|
||||||
"Filename '".$p_entry['filename']."' is "
|
"Filename '".$p_entry['filename']."' is "
|
||||||
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
|
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
|
||||||
|
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
@ -3708,7 +3708,7 @@
|
|||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
// ----- This status is internal and will be changed in 'skipped'
|
// ----- This status is internal and will be changed in 'skipped'
|
||||||
$p_entry['status'] = "aborted";
|
$p_entry['status'] = "aborted";
|
||||||
$v_result = PCLZIP_ERR_USER_ABORTED;
|
$v_result = PCLZIP_ERR_USER_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Update the informations
|
// ----- Update the informations
|
||||||
@ -3735,14 +3735,14 @@
|
|||||||
// For historical reason first PclZip implementation does not stop
|
// For historical reason first PclZip implementation does not stop
|
||||||
// when this kind of error occurs.
|
// when this kind of error occurs.
|
||||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
||||||
"Filename '".$p_entry['filename']."' is "
|
"Filename '".$p_entry['filename']."' is "
|
||||||
."already used by an existing directory");
|
."already used by an existing directory");
|
||||||
|
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- Look if file is write protected
|
// ----- Look if file is write protected
|
||||||
else if (!is_writeable($p_entry['filename']))
|
else if (!is_writeable($p_entry['filename']))
|
||||||
@ -3755,14 +3755,14 @@
|
|||||||
// For historical reason first PclZip implementation does not stop
|
// For historical reason first PclZip implementation does not stop
|
||||||
// when this kind of error occurs.
|
// when this kind of error occurs.
|
||||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
||||||
"Filename '".$p_entry['filename']."' exists "
|
"Filename '".$p_entry['filename']."' exists "
|
||||||
."and is write protected");
|
."and is write protected");
|
||||||
|
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look if the extracted file is older
|
// ----- Look if the extracted file is older
|
||||||
@ -3770,24 +3770,24 @@
|
|||||||
{
|
{
|
||||||
// ----- Change the file status
|
// ----- Change the file status
|
||||||
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
||||||
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$p_entry['status'] = "newer_exist";
|
$p_entry['status'] = "newer_exist";
|
||||||
|
|
||||||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||||
// For historical reason first PclZip implementation does not stop
|
// For historical reason first PclZip implementation does not stop
|
||||||
// when this kind of error occurs.
|
// when this kind of error occurs.
|
||||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
||||||
"Newer version of '".$p_entry['filename']."' exists "
|
"Newer version of '".$p_entry['filename']."' exists "
|
||||||
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
|
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
|
||||||
|
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
}
|
}
|
||||||
@ -3823,7 +3823,7 @@
|
|||||||
// ----- Look for not compressed file
|
// ----- Look for not compressed file
|
||||||
if ($p_entry['compression'] == 0) {
|
if ($p_entry['compression'] == 0) {
|
||||||
|
|
||||||
// ----- Opening destination file
|
// ----- Opening destination file
|
||||||
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
|
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -3928,11 +3928,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Change abort status
|
// ----- Change abort status
|
||||||
if ($p_entry['status'] == "aborted") {
|
if ($p_entry['status'] == "aborted") {
|
||||||
$p_entry['status'] = "skipped";
|
$p_entry['status'] = "skipped";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for post-extract callback
|
// ----- Look for post-extract callback
|
||||||
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
||||||
|
|
||||||
@ -3948,7 +3948,7 @@
|
|||||||
|
|
||||||
// ----- Look for abort result
|
// ----- Look for abort result
|
||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
$v_result = PCLZIP_ERR_USER_ABORTED;
|
$v_result = PCLZIP_ERR_USER_ABORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4076,7 +4076,7 @@
|
|||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
// ----- This status is internal and will be changed in 'skipped'
|
// ----- This status is internal and will be changed in 'skipped'
|
||||||
$p_entry['status'] = "aborted";
|
$p_entry['status'] = "aborted";
|
||||||
$v_result = PCLZIP_ERR_USER_ABORTED;
|
$v_result = PCLZIP_ERR_USER_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Update the informations
|
// ----- Update the informations
|
||||||
@ -4117,10 +4117,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Change abort status
|
// ----- Change abort status
|
||||||
if ($p_entry['status'] == "aborted") {
|
if ($p_entry['status'] == "aborted") {
|
||||||
$p_entry['status'] = "skipped";
|
$p_entry['status'] = "skipped";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for post-extract callback
|
// ----- Look for post-extract callback
|
||||||
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
||||||
@ -4137,7 +4137,7 @@
|
|||||||
|
|
||||||
// ----- Look for abort result
|
// ----- Look for abort result
|
||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
$v_result = PCLZIP_ERR_USER_ABORTED;
|
$v_result = PCLZIP_ERR_USER_ABORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4191,7 +4191,7 @@
|
|||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
// ----- This status is internal and will be changed in 'skipped'
|
// ----- This status is internal and will be changed in 'skipped'
|
||||||
$p_entry['status'] = "aborted";
|
$p_entry['status'] = "aborted";
|
||||||
$v_result = PCLZIP_ERR_USER_ABORTED;
|
$v_result = PCLZIP_ERR_USER_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Update the informations
|
// ----- Update the informations
|
||||||
@ -4231,11 +4231,11 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Change abort status
|
// ----- Change abort status
|
||||||
if ($p_entry['status'] == "aborted") {
|
if ($p_entry['status'] == "aborted") {
|
||||||
$p_entry['status'] = "skipped";
|
$p_entry['status'] = "skipped";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for post-extract callback
|
// ----- Look for post-extract callback
|
||||||
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
||||||
|
|
||||||
@ -4259,7 +4259,7 @@
|
|||||||
|
|
||||||
// ----- Look for abort result
|
// ----- Look for abort result
|
||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
$v_result = PCLZIP_ERR_USER_ABORTED;
|
$v_result = PCLZIP_ERR_USER_ABORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4489,27 +4489,27 @@
|
|||||||
{
|
{
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- Check the static values
|
// ----- Check the static values
|
||||||
// TBC
|
// TBC
|
||||||
if ($p_local_header['filename'] != $p_central_header['filename']) {
|
if ($p_local_header['filename'] != $p_central_header['filename']) {
|
||||||
}
|
}
|
||||||
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
|
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
|
||||||
}
|
}
|
||||||
if ($p_local_header['flag'] != $p_central_header['flag']) {
|
if ($p_local_header['flag'] != $p_central_header['flag']) {
|
||||||
}
|
}
|
||||||
if ($p_local_header['compression'] != $p_central_header['compression']) {
|
if ($p_local_header['compression'] != $p_central_header['compression']) {
|
||||||
}
|
}
|
||||||
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
|
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
|
||||||
}
|
}
|
||||||
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for flag bit 3
|
// ----- Look for flag bit 3
|
||||||
if (($p_local_header['flag'] & 8) == 8) {
|
if (($p_local_header['flag'] & 8) == 8) {
|
||||||
$p_local_header['size'] = $p_central_header['size'];
|
$p_local_header['size'] = $p_central_header['size'];
|
||||||
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
|
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
|
||||||
$p_local_header['crc'] = $p_central_header['crc'];
|
$p_local_header['crc'] = $p_central_header['crc'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -4635,19 +4635,19 @@
|
|||||||
// ----- Check the global size
|
// ----- Check the global size
|
||||||
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
|
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
|
||||||
|
|
||||||
// ----- Removed in release 2.2 see readme file
|
// ----- Removed in release 2.2 see readme file
|
||||||
// The check of the file size is a little too strict.
|
// The check of the file size is a little too strict.
|
||||||
// Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
|
// Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
|
||||||
// While decrypted, zip has training 0 bytes
|
// While decrypted, zip has training 0 bytes
|
||||||
if (0) {
|
if (0) {
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
|
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
|
||||||
'The central dir is not at the end of the archive.'
|
'The central dir is not at the end of the archive.'
|
||||||
.' Some trailing bytes exists after the archive.');
|
.' Some trailing bytes exists after the archive.');
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Get comment
|
// ----- Get comment
|
||||||
@ -4809,7 +4809,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$v_found = true;
|
$v_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for deletion
|
// ----- Look for deletion
|
||||||
@ -4872,7 +4872,7 @@
|
|||||||
|
|
||||||
// ----- Check that local file header is same as central file header
|
// ----- Check that local file header is same as central file header
|
||||||
if ($this->privCheckFileHeaders($v_local_header,
|
if ($this->privCheckFileHeaders($v_local_header,
|
||||||
$v_header_list[$i]) != 1) {
|
$v_header_list[$i]) != 1) {
|
||||||
// TBC
|
// TBC
|
||||||
}
|
}
|
||||||
unset($v_local_header);
|
unset($v_local_header);
|
||||||
@ -5330,22 +5330,22 @@
|
|||||||
|
|
||||||
// ----- Look if function exists
|
// ----- Look if function exists
|
||||||
if ( (!function_exists("get_magic_quotes_runtime"))
|
if ( (!function_exists("get_magic_quotes_runtime"))
|
||||||
|| (!function_exists("set_magic_quotes_runtime"))) {
|
|| (!function_exists("set_magic_quotes_runtime"))) {
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look if already done
|
// ----- Look if already done
|
||||||
if ($this->magic_quotes_status != -1) {
|
if ($this->magic_quotes_status != -1) {
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Get and memorize the magic_quote value
|
// ----- Get and memorize the magic_quote value
|
||||||
$this->magic_quotes_status = @get_magic_quotes_runtime();
|
$this->magic_quotes_status = @get_magic_quotes_runtime();
|
||||||
|
|
||||||
// ----- Disable magic_quotes
|
// ----- Disable magic_quotes
|
||||||
if ($this->magic_quotes_status == 1) {
|
if ($this->magic_quotes_status == 1) {
|
||||||
@set_magic_quotes_runtime(0);
|
@set_magic_quotes_runtime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -5364,19 +5364,19 @@
|
|||||||
|
|
||||||
// ----- Look if function exists
|
// ----- Look if function exists
|
||||||
if ( (!function_exists("get_magic_quotes_runtime"))
|
if ( (!function_exists("get_magic_quotes_runtime"))
|
||||||
|| (!function_exists("set_magic_quotes_runtime"))) {
|
|| (!function_exists("set_magic_quotes_runtime"))) {
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look if something to do
|
// ----- Look if something to do
|
||||||
if ($this->magic_quotes_status != -1) {
|
if ($this->magic_quotes_status != -1) {
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Swap back magic_quotes
|
// ----- Swap back magic_quotes
|
||||||
if ($this->magic_quotes_status == 1) {
|
if ($this->magic_quotes_status == 1) {
|
||||||
@set_magic_quotes_runtime($this->magic_quotes_status);
|
@set_magic_quotes_runtime($this->magic_quotes_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -5411,37 +5411,37 @@
|
|||||||
// Should be the first $i=0, but no check is done
|
// Should be the first $i=0, but no check is done
|
||||||
}
|
}
|
||||||
else if ($v_list[$i] == "..") {
|
else if ($v_list[$i] == "..") {
|
||||||
$v_skip++;
|
$v_skip++;
|
||||||
}
|
}
|
||||||
else if ($v_list[$i] == "") {
|
else if ($v_list[$i] == "") {
|
||||||
// ----- First '/' i.e. root slash
|
// ----- First '/' i.e. root slash
|
||||||
if ($i == 0) {
|
if ($i == 0) {
|
||||||
$v_result = "/".$v_result;
|
$v_result = "/".$v_result;
|
||||||
if ($v_skip > 0) {
|
if ($v_skip > 0) {
|
||||||
// ----- It is an invalid path, so the path is not modified
|
// ----- It is an invalid path, so the path is not modified
|
||||||
// TBC
|
// TBC
|
||||||
$v_result = $p_dir;
|
$v_result = $p_dir;
|
||||||
$v_skip = 0;
|
$v_skip = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- Last '/' i.e. indicates a directory
|
// ----- Last '/' i.e. indicates a directory
|
||||||
else if ($i == (sizeof($v_list)-1)) {
|
else if ($i == (sizeof($v_list)-1)) {
|
||||||
$v_result = $v_list[$i];
|
$v_result = $v_list[$i];
|
||||||
}
|
}
|
||||||
// ----- Double '/' inside the path
|
// ----- Double '/' inside the path
|
||||||
else {
|
else {
|
||||||
// ----- Ignore only the double '//' in path,
|
// ----- Ignore only the double '//' in path,
|
||||||
// but not the first and last '/'
|
// but not the first and last '/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ----- Look for item to skip
|
// ----- Look for item to skip
|
||||||
if ($v_skip > 0) {
|
if ($v_skip > 0) {
|
||||||
$v_skip--;
|
$v_skip--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
|
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5648,13 +5648,13 @@
|
|||||||
|
|
||||||
$v_list = get_defined_constants();
|
$v_list = get_defined_constants();
|
||||||
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
||||||
$v_prefix = substr($v_key, 0, 10);
|
$v_prefix = substr($v_key, 0, 10);
|
||||||
if (( ($v_prefix == 'PCLZIP_OPT')
|
if (( ($v_prefix == 'PCLZIP_OPT')
|
||||||
|| ($v_prefix == 'PCLZIP_CB_')
|
|| ($v_prefix == 'PCLZIP_CB_')
|
||||||
|| ($v_prefix == 'PCLZIP_ATT'))
|
|| ($v_prefix == 'PCLZIP_ATT'))
|
||||||
&& ($v_list[$v_key] == $p_option)) {
|
&& ($v_list[$v_key] == $p_option)) {
|
||||||
return $v_key;
|
return $v_key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_result = 'Unknown';
|
$v_result = 'Unknown';
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,32 +35,32 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_PasswordHasher
|
class PHPExcel_Shared_PasswordHasher
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a password hash from a given string.
|
* Create a password hash from a given string.
|
||||||
*
|
*
|
||||||
* This method is based on the algorithm provided by
|
* This method is based on the algorithm provided by
|
||||||
* Daniel Rentz of OpenOffice and the PEAR package
|
* Daniel Rentz of OpenOffice and the PEAR package
|
||||||
* Spreadsheet_Excel_Writer by Xavier Noguer <xnoguer@rezebra.com>.
|
* Spreadsheet_Excel_Writer by Xavier Noguer <xnoguer@rezebra.com>.
|
||||||
*
|
*
|
||||||
* @param string $pPassword Password to hash
|
* @param string $pPassword Password to hash
|
||||||
* @return string Hashed password
|
* @return string Hashed password
|
||||||
*/
|
*/
|
||||||
public static function hashPassword($pPassword = '') {
|
public static function hashPassword($pPassword = '') {
|
||||||
$password = 0x0000;
|
$password = 0x0000;
|
||||||
$charPos = 1; // char position
|
$charPos = 1; // char position
|
||||||
|
|
||||||
// split the plain text password in its component characters
|
// split the plain text password in its component characters
|
||||||
$chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY);
|
$chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
foreach ($chars as $char) {
|
foreach ($chars as $char) {
|
||||||
$value = ord($char) << $charPos++; // shifted ASCII value
|
$value = ord($char) << $charPos++; // shifted ASCII value
|
||||||
$rotated_bits = $value >> 15; // rotated bits beyond bit 15
|
$rotated_bits = $value >> 15; // rotated bits beyond bit 15
|
||||||
$value &= 0x7fff; // first 15 bits
|
$value &= 0x7fff; // first 15 bits
|
||||||
$password ^= ($value | $rotated_bits);
|
$password ^= ($value | $rotated_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
$password ^= strlen($pPassword);
|
$password ^= strlen($pPassword);
|
||||||
$password ^= 0xCE4B;
|
$password ^= 0xCE4B;
|
||||||
|
|
||||||
return(strtoupper(dechex($password)));
|
return(strtoupper(dechex($password)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,10 +20,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,110 +31,109 @@
|
|||||||
* PHPExcel_Shared_TimeZone
|
* PHPExcel_Shared_TimeZone
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_TimeZone
|
class PHPExcel_Shared_TimeZone
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Default Timezone used for date/time conversions
|
* Default Timezone used for date/time conversions
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected static $_timezone = 'UTC';
|
protected static $_timezone = 'UTC';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a Timezone name
|
* Validate a Timezone name
|
||||||
*
|
*
|
||||||
* @param string $timezone Time zone (e.g. 'Europe/London')
|
* @param string $timezone Time zone (e.g. 'Europe/London')
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function _validateTimeZone($timezone) {
|
public static function _validateTimeZone($timezone) {
|
||||||
if (in_array($timezone, DateTimeZone::listIdentifiers())) {
|
if (in_array($timezone, DateTimeZone::listIdentifiers())) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Default Timezone used for date/time conversions
|
* Set the Default Timezone used for date/time conversions
|
||||||
*
|
*
|
||||||
* @param string $timezone Time zone (e.g. 'Europe/London')
|
* @param string $timezone Time zone (e.g. 'Europe/London')
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setTimeZone($timezone) {
|
public static function setTimeZone($timezone) {
|
||||||
if (self::_validateTimezone($timezone)) {
|
if (self::_validateTimezone($timezone)) {
|
||||||
self::$_timezone = $timezone;
|
self::$_timezone = $timezone;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
} // function setTimezone()
|
} // function setTimezone()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Default Timezone used for date/time conversions
|
* Return the Default Timezone used for date/time conversions
|
||||||
*
|
*
|
||||||
* @return string Timezone (e.g. 'Europe/London')
|
* @return string Timezone (e.g. 'Europe/London')
|
||||||
*/
|
*/
|
||||||
public static function getTimeZone() {
|
public static function getTimeZone() {
|
||||||
return self::$_timezone;
|
return self::$_timezone;
|
||||||
} // function getTimezone()
|
} // function getTimezone()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Timezone transition for the specified timezone and timestamp
|
* Return the Timezone transition for the specified timezone and timestamp
|
||||||
*
|
*
|
||||||
* @param DateTimeZone $objTimezone The timezone for finding the transitions
|
* @param DateTimeZone $objTimezone The timezone for finding the transitions
|
||||||
* @param integer $timestamp PHP date/time value for finding the current transition
|
* @param integer $timestamp PHP date/time value for finding the current transition
|
||||||
* @return array The current transition details
|
* @return array The current transition details
|
||||||
*/
|
*/
|
||||||
private static function _getTimezoneTransitions($objTimezone, $timestamp) {
|
private static function _getTimezoneTransitions($objTimezone, $timestamp) {
|
||||||
$allTransitions = $objTimezone->getTransitions();
|
$allTransitions = $objTimezone->getTransitions();
|
||||||
$transitions = array();
|
$transitions = array();
|
||||||
foreach($allTransitions as $key => $transition) {
|
foreach ($allTransitions as $key => $transition) {
|
||||||
if ($transition['ts'] > $timestamp) {
|
if ($transition['ts'] > $timestamp) {
|
||||||
$transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition;
|
$transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (empty($transitions)) {
|
if (empty($transitions)) {
|
||||||
$transitions[] = end($allTransitions);
|
$transitions[] = end($allTransitions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $transitions;
|
return $transitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Timezone offset used for date/time conversions to/from UST
|
* Return the Timezone offset used for date/time conversions to/from UST
|
||||||
* This requires both the timezone and the calculated date/time to allow for local DST
|
* This requires both the timezone and the calculated date/time to allow for local DST
|
||||||
*
|
*
|
||||||
* @param string $timezone The timezone for finding the adjustment to UST
|
* @param string $timezone The timezone for finding the adjustment to UST
|
||||||
* @param integer $timestamp PHP date/time value
|
* @param integer $timestamp PHP date/time value
|
||||||
* @return integer Number of seconds for timezone adjustment
|
* @return integer Number of seconds for timezone adjustment
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public static function getTimeZoneAdjustment($timezone, $timestamp) {
|
public static function getTimeZoneAdjustment($timezone, $timestamp) {
|
||||||
if ($timezone !== NULL) {
|
if ($timezone !== null) {
|
||||||
if (!self::_validateTimezone($timezone)) {
|
if (!self::_validateTimezone($timezone)) {
|
||||||
throw new PHPExcel_Exception("Invalid timezone " . $timezone);
|
throw new PHPExcel_Exception("Invalid timezone " . $timezone);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$timezone = self::$_timezone;
|
$timezone = self::$_timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($timezone == 'UST') {
|
if ($timezone == 'UST') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$objTimezone = new DateTimeZone($timezone);
|
$objTimezone = new DateTimeZone($timezone);
|
||||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||||
$transitions = $objTimezone->getTransitions($timestamp,$timestamp);
|
$transitions = $objTimezone->getTransitions($timestamp,$timestamp);
|
||||||
} else {
|
} else {
|
||||||
$transitions = self::_getTimezoneTransitions($objTimezone, $timestamp);
|
$transitions = self::_getTimezoneTransitions($objTimezone, $timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (count($transitions) > 0) ? $transitions[0]['offset'] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return (count($transitions) > 0) ? $transitions[0]['offset'] : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DATE_W3C')) {
|
if (!defined('DATE_W3C')) {
|
||||||
@ -38,90 +38,90 @@ if (!defined('DEBUGMODE_ENABLED')) {
|
|||||||
* PHPExcel_Shared_XMLWriter
|
* PHPExcel_Shared_XMLWriter
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||||
/** Temporary storage method */
|
/** Temporary storage method */
|
||||||
const STORAGE_MEMORY = 1;
|
const STORAGE_MEMORY = 1;
|
||||||
const STORAGE_DISK = 2;
|
const STORAGE_DISK = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary filename
|
* Temporary filename
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_tempFileName = '';
|
private $_tempFileName = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Shared_XMLWriter instance
|
* Create a new PHPExcel_Shared_XMLWriter instance
|
||||||
*
|
*
|
||||||
* @param int $pTemporaryStorage Temporary storage location
|
* @param int $pTemporaryStorage Temporary storage location
|
||||||
* @param string $pTemporaryStorageFolder Temporary storage folder
|
* @param string $pTemporaryStorageFolder Temporary storage folder
|
||||||
*/
|
*/
|
||||||
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = NULL) {
|
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = NULL) {
|
||||||
// Open temporary storage
|
// Open temporary storage
|
||||||
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
|
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
|
||||||
$this->openMemory();
|
$this->openMemory();
|
||||||
} else {
|
} else {
|
||||||
// Create temporary filename
|
// Create temporary filename
|
||||||
if ($pTemporaryStorageFolder === NULL)
|
if ($pTemporaryStorageFolder === NULL)
|
||||||
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
|
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
||||||
|
|
||||||
// Open storage
|
// Open storage
|
||||||
if ($this->openUri($this->_tempFileName) === false) {
|
if ($this->openUri($this->_tempFileName) === false) {
|
||||||
// Fallback to memory...
|
// Fallback to memory...
|
||||||
$this->openMemory();
|
$this->openMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default values
|
// Set default values
|
||||||
if (DEBUGMODE_ENABLED) {
|
if (DEBUGMODE_ENABLED) {
|
||||||
$this->setIndent(true);
|
$this->setIndent(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
// Unlink temporary files
|
// Unlink temporary files
|
||||||
if ($this->_tempFileName != '') {
|
if ($this->_tempFileName != '') {
|
||||||
@unlink($this->_tempFileName);
|
@unlink($this->_tempFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get written data
|
* Get written data
|
||||||
*
|
*
|
||||||
* @return $data
|
* @return $data
|
||||||
*/
|
*/
|
||||||
public function getData() {
|
public function getData() {
|
||||||
if ($this->_tempFileName == '') {
|
if ($this->_tempFileName == '') {
|
||||||
return $this->outputMemory(true);
|
return $this->outputMemory(true);
|
||||||
} else {
|
} else {
|
||||||
$this->flush();
|
$this->flush();
|
||||||
return file_get_contents($this->_tempFileName);
|
return file_get_contents($this->_tempFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fallback method for writeRaw, introduced in PHP 5.2
|
* Fallback method for writeRaw, introduced in PHP 5.2
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function writeRawData($text)
|
public function writeRawData($text)
|
||||||
{
|
{
|
||||||
if (is_array($text)) {
|
if (is_array($text)) {
|
||||||
$text = implode("\n",$text);
|
$text = implode("\n",$text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method_exists($this, 'writeRaw')) {
|
if (method_exists($this, 'writeRaw')) {
|
||||||
return $this->writeRaw(htmlspecialchars($text));
|
return $this->writeRaw(htmlspecialchars($text));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->text($text);
|
return $this->text($text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,34 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
|
|||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
||||||
|
define('PCLZIP_TEMPORARY_DIR', PHPExcel_Shared_File::sys_get_temp_dir() . DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Shared_ZipArchive
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Shared_ZipArchive
|
||||||
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
class PHPExcel_Shared_ZipArchive
|
class PHPExcel_Shared_ZipArchive
|
||||||
{
|
{
|
||||||
|
|
||||||
/** constants */
|
/** constants */
|
||||||
|
<<<<<<< HEAD
|
||||||
const OVERWRITE = 'OVERWRITE';
|
const OVERWRITE = 'OVERWRITE';
|
||||||
const CREATE = 'CREATE';
|
const CREATE = 'CREATE';
|
||||||
|
=======
|
||||||
|
const OVERWRITE = 'OVERWRITE';
|
||||||
|
const CREATE = 'CREATE';
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,10 +114,14 @@ class PHPExcel_Shared_ZipArchive
|
|||||||
fwrite($handle, $contents);
|
fwrite($handle, $contents);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
|
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
|
||||||
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
|
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
|
||||||
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]
|
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]
|
||||||
);
|
);
|
||||||
|
=======
|
||||||
|
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
|
||||||
|
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
|
||||||
if ($res == 0) {
|
if ($res == 0) {
|
||||||
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
|
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
|
||||||
}
|
}
|
||||||
@ -130,7 +156,7 @@ class PHPExcel_Shared_ZipArchive
|
|||||||
* @param string $fileName Filename for the file in zip archive
|
* @param string $fileName Filename for the file in zip archive
|
||||||
* @return string $contents File string contents
|
* @return string $contents File string contents
|
||||||
*/
|
*/
|
||||||
public function getFromName($fileName)
|
public function getFromName($fileName)
|
||||||
{
|
{
|
||||||
$list = $this->_zip->listContent();
|
$list = $this->_zip->listContent();
|
||||||
$listCount = count($list);
|
$listCount = count($list);
|
||||||
@ -150,7 +176,7 @@ class PHPExcel_Shared_ZipArchive
|
|||||||
$filename = substr($fileName, 1);
|
$filename = substr($fileName, 1);
|
||||||
$list_index = -1;
|
$list_index = -1;
|
||||||
for ($i = 0; $i < $listCount; ++$i) {
|
for ($i = 0; $i < $listCount; ++$i) {
|
||||||
if (strtolower($list[$i]["filename"]) == strtolower($fileName) ||
|
if (strtolower($list[$i]["filename"]) == strtolower($fileName) ||
|
||||||
strtolower($list[$i]["stored_filename"]) == strtolower($fileName)) {
|
strtolower($list[$i]["stored_filename"]) == strtolower($fileName)) {
|
||||||
$list_index = $i;
|
$list_index = $i;
|
||||||
break;
|
break;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_ZipStreamWrapper {
|
class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,398 +35,398 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Best_Fit
|
class PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Indicator flag for a calculation error
|
* Indicator flag for a calculation error
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
**/
|
**/
|
||||||
protected $_error = False;
|
protected $_error = False;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Algorithm type to use for best-fit
|
* Algorithm type to use for best-fit
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'undetermined';
|
protected $_bestFitType = 'undetermined';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of entries in the sets of x- and y-value arrays
|
* Number of entries in the sets of x- and y-value arrays
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
**/
|
**/
|
||||||
protected $_valueCount = 0;
|
protected $_valueCount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X-value dataseries of values
|
* X-value dataseries of values
|
||||||
*
|
*
|
||||||
* @var float[]
|
* @var float[]
|
||||||
**/
|
**/
|
||||||
protected $_xValues = array();
|
protected $_xValues = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Y-value dataseries of values
|
* Y-value dataseries of values
|
||||||
*
|
*
|
||||||
* @var float[]
|
* @var float[]
|
||||||
**/
|
**/
|
||||||
protected $_yValues = array();
|
protected $_yValues = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag indicating whether values should be adjusted to Y=0
|
* Flag indicating whether values should be adjusted to Y=0
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
**/
|
**/
|
||||||
protected $_adjustToZero = False;
|
protected $_adjustToZero = False;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Y-value series of best-fit values
|
* Y-value series of best-fit values
|
||||||
*
|
*
|
||||||
* @var float[]
|
* @var float[]
|
||||||
**/
|
**/
|
||||||
protected $_yBestFitValues = array();
|
protected $_yBestFitValues = array();
|
||||||
|
|
||||||
protected $_goodnessOfFit = 1;
|
protected $_goodnessOfFit = 1;
|
||||||
|
|
||||||
protected $_stdevOfResiduals = 0;
|
protected $_stdevOfResiduals = 0;
|
||||||
|
|
||||||
protected $_covariance = 0;
|
protected $_covariance = 0;
|
||||||
|
|
||||||
protected $_correlation = 0;
|
protected $_correlation = 0;
|
||||||
|
|
||||||
protected $_SSRegression = 0;
|
protected $_SSRegression = 0;
|
||||||
|
|
||||||
protected $_SSResiduals = 0;
|
protected $_SSResiduals = 0;
|
||||||
|
|
||||||
protected $_DFResiduals = 0;
|
protected $_DFResiduals = 0;
|
||||||
|
|
||||||
protected $_F = 0;
|
protected $_F = 0;
|
||||||
|
|
||||||
protected $_slope = 0;
|
protected $_slope = 0;
|
||||||
|
|
||||||
protected $_slopeSE = 0;
|
protected $_slopeSE = 0;
|
||||||
|
|
||||||
protected $_intersect = 0;
|
protected $_intersect = 0;
|
||||||
|
|
||||||
protected $_intersectSE = 0;
|
protected $_intersectSE = 0;
|
||||||
|
|
||||||
protected $_Xoffset = 0;
|
protected $_Xoffset = 0;
|
||||||
|
|
||||||
protected $_Yoffset = 0;
|
protected $_Yoffset = 0;
|
||||||
|
|
||||||
|
|
||||||
public function getError() {
|
public function getError() {
|
||||||
return $this->_error;
|
return $this->_error;
|
||||||
} // function getBestFitType()
|
} // function getBestFitType()
|
||||||
|
|
||||||
|
|
||||||
public function getBestFitType() {
|
public function getBestFitType() {
|
||||||
return $this->_bestFitType;
|
return $this->_bestFitType;
|
||||||
} // function getBestFitType()
|
} // function getBestFitType()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
*/
|
*/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue) {
|
||||||
return False;
|
return False;
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
*/
|
*/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue) {
|
||||||
return False;
|
return False;
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the original set of X-Values
|
* Return the original set of X-Values
|
||||||
*
|
*
|
||||||
* @return float[] X-Values
|
* @return float[] X-Values
|
||||||
*/
|
*/
|
||||||
public function getXValues() {
|
public function getXValues() {
|
||||||
return $this->_xValues;
|
return $this->_xValues;
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp=0) {
|
||||||
return False;
|
return False;
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Slope of the line
|
* Return the Slope of the line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSlope($dp=0) {
|
public function getSlope($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_slope,$dp);
|
return round($this->_slope,$dp);
|
||||||
}
|
}
|
||||||
return $this->_slope;
|
return $this->_slope;
|
||||||
} // function getSlope()
|
} // function getSlope()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the standard error of the Slope
|
* Return the standard error of the Slope
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSlopeSE($dp=0) {
|
public function getSlopeSE($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_slopeSE,$dp);
|
return round($this->_slopeSE,$dp);
|
||||||
}
|
}
|
||||||
return $this->_slopeSE;
|
return $this->_slopeSE;
|
||||||
} // function getSlopeSE()
|
} // function getSlopeSE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Value of X where it intersects Y = 0
|
* Return the Value of X where it intersects Y = 0
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIntersect($dp=0) {
|
public function getIntersect($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_intersect,$dp);
|
return round($this->_intersect,$dp);
|
||||||
}
|
}
|
||||||
return $this->_intersect;
|
return $this->_intersect;
|
||||||
} // function getIntersect()
|
} // function getIntersect()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the standard error of the Intersect
|
* Return the standard error of the Intersect
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIntersectSE($dp=0) {
|
public function getIntersectSE($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_intersectSE,$dp);
|
return round($this->_intersectSE,$dp);
|
||||||
}
|
}
|
||||||
return $this->_intersectSE;
|
return $this->_intersectSE;
|
||||||
} // function getIntersectSE()
|
} // function getIntersectSE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the goodness of fit for this regression
|
* Return the goodness of fit for this regression
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to return
|
* @param int $dp Number of places of decimal precision to return
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getGoodnessOfFit($dp=0) {
|
public function getGoodnessOfFit($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_goodnessOfFit,$dp);
|
return round($this->_goodnessOfFit,$dp);
|
||||||
}
|
}
|
||||||
return $this->_goodnessOfFit;
|
return $this->_goodnessOfFit;
|
||||||
} // function getGoodnessOfFit()
|
} // function getGoodnessOfFit()
|
||||||
|
|
||||||
|
|
||||||
public function getGoodnessOfFitPercent($dp=0) {
|
public function getGoodnessOfFitPercent($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_goodnessOfFit * 100,$dp);
|
return round($this->_goodnessOfFit * 100,$dp);
|
||||||
}
|
}
|
||||||
return $this->_goodnessOfFit * 100;
|
return $this->_goodnessOfFit * 100;
|
||||||
} // function getGoodnessOfFitPercent()
|
} // function getGoodnessOfFitPercent()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the standard deviation of the residuals for this regression
|
* Return the standard deviation of the residuals for this regression
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to return
|
* @param int $dp Number of places of decimal precision to return
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getStdevOfResiduals($dp=0) {
|
public function getStdevOfResiduals($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_stdevOfResiduals,$dp);
|
return round($this->_stdevOfResiduals,$dp);
|
||||||
}
|
}
|
||||||
return $this->_stdevOfResiduals;
|
return $this->_stdevOfResiduals;
|
||||||
} // function getStdevOfResiduals()
|
} // function getStdevOfResiduals()
|
||||||
|
|
||||||
|
|
||||||
public function getSSRegression($dp=0) {
|
public function getSSRegression($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_SSRegression,$dp);
|
return round($this->_SSRegression,$dp);
|
||||||
}
|
}
|
||||||
return $this->_SSRegression;
|
return $this->_SSRegression;
|
||||||
} // function getSSRegression()
|
} // function getSSRegression()
|
||||||
|
|
||||||
|
|
||||||
public function getSSResiduals($dp=0) {
|
public function getSSResiduals($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_SSResiduals,$dp);
|
return round($this->_SSResiduals,$dp);
|
||||||
}
|
}
|
||||||
return $this->_SSResiduals;
|
return $this->_SSResiduals;
|
||||||
} // function getSSResiduals()
|
} // function getSSResiduals()
|
||||||
|
|
||||||
|
|
||||||
public function getDFResiduals($dp=0) {
|
public function getDFResiduals($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_DFResiduals,$dp);
|
return round($this->_DFResiduals,$dp);
|
||||||
}
|
}
|
||||||
return $this->_DFResiduals;
|
return $this->_DFResiduals;
|
||||||
} // function getDFResiduals()
|
} // function getDFResiduals()
|
||||||
|
|
||||||
|
|
||||||
public function getF($dp=0) {
|
public function getF($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_F,$dp);
|
return round($this->_F,$dp);
|
||||||
}
|
}
|
||||||
return $this->_F;
|
return $this->_F;
|
||||||
} // function getF()
|
} // function getF()
|
||||||
|
|
||||||
|
|
||||||
public function getCovariance($dp=0) {
|
public function getCovariance($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_covariance,$dp);
|
return round($this->_covariance,$dp);
|
||||||
}
|
}
|
||||||
return $this->_covariance;
|
return $this->_covariance;
|
||||||
} // function getCovariance()
|
} // function getCovariance()
|
||||||
|
|
||||||
|
|
||||||
public function getCorrelation($dp=0) {
|
public function getCorrelation($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round($this->_correlation,$dp);
|
return round($this->_correlation,$dp);
|
||||||
}
|
}
|
||||||
return $this->_correlation;
|
return $this->_correlation;
|
||||||
} // function getCorrelation()
|
} // function getCorrelation()
|
||||||
|
|
||||||
|
|
||||||
public function getYBestFitValues() {
|
public function getYBestFitValues() {
|
||||||
return $this->_yBestFitValues;
|
return $this->_yBestFitValues;
|
||||||
} // function getYBestFitValues()
|
} // function getYBestFitValues()
|
||||||
|
|
||||||
|
|
||||||
protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) {
|
protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) {
|
||||||
$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
|
$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
|
||||||
foreach($this->_xValues as $xKey => $xValue) {
|
foreach($this->_xValues as $xKey => $xValue) {
|
||||||
$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||||
|
|
||||||
$SSres += ($this->_yValues[$xKey] - $bestFitY) * ($this->_yValues[$xKey] - $bestFitY);
|
$SSres += ($this->_yValues[$xKey] - $bestFitY) * ($this->_yValues[$xKey] - $bestFitY);
|
||||||
if ($const) {
|
if ($const) {
|
||||||
$SStot += ($this->_yValues[$xKey] - $meanY) * ($this->_yValues[$xKey] - $meanY);
|
$SStot += ($this->_yValues[$xKey] - $meanY) * ($this->_yValues[$xKey] - $meanY);
|
||||||
} else {
|
} else {
|
||||||
$SStot += $this->_yValues[$xKey] * $this->_yValues[$xKey];
|
$SStot += $this->_yValues[$xKey] * $this->_yValues[$xKey];
|
||||||
}
|
}
|
||||||
$SScov += ($this->_xValues[$xKey] - $meanX) * ($this->_yValues[$xKey] - $meanY);
|
$SScov += ($this->_xValues[$xKey] - $meanX) * ($this->_yValues[$xKey] - $meanY);
|
||||||
if ($const) {
|
if ($const) {
|
||||||
$SSsex += ($this->_xValues[$xKey] - $meanX) * ($this->_xValues[$xKey] - $meanX);
|
$SSsex += ($this->_xValues[$xKey] - $meanX) * ($this->_xValues[$xKey] - $meanX);
|
||||||
} else {
|
} else {
|
||||||
$SSsex += $this->_xValues[$xKey] * $this->_xValues[$xKey];
|
$SSsex += $this->_xValues[$xKey] * $this->_xValues[$xKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_SSResiduals = $SSres;
|
$this->_SSResiduals = $SSres;
|
||||||
$this->_DFResiduals = $this->_valueCount - 1 - $const;
|
$this->_DFResiduals = $this->_valueCount - 1 - $const;
|
||||||
|
|
||||||
if ($this->_DFResiduals == 0.0) {
|
if ($this->_DFResiduals == 0.0) {
|
||||||
$this->_stdevOfResiduals = 0.0;
|
$this->_stdevOfResiduals = 0.0;
|
||||||
} else {
|
} else {
|
||||||
$this->_stdevOfResiduals = sqrt($SSres / $this->_DFResiduals);
|
$this->_stdevOfResiduals = sqrt($SSres / $this->_DFResiduals);
|
||||||
}
|
}
|
||||||
if (($SStot == 0.0) || ($SSres == $SStot)) {
|
if (($SStot == 0.0) || ($SSres == $SStot)) {
|
||||||
$this->_goodnessOfFit = 1;
|
$this->_goodnessOfFit = 1;
|
||||||
} else {
|
} else {
|
||||||
$this->_goodnessOfFit = 1 - ($SSres / $SStot);
|
$this->_goodnessOfFit = 1 - ($SSres / $SStot);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_SSRegression = $this->_goodnessOfFit * $SStot;
|
$this->_SSRegression = $this->_goodnessOfFit * $SStot;
|
||||||
$this->_covariance = $SScov / $this->_valueCount;
|
$this->_covariance = $SScov / $this->_valueCount;
|
||||||
$this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX,2)) * ($this->_valueCount * $sumY2 - pow($sumY,2)));
|
$this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX,2)) * ($this->_valueCount * $sumY2 - pow($sumY,2)));
|
||||||
$this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex);
|
$this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex);
|
||||||
$this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2));
|
$this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2));
|
||||||
if ($this->_SSResiduals != 0.0) {
|
if ($this->_SSResiduals != 0.0) {
|
||||||
if ($this->_DFResiduals == 0.0) {
|
if ($this->_DFResiduals == 0.0) {
|
||||||
$this->_F = 0.0;
|
$this->_F = 0.0;
|
||||||
} else {
|
} else {
|
||||||
$this->_F = $this->_SSRegression / ($this->_SSResiduals / $this->_DFResiduals);
|
$this->_F = $this->_SSRegression / ($this->_SSResiduals / $this->_DFResiduals);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->_DFResiduals == 0.0) {
|
if ($this->_DFResiduals == 0.0) {
|
||||||
$this->_F = 0.0;
|
$this->_F = 0.0;
|
||||||
} else {
|
} else {
|
||||||
$this->_F = $this->_SSRegression / $this->_DFResiduals;
|
$this->_F = $this->_SSRegression / $this->_DFResiduals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // function _calculateGoodnessOfFit()
|
} // function _calculateGoodnessOfFit()
|
||||||
|
|
||||||
|
|
||||||
protected function _leastSquareFit($yValues, $xValues, $const) {
|
protected function _leastSquareFit($yValues, $xValues, $const) {
|
||||||
// calculate sums
|
// calculate sums
|
||||||
$x_sum = array_sum($xValues);
|
$x_sum = array_sum($xValues);
|
||||||
$y_sum = array_sum($yValues);
|
$y_sum = array_sum($yValues);
|
||||||
$meanX = $x_sum / $this->_valueCount;
|
$meanX = $x_sum / $this->_valueCount;
|
||||||
$meanY = $y_sum / $this->_valueCount;
|
$meanY = $y_sum / $this->_valueCount;
|
||||||
$mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0;
|
$mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0;
|
||||||
for($i = 0; $i < $this->_valueCount; ++$i) {
|
for($i = 0; $i < $this->_valueCount; ++$i) {
|
||||||
$xy_sum += $xValues[$i] * $yValues[$i];
|
$xy_sum += $xValues[$i] * $yValues[$i];
|
||||||
$xx_sum += $xValues[$i] * $xValues[$i];
|
$xx_sum += $xValues[$i] * $xValues[$i];
|
||||||
$yy_sum += $yValues[$i] * $yValues[$i];
|
$yy_sum += $yValues[$i] * $yValues[$i];
|
||||||
|
|
||||||
if ($const) {
|
if ($const) {
|
||||||
$mBase += ($xValues[$i] - $meanX) * ($yValues[$i] - $meanY);
|
$mBase += ($xValues[$i] - $meanX) * ($yValues[$i] - $meanY);
|
||||||
$mDivisor += ($xValues[$i] - $meanX) * ($xValues[$i] - $meanX);
|
$mDivisor += ($xValues[$i] - $meanX) * ($xValues[$i] - $meanX);
|
||||||
} else {
|
} else {
|
||||||
$mBase += $xValues[$i] * $yValues[$i];
|
$mBase += $xValues[$i] * $yValues[$i];
|
||||||
$mDivisor += $xValues[$i] * $xValues[$i];
|
$mDivisor += $xValues[$i] * $xValues[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate slope
|
// calculate slope
|
||||||
// $this->_slope = (($this->_valueCount * $xy_sum) - ($x_sum * $y_sum)) / (($this->_valueCount * $xx_sum) - ($x_sum * $x_sum));
|
// $this->_slope = (($this->_valueCount * $xy_sum) - ($x_sum * $y_sum)) / (($this->_valueCount * $xx_sum) - ($x_sum * $x_sum));
|
||||||
$this->_slope = $mBase / $mDivisor;
|
$this->_slope = $mBase / $mDivisor;
|
||||||
|
|
||||||
// calculate intersect
|
// calculate intersect
|
||||||
// $this->_intersect = ($y_sum - ($this->_slope * $x_sum)) / $this->_valueCount;
|
// $this->_intersect = ($y_sum - ($this->_slope * $x_sum)) / $this->_valueCount;
|
||||||
if ($const) {
|
if ($const) {
|
||||||
$this->_intersect = $meanY - ($this->_slope * $meanX);
|
$this->_intersect = $meanY - ($this->_slope * $meanX);
|
||||||
} else {
|
} else {
|
||||||
$this->_intersect = 0;
|
$this->_intersect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum,$meanX,$meanY,$const);
|
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum,$meanX,$meanY,$const);
|
||||||
} // function _leastSquareFit()
|
} // function _leastSquareFit()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression
|
* Define the regression
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues=array(), $const=True) {
|
||||||
// Calculate number of points
|
// Calculate number of points
|
||||||
$nY = count($yValues);
|
$nY = count($yValues);
|
||||||
$nX = count($xValues);
|
$nX = count($xValues);
|
||||||
|
|
||||||
// Define X Values if necessary
|
// Define X Values if necessary
|
||||||
if ($nX == 0) {
|
if ($nX == 0) {
|
||||||
$xValues = range(1,$nY);
|
$xValues = range(1,$nY);
|
||||||
$nX = $nY;
|
$nX = $nY;
|
||||||
} elseif ($nY != $nX) {
|
} elseif ($nY != $nX) {
|
||||||
// Ensure both arrays of points are the same size
|
// Ensure both arrays of points are the same size
|
||||||
$this->_error = True;
|
$this->_error = True;
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_valueCount = $nY;
|
$this->_valueCount = $nY;
|
||||||
$this->_xValues = $xValues;
|
$this->_xValues = $xValues;
|
||||||
$this->_yValues = $yValues;
|
$this->_yValues = $yValues;
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
} // class bestFit
|
} // class bestFit
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -38,111 +38,111 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Algorithm type to use for best-fit
|
* Algorithm type to use for best-fit
|
||||||
* (Name of this trend class)
|
* (Name of this trend class)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'exponential';
|
protected $_bestFitType = 'exponential';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue) {
|
||||||
return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset));
|
return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset));
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue) {
|
||||||
return log(($yValue + $this->_Yoffset) / $this->getIntersect()) / log($this->getSlope());
|
return log(($yValue + $this->_Yoffset) / $this->getIntersect()) / log($this->getSlope());
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp=0) {
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' * '.$slope.'^X';
|
return 'Y = '.$intersect.' * '.$slope.'^X';
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Slope of the line
|
* Return the Slope of the line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getSlope($dp=0) {
|
public function getSlope($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_slope),$dp);
|
return round(exp($this->_slope),$dp);
|
||||||
}
|
}
|
||||||
return exp($this->_slope);
|
return exp($this->_slope);
|
||||||
} // function getSlope()
|
} // function getSlope()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Value of X where it intersects Y = 0
|
* Return the Value of X where it intersects Y = 0
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getIntersect($dp=0) {
|
public function getIntersect($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_intersect),$dp);
|
return round(exp($this->_intersect),$dp);
|
||||||
}
|
}
|
||||||
return exp($this->_intersect);
|
return exp($this->_intersect);
|
||||||
} // function getIntersect()
|
} // function getIntersect()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _exponential_regression($yValues, $xValues, $const) {
|
private function _exponential_regression($yValues, $xValues, $const) {
|
||||||
foreach($yValues as &$value) {
|
foreach($yValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
} elseif ($value > 0.0) {
|
} elseif ($value > 0.0) {
|
||||||
$value = log($value);
|
$value = log($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
|
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _exponential_regression()
|
} // function _exponential_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues=array(), $const=True) {
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
if (parent::__construct($yValues, $xValues) !== False) {
|
||||||
$this->_exponential_regression($yValues, $xValues, $const);
|
$this->_exponential_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
} // class exponentialBestFit
|
} // class exponentialBestFit
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -38,74 +38,74 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Algorithm type to use for best-fit
|
* Algorithm type to use for best-fit
|
||||||
* (Name of this trend class)
|
* (Name of this trend class)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'linear';
|
protected $_bestFitType = 'linear';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue) {
|
||||||
return $this->getIntersect() + $this->getSlope() * $xValue;
|
return $this->getIntersect() + $this->getSlope() * $xValue;
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue) {
|
||||||
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp=0) {
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' + '.$slope.' * X';
|
return 'Y = '.$intersect.' + '.$slope.' * X';
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _linear_regression($yValues, $xValues, $const) {
|
private function _linear_regression($yValues, $xValues, $const) {
|
||||||
$this->_leastSquareFit($yValues, $xValues,$const);
|
$this->_leastSquareFit($yValues, $xValues,$const);
|
||||||
} // function _linear_regression()
|
} // function _linear_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues=array(), $const=True) {
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
if (parent::__construct($yValues, $xValues) !== False) {
|
||||||
$this->_linear_regression($yValues, $xValues, $const);
|
$this->_linear_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
} // class linearBestFit
|
} // class linearBestFit
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -38,83 +38,83 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Algorithm type to use for best-fit
|
* Algorithm type to use for best-fit
|
||||||
* (Name of this trend class)
|
* (Name of this trend class)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'logarithmic';
|
protected $_bestFitType = 'logarithmic';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue) {
|
||||||
return $this->getIntersect() + $this->getSlope() * log($xValue - $this->_Xoffset);
|
return $this->getIntersect() + $this->getSlope() * log($xValue - $this->_Xoffset);
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue) {
|
||||||
return exp(($yValue - $this->getIntersect()) / $this->getSlope());
|
return exp(($yValue - $this->getIntersect()) / $this->getSlope());
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp=0) {
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' + '.$slope.' * log(X)';
|
return 'Y = '.$intersect.' + '.$slope.' * log(X)';
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _logarithmic_regression($yValues, $xValues, $const) {
|
private function _logarithmic_regression($yValues, $xValues, $const) {
|
||||||
foreach($xValues as &$value) {
|
foreach($xValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
} elseif ($value > 0.0) {
|
} elseif ($value > 0.0) {
|
||||||
$value = log($value);
|
$value = log($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
|
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _logarithmic_regression()
|
} // function _logarithmic_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues=array(), $const=True) {
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
if (parent::__construct($yValues, $xValues) !== False) {
|
||||||
$this->_logarithmic_regression($yValues, $xValues, $const);
|
$this->_logarithmic_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
} // class logarithmicBestFit
|
} // class logarithmicBestFit
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -39,186 +39,186 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php';
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Algorithm type to use for best-fit
|
* Algorithm type to use for best-fit
|
||||||
* (Name of this trend class)
|
* (Name of this trend class)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'polynomial';
|
protected $_bestFitType = 'polynomial';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Polynomial order
|
* Polynomial order
|
||||||
*
|
*
|
||||||
* @protected
|
* @protected
|
||||||
* @var int
|
* @var int
|
||||||
**/
|
**/
|
||||||
protected $_order = 0;
|
protected $_order = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the order of this polynomial
|
* Return the order of this polynomial
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
**/
|
**/
|
||||||
public function getOrder() {
|
public function getOrder() {
|
||||||
return $this->_order;
|
return $this->_order;
|
||||||
} // function getOrder()
|
} // function getOrder()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue) {
|
||||||
$retVal = $this->getIntersect();
|
$retVal = $this->getIntersect();
|
||||||
$slope = $this->getSlope();
|
$slope = $this->getSlope();
|
||||||
foreach($slope as $key => $value) {
|
foreach($slope as $key => $value) {
|
||||||
if ($value != 0.0) {
|
if ($value != 0.0) {
|
||||||
$retVal += $value * pow($xValue, $key + 1);
|
$retVal += $value * pow($xValue, $key + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $retVal;
|
return $retVal;
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue) {
|
||||||
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
return ($yValue - $this->getIntersect()) / $this->getSlope();
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp=0) {
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
$equation = 'Y = '.$intersect;
|
$equation = 'Y = '.$intersect;
|
||||||
foreach($slope as $key => $value) {
|
foreach($slope as $key => $value) {
|
||||||
if ($value != 0.0) {
|
if ($value != 0.0) {
|
||||||
$equation .= ' + '.$value.' * X';
|
$equation .= ' + '.$value.' * X';
|
||||||
if ($key > 0) {
|
if ($key > 0) {
|
||||||
$equation .= '^'.($key + 1);
|
$equation .= '^'.($key + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $equation;
|
return $equation;
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Slope of the line
|
* Return the Slope of the line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getSlope($dp=0) {
|
public function getSlope($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
$coefficients = array();
|
$coefficients = array();
|
||||||
foreach($this->_slope as $coefficient) {
|
foreach($this->_slope as $coefficient) {
|
||||||
$coefficients[] = round($coefficient,$dp);
|
$coefficients[] = round($coefficient,$dp);
|
||||||
}
|
}
|
||||||
return $coefficients;
|
return $coefficients;
|
||||||
}
|
}
|
||||||
return $this->_slope;
|
return $this->_slope;
|
||||||
} // function getSlope()
|
} // function getSlope()
|
||||||
|
|
||||||
|
|
||||||
public function getCoefficients($dp=0) {
|
public function getCoefficients($dp=0) {
|
||||||
return array_merge(array($this->getIntersect($dp)),$this->getSlope($dp));
|
return array_merge(array($this->getIntersect($dp)),$this->getSlope($dp));
|
||||||
} // function getCoefficients()
|
} // function getCoefficients()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param int $order Order of Polynomial for this regression
|
* @param int $order Order of Polynomial for this regression
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _polynomial_regression($order, $yValues, $xValues, $const) {
|
private function _polynomial_regression($order, $yValues, $xValues, $const) {
|
||||||
// calculate sums
|
// calculate sums
|
||||||
$x_sum = array_sum($xValues);
|
$x_sum = array_sum($xValues);
|
||||||
$y_sum = array_sum($yValues);
|
$y_sum = array_sum($yValues);
|
||||||
$xx_sum = $xy_sum = 0;
|
$xx_sum = $xy_sum = 0;
|
||||||
for($i = 0; $i < $this->_valueCount; ++$i) {
|
for($i = 0; $i < $this->_valueCount; ++$i) {
|
||||||
$xy_sum += $xValues[$i] * $yValues[$i];
|
$xy_sum += $xValues[$i] * $yValues[$i];
|
||||||
$xx_sum += $xValues[$i] * $xValues[$i];
|
$xx_sum += $xValues[$i] * $xValues[$i];
|
||||||
$yy_sum += $yValues[$i] * $yValues[$i];
|
$yy_sum += $yValues[$i] * $yValues[$i];
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* This routine uses logic from the PHP port of polyfit version 0.1
|
* This routine uses logic from the PHP port of polyfit version 0.1
|
||||||
* written by Michael Bommarito and Paul Meagher
|
* written by Michael Bommarito and Paul Meagher
|
||||||
*
|
*
|
||||||
* The function fits a polynomial function of order $order through
|
* The function fits a polynomial function of order $order through
|
||||||
* a series of x-y data points using least squares.
|
* a series of x-y data points using least squares.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
for ($i = 0; $i < $this->_valueCount; ++$i) {
|
for ($i = 0; $i < $this->_valueCount; ++$i) {
|
||||||
for ($j = 0; $j <= $order; ++$j) {
|
for ($j = 0; $j <= $order; ++$j) {
|
||||||
$A[$i][$j] = pow($xValues[$i], $j);
|
$A[$i][$j] = pow($xValues[$i], $j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ($i=0; $i < $this->_valueCount; ++$i) {
|
for ($i=0; $i < $this->_valueCount; ++$i) {
|
||||||
$B[$i] = array($yValues[$i]);
|
$B[$i] = array($yValues[$i]);
|
||||||
}
|
}
|
||||||
$matrixA = new Matrix($A);
|
$matrixA = new Matrix($A);
|
||||||
$matrixB = new Matrix($B);
|
$matrixB = new Matrix($B);
|
||||||
$C = $matrixA->solve($matrixB);
|
$C = $matrixA->solve($matrixB);
|
||||||
|
|
||||||
$coefficients = array();
|
$coefficients = array();
|
||||||
for($i = 0; $i < $C->m; ++$i) {
|
for($i = 0; $i < $C->m; ++$i) {
|
||||||
$r = $C->get($i, 0);
|
$r = $C->get($i, 0);
|
||||||
if (abs($r) <= pow(10, -9)) {
|
if (abs($r) <= pow(10, -9)) {
|
||||||
$r = 0;
|
$r = 0;
|
||||||
}
|
}
|
||||||
$coefficients[] = $r;
|
$coefficients[] = $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_intersect = array_shift($coefficients);
|
$this->_intersect = array_shift($coefficients);
|
||||||
$this->_slope = $coefficients;
|
$this->_slope = $coefficients;
|
||||||
|
|
||||||
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum);
|
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum);
|
||||||
foreach($this->_xValues as $xKey => $xValue) {
|
foreach($this->_xValues as $xKey => $xValue) {
|
||||||
$this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
$this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||||
}
|
}
|
||||||
} // function _polynomial_regression()
|
} // function _polynomial_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param int $order Order of Polynomial for this regression
|
* @param int $order Order of Polynomial for this regression
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($order, $yValues, $xValues=array(), $const=True) {
|
function __construct($order, $yValues, $xValues=array(), $const=True) {
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
if (parent::__construct($yValues, $xValues) !== False) {
|
||||||
if ($order < $this->_valueCount) {
|
if ($order < $this->_valueCount) {
|
||||||
$this->_bestFitType .= '_'.$order;
|
$this->_bestFitType .= '_'.$order;
|
||||||
$this->_order = $order;
|
$this->_order = $order;
|
||||||
$this->_polynomial_regression($order, $yValues, $xValues, $const);
|
$this->_polynomial_regression($order, $yValues, $xValues, $const);
|
||||||
if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
|
if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
|
||||||
$this->_error = True;
|
$this->_error = True;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_error = True;
|
$this->_error = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
} // class polynomialBestFit
|
} // class polynomialBestFit
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -38,105 +38,105 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php';
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Algorithm type to use for best-fit
|
* Algorithm type to use for best-fit
|
||||||
* (Name of this trend class)
|
* (Name of this trend class)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $_bestFitType = 'power';
|
protected $_bestFitType = 'power';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Y-Value for a specified value of X
|
* Return the Y-Value for a specified value of X
|
||||||
*
|
*
|
||||||
* @param float $xValue X-Value
|
* @param float $xValue X-Value
|
||||||
* @return float Y-Value
|
* @return float Y-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfYForX($xValue) {
|
public function getValueOfYForX($xValue) {
|
||||||
return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope());
|
return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope());
|
||||||
} // function getValueOfYForX()
|
} // function getValueOfYForX()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the X-Value for a specified value of Y
|
* Return the X-Value for a specified value of Y
|
||||||
*
|
*
|
||||||
* @param float $yValue Y-Value
|
* @param float $yValue Y-Value
|
||||||
* @return float X-Value
|
* @return float X-Value
|
||||||
**/
|
**/
|
||||||
public function getValueOfXForY($yValue) {
|
public function getValueOfXForY($yValue) {
|
||||||
return pow((($yValue + $this->_Yoffset) / $this->getIntersect()),(1 / $this->getSlope()));
|
return pow((($yValue + $this->_Yoffset) / $this->getIntersect()),(1 / $this->getSlope()));
|
||||||
} // function getValueOfXForY()
|
} // function getValueOfXForY()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Equation of the best-fit line
|
* Return the Equation of the best-fit line
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getEquation($dp=0) {
|
public function getEquation($dp=0) {
|
||||||
$slope = $this->getSlope($dp);
|
$slope = $this->getSlope($dp);
|
||||||
$intersect = $this->getIntersect($dp);
|
$intersect = $this->getIntersect($dp);
|
||||||
|
|
||||||
return 'Y = '.$intersect.' * X^'.$slope;
|
return 'Y = '.$intersect.' * X^'.$slope;
|
||||||
} // function getEquation()
|
} // function getEquation()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Value of X where it intersects Y = 0
|
* Return the Value of X where it intersects Y = 0
|
||||||
*
|
*
|
||||||
* @param int $dp Number of places of decimal precision to display
|
* @param int $dp Number of places of decimal precision to display
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
public function getIntersect($dp=0) {
|
public function getIntersect($dp=0) {
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_intersect),$dp);
|
return round(exp($this->_intersect),$dp);
|
||||||
}
|
}
|
||||||
return exp($this->_intersect);
|
return exp($this->_intersect);
|
||||||
} // function getIntersect()
|
} // function getIntersect()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
* Execute the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
private function _power_regression($yValues, $xValues, $const) {
|
private function _power_regression($yValues, $xValues, $const) {
|
||||||
foreach($xValues as &$value) {
|
foreach($xValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
} elseif ($value > 0.0) {
|
} elseif ($value > 0.0) {
|
||||||
$value = log($value);
|
$value = log($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
foreach($yValues as &$value) {
|
foreach($yValues as &$value) {
|
||||||
if ($value < 0.0) {
|
if ($value < 0.0) {
|
||||||
$value = 0 - log(abs($value));
|
$value = 0 - log(abs($value));
|
||||||
} elseif ($value > 0.0) {
|
} elseif ($value > 0.0) {
|
||||||
$value = log($value);
|
$value = log($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
|
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _power_regression()
|
} // function _power_regression()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
* Define the regression and calculate the goodness of fit for a set of X and Y data values
|
||||||
*
|
*
|
||||||
* @param float[] $yValues The set of Y-values for this regression
|
* @param float[] $yValues The set of Y-values for this regression
|
||||||
* @param float[] $xValues The set of X-values for this regression
|
* @param float[] $xValues The set of X-values for this regression
|
||||||
* @param boolean $const
|
* @param boolean $const
|
||||||
*/
|
*/
|
||||||
function __construct($yValues, $xValues=array(), $const=True) {
|
function __construct($yValues, $xValues=array(), $const=True) {
|
||||||
if (parent::__construct($yValues, $xValues) !== False) {
|
if (parent::__construct($yValues, $xValues) !== False) {
|
||||||
$this->_power_regression($yValues, $xValues, $const);
|
$this->_power_regression($yValues, $xValues, $const);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
} // class powerBestFit
|
} // class powerBestFit
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Trend
|
* @package PHPExcel_Shared_Trend
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -42,115 +42,115 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/polynomialBestFitClass.php';
|
|||||||
*/
|
*/
|
||||||
class trendClass
|
class trendClass
|
||||||
{
|
{
|
||||||
const TREND_LINEAR = 'Linear';
|
const TREND_LINEAR = 'Linear';
|
||||||
const TREND_LOGARITHMIC = 'Logarithmic';
|
const TREND_LOGARITHMIC = 'Logarithmic';
|
||||||
const TREND_EXPONENTIAL = 'Exponential';
|
const TREND_EXPONENTIAL = 'Exponential';
|
||||||
const TREND_POWER = 'Power';
|
const TREND_POWER = 'Power';
|
||||||
const TREND_POLYNOMIAL_2 = 'Polynomial_2';
|
const TREND_POLYNOMIAL_2 = 'Polynomial_2';
|
||||||
const TREND_POLYNOMIAL_3 = 'Polynomial_3';
|
const TREND_POLYNOMIAL_3 = 'Polynomial_3';
|
||||||
const TREND_POLYNOMIAL_4 = 'Polynomial_4';
|
const TREND_POLYNOMIAL_4 = 'Polynomial_4';
|
||||||
const TREND_POLYNOMIAL_5 = 'Polynomial_5';
|
const TREND_POLYNOMIAL_5 = 'Polynomial_5';
|
||||||
const TREND_POLYNOMIAL_6 = 'Polynomial_6';
|
const TREND_POLYNOMIAL_6 = 'Polynomial_6';
|
||||||
const TREND_BEST_FIT = 'Bestfit';
|
const TREND_BEST_FIT = 'Bestfit';
|
||||||
const TREND_BEST_FIT_NO_POLY = 'Bestfit_no_Polynomials';
|
const TREND_BEST_FIT_NO_POLY = 'Bestfit_no_Polynomials';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Names of the best-fit trend analysis methods
|
* Names of the best-fit trend analysis methods
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
**/
|
**/
|
||||||
private static $_trendTypes = array( self::TREND_LINEAR,
|
private static $_trendTypes = array( self::TREND_LINEAR,
|
||||||
self::TREND_LOGARITHMIC,
|
self::TREND_LOGARITHMIC,
|
||||||
self::TREND_EXPONENTIAL,
|
self::TREND_EXPONENTIAL,
|
||||||
self::TREND_POWER
|
self::TREND_POWER
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* Names of the best-fit trend polynomial orders
|
* Names of the best-fit trend polynomial orders
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
**/
|
**/
|
||||||
private static $_trendTypePolyOrders = array( self::TREND_POLYNOMIAL_2,
|
private static $_trendTypePolyOrders = array( self::TREND_POLYNOMIAL_2,
|
||||||
self::TREND_POLYNOMIAL_3,
|
self::TREND_POLYNOMIAL_3,
|
||||||
self::TREND_POLYNOMIAL_4,
|
self::TREND_POLYNOMIAL_4,
|
||||||
self::TREND_POLYNOMIAL_5,
|
self::TREND_POLYNOMIAL_5,
|
||||||
self::TREND_POLYNOMIAL_6
|
self::TREND_POLYNOMIAL_6
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached results for each method when trying to identify which provides the best fit
|
* Cached results for each method when trying to identify which provides the best fit
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Best_Fit[]
|
* @var PHPExcel_Best_Fit[]
|
||||||
**/
|
**/
|
||||||
private static $_trendCache = array();
|
private static $_trendCache = array();
|
||||||
|
|
||||||
|
|
||||||
public static function calculate($trendType=self::TREND_BEST_FIT, $yValues, $xValues=array(), $const=True) {
|
public static function calculate($trendType=self::TREND_BEST_FIT, $yValues, $xValues=array(), $const=True) {
|
||||||
// Calculate number of points in each dataset
|
// Calculate number of points in each dataset
|
||||||
$nY = count($yValues);
|
$nY = count($yValues);
|
||||||
$nX = count($xValues);
|
$nX = count($xValues);
|
||||||
|
|
||||||
// Define X Values if necessary
|
// Define X Values if necessary
|
||||||
if ($nX == 0) {
|
if ($nX == 0) {
|
||||||
$xValues = range(1,$nY);
|
$xValues = range(1,$nY);
|
||||||
$nX = $nY;
|
$nX = $nY;
|
||||||
} elseif ($nY != $nX) {
|
} elseif ($nY != $nX) {
|
||||||
// Ensure both arrays of points are the same size
|
// Ensure both arrays of points are the same size
|
||||||
trigger_error("trend(): Number of elements in coordinate arrays do not match.", E_USER_ERROR);
|
trigger_error("trend(): Number of elements in coordinate arrays do not match.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = md5($trendType.$const.serialize($yValues).serialize($xValues));
|
$key = md5($trendType.$const.serialize($yValues).serialize($xValues));
|
||||||
// Determine which trend method has been requested
|
// Determine which trend method has been requested
|
||||||
switch ($trendType) {
|
switch ($trendType) {
|
||||||
// Instantiate and return the class for the requested trend method
|
// Instantiate and return the class for the requested trend method
|
||||||
case self::TREND_LINEAR :
|
case self::TREND_LINEAR :
|
||||||
case self::TREND_LOGARITHMIC :
|
case self::TREND_LOGARITHMIC :
|
||||||
case self::TREND_EXPONENTIAL :
|
case self::TREND_EXPONENTIAL :
|
||||||
case self::TREND_POWER :
|
case self::TREND_POWER :
|
||||||
if (!isset(self::$_trendCache[$key])) {
|
if (!isset(self::$_trendCache[$key])) {
|
||||||
$className = 'PHPExcel_'.$trendType.'_Best_Fit';
|
$className = 'PHPExcel_'.$trendType.'_Best_Fit';
|
||||||
self::$_trendCache[$key] = new $className($yValues,$xValues,$const);
|
self::$_trendCache[$key] = new $className($yValues,$xValues,$const);
|
||||||
}
|
}
|
||||||
return self::$_trendCache[$key];
|
return self::$_trendCache[$key];
|
||||||
break;
|
break;
|
||||||
case self::TREND_POLYNOMIAL_2 :
|
case self::TREND_POLYNOMIAL_2 :
|
||||||
case self::TREND_POLYNOMIAL_3 :
|
case self::TREND_POLYNOMIAL_3 :
|
||||||
case self::TREND_POLYNOMIAL_4 :
|
case self::TREND_POLYNOMIAL_4 :
|
||||||
case self::TREND_POLYNOMIAL_5 :
|
case self::TREND_POLYNOMIAL_5 :
|
||||||
case self::TREND_POLYNOMIAL_6 :
|
case self::TREND_POLYNOMIAL_6 :
|
||||||
if (!isset(self::$_trendCache[$key])) {
|
if (!isset(self::$_trendCache[$key])) {
|
||||||
$order = substr($trendType,-1);
|
$order = substr($trendType,-1);
|
||||||
self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
||||||
}
|
}
|
||||||
return self::$_trendCache[$key];
|
return self::$_trendCache[$key];
|
||||||
break;
|
break;
|
||||||
case self::TREND_BEST_FIT :
|
case self::TREND_BEST_FIT :
|
||||||
case self::TREND_BEST_FIT_NO_POLY :
|
case self::TREND_BEST_FIT_NO_POLY :
|
||||||
// If the request is to determine the best fit regression, then we test each trend line in turn
|
// If the request is to determine the best fit regression, then we test each trend line in turn
|
||||||
// Start by generating an instance of each available trend method
|
// Start by generating an instance of each available trend method
|
||||||
foreach(self::$_trendTypes as $trendMethod) {
|
foreach(self::$_trendTypes as $trendMethod) {
|
||||||
$className = 'PHPExcel_'.$trendMethod.'BestFit';
|
$className = 'PHPExcel_'.$trendMethod.'BestFit';
|
||||||
$bestFit[$trendMethod] = new $className($yValues,$xValues,$const);
|
$bestFit[$trendMethod] = new $className($yValues,$xValues,$const);
|
||||||
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
|
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
|
||||||
}
|
}
|
||||||
if ($trendType != self::TREND_BEST_FIT_NO_POLY) {
|
if ($trendType != self::TREND_BEST_FIT_NO_POLY) {
|
||||||
foreach(self::$_trendTypePolyOrders as $trendMethod) {
|
foreach(self::$_trendTypePolyOrders as $trendMethod) {
|
||||||
$order = substr($trendMethod,-1);
|
$order = substr($trendMethod,-1);
|
||||||
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
||||||
if ($bestFit[$trendMethod]->getError()) {
|
if ($bestFit[$trendMethod]->getError()) {
|
||||||
unset($bestFit[$trendMethod]);
|
unset($bestFit[$trendMethod]);
|
||||||
} else {
|
} else {
|
||||||
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
|
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Determine which of our trend lines is the best fit, and then we return the instance of that trend class
|
// Determine which of our trend lines is the best fit, and then we return the instance of that trend class
|
||||||
arsort($bestFitValue);
|
arsort($bestFitValue);
|
||||||
$bestFitType = key($bestFitValue);
|
$bestFitType = key($bestFitValue);
|
||||||
return $bestFit[$bestFitType];
|
return $bestFit[$bestFitType];
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // function calculate()
|
} // function calculate()
|
||||||
|
|
||||||
} // class trendClass
|
} // class trendClass
|
File diff suppressed because it is too large
Load Diff
@ -18,377 +18,377 @@
|
|||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Worksheet_AutoFilter_Column
|
* PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_AutoFilter_Column
|
class PHPExcel_Worksheet_AutoFilter_Column
|
||||||
{
|
{
|
||||||
const AUTOFILTER_FILTERTYPE_FILTER = 'filters';
|
const AUTOFILTER_FILTERTYPE_FILTER = 'filters';
|
||||||
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters';
|
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters';
|
||||||
// Supports no more than 2 rules, with an And/Or join criteria
|
// Supports no more than 2 rules, with an And/Or join criteria
|
||||||
// if more than 1 rule is defined
|
// if more than 1 rule is defined
|
||||||
const AUTOFILTER_FILTERTYPE_DYNAMICFILTER = 'dynamicFilter';
|
const AUTOFILTER_FILTERTYPE_DYNAMICFILTER = 'dynamicFilter';
|
||||||
// Even though the filter rule is constant, the filtered data can vary
|
// Even though the filter rule is constant, the filtered data can vary
|
||||||
// e.g. filtered by date = TODAY
|
// e.g. filtered by date = TODAY
|
||||||
const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10';
|
const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types of autofilter rules
|
* Types of autofilter rules
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private static $_filterTypes = array(
|
private static $_filterTypes = array(
|
||||||
// Currently we're not handling
|
// Currently we're not handling
|
||||||
// colorFilter
|
// colorFilter
|
||||||
// extLst
|
// extLst
|
||||||
// iconFilter
|
// iconFilter
|
||||||
self::AUTOFILTER_FILTERTYPE_FILTER,
|
self::AUTOFILTER_FILTERTYPE_FILTER,
|
||||||
self::AUTOFILTER_FILTERTYPE_CUSTOMFILTER,
|
self::AUTOFILTER_FILTERTYPE_CUSTOMFILTER,
|
||||||
self::AUTOFILTER_FILTERTYPE_DYNAMICFILTER,
|
self::AUTOFILTER_FILTERTYPE_DYNAMICFILTER,
|
||||||
self::AUTOFILTER_FILTERTYPE_TOPTENFILTER,
|
self::AUTOFILTER_FILTERTYPE_TOPTENFILTER,
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Multiple Rule Connections */
|
/* Multiple Rule Connections */
|
||||||
const AUTOFILTER_COLUMN_JOIN_AND = 'and';
|
const AUTOFILTER_COLUMN_JOIN_AND = 'and';
|
||||||
const AUTOFILTER_COLUMN_JOIN_OR = 'or';
|
const AUTOFILTER_COLUMN_JOIN_OR = 'or';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join options for autofilter rules
|
* Join options for autofilter rules
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private static $_ruleJoins = array(
|
private static $_ruleJoins = array(
|
||||||
self::AUTOFILTER_COLUMN_JOIN_AND,
|
self::AUTOFILTER_COLUMN_JOIN_AND,
|
||||||
self::AUTOFILTER_COLUMN_JOIN_OR,
|
self::AUTOFILTER_COLUMN_JOIN_OR,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter
|
* Autofilter
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet_AutoFilter
|
* @var PHPExcel_Worksheet_AutoFilter
|
||||||
*/
|
*/
|
||||||
private $_parent = NULL;
|
private $_parent = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Column Index
|
* Autofilter Column Index
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_columnIndex = '';
|
private $_columnIndex = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Column Filter Type
|
* Autofilter Column Filter Type
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_filterType = self::AUTOFILTER_FILTERTYPE_FILTER;
|
private $_filterType = self::AUTOFILTER_FILTERTYPE_FILTER;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Multiple Rules And/Or
|
* Autofilter Multiple Rules And/Or
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_join = self::AUTOFILTER_COLUMN_JOIN_OR;
|
private $_join = self::AUTOFILTER_COLUMN_JOIN_OR;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Column Rules
|
* Autofilter Column Rules
|
||||||
*
|
*
|
||||||
* @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
private $_ruleset = array();
|
private $_ruleset = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Column Dynamic Attributes
|
* Autofilter Column Dynamic Attributes
|
||||||
*
|
*
|
||||||
* @var array of mixed
|
* @var array of mixed
|
||||||
*/
|
*/
|
||||||
private $_attributes = array();
|
private $_attributes = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_AutoFilter_Column
|
* Create a new PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*
|
*
|
||||||
* @param string $pColumn Column (e.g. A)
|
* @param string $pColumn Column (e.g. A)
|
||||||
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column
|
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column
|
||||||
*/
|
*/
|
||||||
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL)
|
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL)
|
||||||
{
|
{
|
||||||
$this->_columnIndex = $pColumn;
|
$this->_columnIndex = $pColumn;
|
||||||
$this->_parent = $pParent;
|
$this->_parent = $pParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Column Index
|
* Get AutoFilter Column Index
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getColumnIndex() {
|
public function getColumnIndex() {
|
||||||
return $this->_columnIndex;
|
return $this->_columnIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Column Index
|
* Set AutoFilter Column Index
|
||||||
*
|
*
|
||||||
* @param string $pColumn Column (e.g. A)
|
* @param string $pColumn Column (e.g. A)
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setColumnIndex($pColumn) {
|
public function setColumnIndex($pColumn) {
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
$pColumn = strtoupper($pColumn);
|
$pColumn = strtoupper($pColumn);
|
||||||
if ($this->_parent !== NULL) {
|
if ($this->_parent !== NULL) {
|
||||||
$this->_parent->testColumnInRange($pColumn);
|
$this->_parent->testColumnInRange($pColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_columnIndex = $pColumn;
|
$this->_columnIndex = $pColumn;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this Column's AutoFilter Parent
|
* Get this Column's AutoFilter Parent
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet_AutoFilter
|
* @return PHPExcel_Worksheet_AutoFilter
|
||||||
*/
|
*/
|
||||||
public function getParent() {
|
public function getParent() {
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this Column's AutoFilter Parent
|
* Set this Column's AutoFilter Parent
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet_AutoFilter
|
* @param PHPExcel_Worksheet_AutoFilter
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) {
|
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) {
|
||||||
$this->_parent = $pParent;
|
$this->_parent = $pParent;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Type
|
* Get AutoFilter Type
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFilterType() {
|
public function getFilterType() {
|
||||||
return $this->_filterType;
|
return $this->_filterType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Type
|
* Set AutoFilter Type
|
||||||
*
|
*
|
||||||
* @param string $pFilterType
|
* @param string $pFilterType
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
|
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
|
||||||
if (!in_array($pFilterType,self::$_filterTypes)) {
|
if (!in_array($pFilterType,self::$_filterTypes)) {
|
||||||
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
|
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_filterType = $pFilterType;
|
$this->_filterType = $pFilterType;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Multiple Rules And/Or Join
|
* Get AutoFilter Multiple Rules And/Or Join
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getJoin() {
|
public function getJoin() {
|
||||||
return $this->_join;
|
return $this->_join;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Multiple Rules And/Or
|
* Set AutoFilter Multiple Rules And/Or
|
||||||
*
|
*
|
||||||
* @param string $pJoin And/Or
|
* @param string $pJoin And/Or
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) {
|
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) {
|
||||||
// Lowercase And/Or
|
// Lowercase And/Or
|
||||||
$pJoin = strtolower($pJoin);
|
$pJoin = strtolower($pJoin);
|
||||||
if (!in_array($pJoin,self::$_ruleJoins)) {
|
if (!in_array($pJoin,self::$_ruleJoins)) {
|
||||||
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
|
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_join = $pJoin;
|
$this->_join = $pJoin;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Attributes
|
* Set AutoFilter Attributes
|
||||||
*
|
*
|
||||||
* @param string[] $pAttributes
|
* @param string[] $pAttributes
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setAttributes($pAttributes = array()) {
|
public function setAttributes($pAttributes = array()) {
|
||||||
$this->_attributes = $pAttributes;
|
$this->_attributes = $pAttributes;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set An AutoFilter Attribute
|
* Set An AutoFilter Attribute
|
||||||
*
|
*
|
||||||
* @param string $pName Attribute Name
|
* @param string $pName Attribute Name
|
||||||
* @param string $pValue Attribute Value
|
* @param string $pValue Attribute Value
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setAttribute($pName, $pValue) {
|
public function setAttribute($pName, $pValue) {
|
||||||
$this->_attributes[$pName] = $pValue;
|
$this->_attributes[$pName] = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Column Attributes
|
* Get AutoFilter Column Attributes
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAttributes() {
|
public function getAttributes() {
|
||||||
return $this->_attributes;
|
return $this->_attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get specific AutoFilter Column Attribute
|
* Get specific AutoFilter Column Attribute
|
||||||
*
|
*
|
||||||
* @param string $pName Attribute Name
|
* @param string $pName Attribute Name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAttribute($pName) {
|
public function getAttribute($pName) {
|
||||||
if (isset($this->_attributes[$pName]))
|
if (isset($this->_attributes[$pName]))
|
||||||
return $this->_attributes[$pName];
|
return $this->_attributes[$pName];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all AutoFilter Column Rules
|
* Get all AutoFilter Column Rules
|
||||||
*
|
*
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function getRules() {
|
public function getRules() {
|
||||||
return $this->_ruleset;
|
return $this->_ruleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a specified AutoFilter Column Rule
|
* Get a specified AutoFilter Column Rule
|
||||||
*
|
*
|
||||||
* @param integer $pIndex Rule index in the ruleset array
|
* @param integer $pIndex Rule index in the ruleset array
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function getRule($pIndex) {
|
public function getRule($pIndex) {
|
||||||
if (!isset($this->_ruleset[$pIndex])) {
|
if (!isset($this->_ruleset[$pIndex])) {
|
||||||
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||||
}
|
}
|
||||||
return $this->_ruleset[$pIndex];
|
return $this->_ruleset[$pIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new AutoFilter Column Rule in the ruleset
|
* Create a new AutoFilter Column Rule in the ruleset
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function createRule() {
|
public function createRule() {
|
||||||
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||||
|
|
||||||
return end($this->_ruleset);
|
return end($this->_ruleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new AutoFilter Column Rule to the ruleset
|
* Add a new AutoFilter Column Rule to the ruleset
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule
|
* @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule
|
||||||
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
|
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) {
|
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) {
|
||||||
$pRule->setParent($this);
|
$pRule->setParent($this);
|
||||||
$this->_ruleset[] = $pRule;
|
$this->_ruleset[] = $pRule;
|
||||||
|
|
||||||
return ($returnRule) ? $pRule : $this;
|
return ($returnRule) ? $pRule : $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a specified AutoFilter Column Rule
|
* Delete a specified AutoFilter Column Rule
|
||||||
* If the number of rules is reduced to 1, then we reset And/Or logic to Or
|
* If the number of rules is reduced to 1, then we reset And/Or logic to Or
|
||||||
*
|
*
|
||||||
* @param integer $pIndex Rule index in the ruleset array
|
* @param integer $pIndex Rule index in the ruleset array
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function deleteRule($pIndex) {
|
public function deleteRule($pIndex) {
|
||||||
if (isset($this->_ruleset[$pIndex])) {
|
if (isset($this->_ruleset[$pIndex])) {
|
||||||
unset($this->_ruleset[$pIndex]);
|
unset($this->_ruleset[$pIndex]);
|
||||||
// If we've just deleted down to a single rule, then reset And/Or joining to Or
|
// If we've just deleted down to a single rule, then reset And/Or joining to Or
|
||||||
if (count($this->_ruleset) <= 1) {
|
if (count($this->_ruleset) <= 1) {
|
||||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all AutoFilter Column Rules
|
* Delete all AutoFilter Column Rules
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function clearRules() {
|
public function clearRules() {
|
||||||
$this->_ruleset = array();
|
$this->_ruleset = array();
|
||||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
if ($key == '_parent') {
|
if ($key == '_parent') {
|
||||||
// Detach from autofilter parent
|
// Detach from autofilter parent
|
||||||
$this->$key = NULL;
|
$this->$key = NULL;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
}
|
}
|
||||||
} elseif ((is_array($value)) && ($key == '_ruleset')) {
|
} elseif ((is_array($value)) && ($key == '_ruleset')) {
|
||||||
// The columns array of PHPExcel_Worksheet_AutoFilter objects
|
// The columns array of PHPExcel_Worksheet_AutoFilter objects
|
||||||
$this->$key = array();
|
$this->$key = array();
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
$this->$key[$k] = clone $v;
|
$this->$key[$k] = clone $v;
|
||||||
// attach the new cloned Rule to this new cloned Autofilter Cloned object
|
// attach the new cloned Rule to this new cloned Autofilter Cloned object
|
||||||
$this->$key[$k]->setParent($this);
|
$this->$key[$k]->setParent($this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,447 +18,447 @@
|
|||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
{
|
{
|
||||||
const AUTOFILTER_RULETYPE_FILTER = 'filter';
|
const AUTOFILTER_RULETYPE_FILTER = 'filter';
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem';
|
const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem';
|
||||||
const AUTOFILTER_RULETYPE_CUSTOMFILTER = 'customFilter';
|
const AUTOFILTER_RULETYPE_CUSTOMFILTER = 'customFilter';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMICFILTER = 'dynamicFilter';
|
const AUTOFILTER_RULETYPE_DYNAMICFILTER = 'dynamicFilter';
|
||||||
const AUTOFILTER_RULETYPE_TOPTENFILTER = 'top10Filter';
|
const AUTOFILTER_RULETYPE_TOPTENFILTER = 'top10Filter';
|
||||||
|
|
||||||
private static $_ruleTypes = array(
|
private static $_ruleTypes = array(
|
||||||
// Currently we're not handling
|
// Currently we're not handling
|
||||||
// colorFilter
|
// colorFilter
|
||||||
// extLst
|
// extLst
|
||||||
// iconFilter
|
// iconFilter
|
||||||
self::AUTOFILTER_RULETYPE_FILTER,
|
self::AUTOFILTER_RULETYPE_FILTER,
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP,
|
self::AUTOFILTER_RULETYPE_DATEGROUP,
|
||||||
self::AUTOFILTER_RULETYPE_CUSTOMFILTER,
|
self::AUTOFILTER_RULETYPE_CUSTOMFILTER,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMICFILTER,
|
self::AUTOFILTER_RULETYPE_DYNAMICFILTER,
|
||||||
self::AUTOFILTER_RULETYPE_TOPTENFILTER,
|
self::AUTOFILTER_RULETYPE_TOPTENFILTER,
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP_YEAR = 'year';
|
const AUTOFILTER_RULETYPE_DATEGROUP_YEAR = 'year';
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP_MONTH = 'month';
|
const AUTOFILTER_RULETYPE_DATEGROUP_MONTH = 'month';
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP_DAY = 'day';
|
const AUTOFILTER_RULETYPE_DATEGROUP_DAY = 'day';
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP_HOUR = 'hour';
|
const AUTOFILTER_RULETYPE_DATEGROUP_HOUR = 'hour';
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP_MINUTE = 'minute';
|
const AUTOFILTER_RULETYPE_DATEGROUP_MINUTE = 'minute';
|
||||||
const AUTOFILTER_RULETYPE_DATEGROUP_SECOND = 'second';
|
const AUTOFILTER_RULETYPE_DATEGROUP_SECOND = 'second';
|
||||||
|
|
||||||
private static $_dateTimeGroups = array(
|
private static $_dateTimeGroups = array(
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP_YEAR,
|
self::AUTOFILTER_RULETYPE_DATEGROUP_YEAR,
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP_MONTH,
|
self::AUTOFILTER_RULETYPE_DATEGROUP_MONTH,
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP_DAY,
|
self::AUTOFILTER_RULETYPE_DATEGROUP_DAY,
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP_HOUR,
|
self::AUTOFILTER_RULETYPE_DATEGROUP_HOUR,
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE,
|
self::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE,
|
||||||
self::AUTOFILTER_RULETYPE_DATEGROUP_SECOND,
|
self::AUTOFILTER_RULETYPE_DATEGROUP_SECOND,
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY = 'yesterday';
|
const AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY = 'yesterday';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_TODAY = 'today';
|
const AUTOFILTER_RULETYPE_DYNAMIC_TODAY = 'today';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW = 'tomorrow';
|
const AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW = 'tomorrow';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE = 'yearToDate';
|
const AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE = 'yearToDate';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR = 'thisYear';
|
const AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR = 'thisYear';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER = 'thisQuarter';
|
const AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER = 'thisQuarter';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH = 'thisMonth';
|
const AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH = 'thisMonth';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK = 'thisWeek';
|
const AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK = 'thisWeek';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR = 'lastYear';
|
const AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR = 'lastYear';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER = 'lastQuarter';
|
const AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER = 'lastQuarter';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH = 'lastMonth';
|
const AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH = 'lastMonth';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK = 'lastWeek';
|
const AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK = 'lastWeek';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR = 'nextYear';
|
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR = 'nextYear';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER = 'nextQuarter';
|
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER = 'nextQuarter';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH = 'nextMonth';
|
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH = 'nextMonth';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK = 'nextWeek';
|
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK = 'nextWeek';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 = 'M1';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 = 'M1';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_JANUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1;
|
const AUTOFILTER_RULETYPE_DYNAMIC_JANUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 = 'M2';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 = 'M2';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2;
|
const AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 = 'M3';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 = 'M3';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MARCH = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3;
|
const AUTOFILTER_RULETYPE_DYNAMIC_MARCH = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 = 'M4';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 = 'M4';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_APRIL = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4;
|
const AUTOFILTER_RULETYPE_DYNAMIC_APRIL = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 = 'M5';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 = 'M5';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MAY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5;
|
const AUTOFILTER_RULETYPE_DYNAMIC_MAY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 = 'M6';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 = 'M6';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_JUNE = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6;
|
const AUTOFILTER_RULETYPE_DYNAMIC_JUNE = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 = 'M7';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 = 'M7';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_JULY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7;
|
const AUTOFILTER_RULETYPE_DYNAMIC_JULY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 = 'M8';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 = 'M8';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_AUGUST = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8;
|
const AUTOFILTER_RULETYPE_DYNAMIC_AUGUST = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 = 'M9';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 = 'M9';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9;
|
const AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 = 'M10';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 = 'M10';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10;
|
const AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 = 'M11';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 = 'M11';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11;
|
const AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 = 'M12';
|
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 = 'M12';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12;
|
const AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12;
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 = 'Q1';
|
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 = 'Q1';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 = 'Q2';
|
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 = 'Q2';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 = 'Q3';
|
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 = 'Q3';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 = 'Q4';
|
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 = 'Q4';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE = 'aboveAverage';
|
const AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE = 'aboveAverage';
|
||||||
const AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE = 'belowAverage';
|
const AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE = 'belowAverage';
|
||||||
|
|
||||||
private static $_dynamicTypes = array(
|
private static $_dynamicTypes = array(
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_TODAY,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_TODAY,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE,
|
||||||
self::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE,
|
self::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE,
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The only valid filter rule operators for filter and customFilter types are:
|
* The only valid filter rule operators for filter and customFilter types are:
|
||||||
* <xsd:enumeration value="equal"/>
|
* <xsd:enumeration value="equal"/>
|
||||||
* <xsd:enumeration value="lessThan"/>
|
* <xsd:enumeration value="lessThan"/>
|
||||||
* <xsd:enumeration value="lessThanOrEqual"/>
|
* <xsd:enumeration value="lessThanOrEqual"/>
|
||||||
* <xsd:enumeration value="notEqual"/>
|
* <xsd:enumeration value="notEqual"/>
|
||||||
* <xsd:enumeration value="greaterThanOrEqual"/>
|
* <xsd:enumeration value="greaterThanOrEqual"/>
|
||||||
* <xsd:enumeration value="greaterThan"/>
|
* <xsd:enumeration value="greaterThan"/>
|
||||||
*/
|
*/
|
||||||
const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal';
|
const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal';
|
||||||
const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual';
|
const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual';
|
||||||
const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan';
|
const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan';
|
||||||
const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||||
const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan';
|
const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan';
|
||||||
const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual';
|
const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||||
|
|
||||||
private static $_operators = array(
|
private static $_operators = array(
|
||||||
self::AUTOFILTER_COLUMN_RULE_EQUAL,
|
self::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
self::AUTOFILTER_COLUMN_RULE_NOTEQUAL,
|
self::AUTOFILTER_COLUMN_RULE_NOTEQUAL,
|
||||||
self::AUTOFILTER_COLUMN_RULE_GREATERTHAN,
|
self::AUTOFILTER_COLUMN_RULE_GREATERTHAN,
|
||||||
self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
||||||
self::AUTOFILTER_COLUMN_RULE_LESSTHAN,
|
self::AUTOFILTER_COLUMN_RULE_LESSTHAN,
|
||||||
self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue';
|
const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue';
|
||||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent';
|
const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent';
|
||||||
|
|
||||||
private static $_topTenValue = array(
|
private static $_topTenValue = array(
|
||||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
|
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
|
||||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
|
self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top';
|
const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top';
|
||||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom';
|
const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom';
|
||||||
|
|
||||||
private static $_topTenType = array(
|
private static $_topTenType = array(
|
||||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP,
|
self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP,
|
||||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM,
|
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/* Rule Operators (Numeric, Boolean etc) */
|
/* Rule Operators (Numeric, Boolean etc) */
|
||||||
// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2
|
// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2
|
||||||
/* Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values */
|
/* Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values */
|
||||||
// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value
|
// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value
|
||||||
// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value
|
// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value
|
||||||
// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average
|
// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average
|
||||||
// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average
|
// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average
|
||||||
/* Rule Operators (String) which are set as wild-carded values */
|
/* Rule Operators (String) which are set as wild-carded values */
|
||||||
// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A*
|
// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A*
|
||||||
// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z
|
// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z
|
||||||
// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B*
|
// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B*
|
||||||
// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B*
|
// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B*
|
||||||
/* Rule Operators (Date Special) which are translated to standard numeric operators with calculated values */
|
/* Rule Operators (Date Special) which are translated to standard numeric operators with calculated values */
|
||||||
// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan';
|
// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan';
|
||||||
// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan';
|
// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan';
|
||||||
// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday';
|
// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday';
|
||||||
// const AUTOFILTER_COLUMN_RULE_TODAY = 'today';
|
// const AUTOFILTER_COLUMN_RULE_TODAY = 'today';
|
||||||
// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow';
|
// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow';
|
||||||
// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek';
|
// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek';
|
||||||
// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek';
|
// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek';
|
||||||
// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek';
|
// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek';
|
||||||
// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth';
|
// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth';
|
||||||
// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth';
|
// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth';
|
||||||
// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth';
|
// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth';
|
||||||
// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter';
|
// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter';
|
||||||
// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter';
|
// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter';
|
||||||
// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter';
|
// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter';
|
||||||
// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear';
|
// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear';
|
||||||
// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear';
|
// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear';
|
||||||
// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear';
|
// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear';
|
||||||
// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; // <dynamicFilter val="40909" type="yearToDate" maxVal="41113"/>
|
// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; // <dynamicFilter val="40909" type="yearToDate" maxVal="41113"/>
|
||||||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // <dynamicFilter type="M2"/> for Month/February
|
// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // <dynamicFilter type="M2"/> for Month/February
|
||||||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // <dynamicFilter type="Q2"/> for Quarter 2
|
// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // <dynamicFilter type="Q2"/> for Quarter 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Column
|
* Autofilter Column
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet_AutoFilter_Column
|
* @var PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
private $_parent = NULL;
|
private $_parent = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Rule Type
|
* Autofilter Rule Type
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_ruleType = self::AUTOFILTER_RULETYPE_FILTER;
|
private $_ruleType = self::AUTOFILTER_RULETYPE_FILTER;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Rule Value
|
* Autofilter Rule Value
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_value = '';
|
private $_value = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autofilter Rule Operator
|
* Autofilter Rule Operator
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_operator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
private $_operator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DateTimeGrouping Group Value
|
* DateTimeGrouping Group Value
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_grouping = '';
|
private $_grouping = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
|
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL)
|
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL)
|
||||||
{
|
{
|
||||||
$this->_parent = $pParent;
|
$this->_parent = $pParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Rule Type
|
* Get AutoFilter Rule Type
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getRuleType() {
|
public function getRuleType() {
|
||||||
return $this->_ruleType;
|
return $this->_ruleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Rule Type
|
* Set AutoFilter Rule Type
|
||||||
*
|
*
|
||||||
* @param string $pRuleType
|
* @param string $pRuleType
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) {
|
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) {
|
||||||
if (!in_array($pRuleType,self::$_ruleTypes)) {
|
if (!in_array($pRuleType,self::$_ruleTypes)) {
|
||||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_ruleType = $pRuleType;
|
$this->_ruleType = $pRuleType;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Rule Value
|
* Get AutoFilter Rule Value
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getValue() {
|
public function getValue() {
|
||||||
return $this->_value;
|
return $this->_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Rule Value
|
* Set AutoFilter Rule Value
|
||||||
*
|
*
|
||||||
* @param string|string[] $pValue
|
* @param string|string[] $pValue
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function setValue($pValue = '') {
|
public function setValue($pValue = '') {
|
||||||
if (is_array($pValue)) {
|
if (is_array($pValue)) {
|
||||||
$grouping = -1;
|
$grouping = -1;
|
||||||
foreach($pValue as $key => $value) {
|
foreach($pValue as $key => $value) {
|
||||||
// Validate array entries
|
// Validate array entries
|
||||||
if (!in_array($key,self::$_dateTimeGroups)) {
|
if (!in_array($key,self::$_dateTimeGroups)) {
|
||||||
// Remove any invalid entries from the value array
|
// Remove any invalid entries from the value array
|
||||||
unset($pValue[$key]);
|
unset($pValue[$key]);
|
||||||
} else {
|
} else {
|
||||||
// Work out what the dateTime grouping will be
|
// 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) {
|
if (count($pValue) == 0) {
|
||||||
throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.');
|
throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.');
|
||||||
}
|
}
|
||||||
// Set the dateTime grouping that we've anticipated
|
// Set the dateTime grouping that we've anticipated
|
||||||
$this->setGrouping(self::$_dateTimeGroups[$grouping]);
|
$this->setGrouping(self::$_dateTimeGroups[$grouping]);
|
||||||
}
|
}
|
||||||
$this->_value = $pValue;
|
$this->_value = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Rule Operator
|
* Get AutoFilter Rule Operator
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getOperator() {
|
public function getOperator() {
|
||||||
return $this->_operator;
|
return $this->_operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Rule Operator
|
* Set AutoFilter Rule Operator
|
||||||
*
|
*
|
||||||
* @param string $pOperator
|
* @param string $pOperator
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
||||||
if (empty($pOperator))
|
if (empty($pOperator))
|
||||||
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||||
if ((!in_array($pOperator,self::$_operators)) &&
|
if ((!in_array($pOperator,self::$_operators)) &&
|
||||||
(!in_array($pOperator,self::$_topTenValue))) {
|
(!in_array($pOperator,self::$_topTenValue))) {
|
||||||
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
|
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
|
||||||
}
|
}
|
||||||
$this->_operator = $pOperator;
|
$this->_operator = $pOperator;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get AutoFilter Rule Grouping
|
* Get AutoFilter Rule Grouping
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getGrouping() {
|
public function getGrouping() {
|
||||||
return $this->_grouping;
|
return $this->_grouping;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Rule Grouping
|
* Set AutoFilter Rule Grouping
|
||||||
*
|
*
|
||||||
* @param string $pGrouping
|
* @param string $pGrouping
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function setGrouping($pGrouping = NULL) {
|
public function setGrouping($pGrouping = NULL) {
|
||||||
if (($pGrouping !== NULL) &&
|
if (($pGrouping !== NULL) &&
|
||||||
(!in_array($pGrouping,self::$_dateTimeGroups)) &&
|
(!in_array($pGrouping,self::$_dateTimeGroups)) &&
|
||||||
(!in_array($pGrouping,self::$_dynamicTypes)) &&
|
(!in_array($pGrouping,self::$_dynamicTypes)) &&
|
||||||
(!in_array($pGrouping,self::$_topTenType))) {
|
(!in_array($pGrouping,self::$_topTenType))) {
|
||||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_grouping = $pGrouping;
|
$this->_grouping = $pGrouping;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set AutoFilter Rule
|
* Set AutoFilter Rule
|
||||||
*
|
*
|
||||||
* @param string $pOperator
|
* @param string $pOperator
|
||||||
* @param string|string[] $pValue
|
* @param string|string[] $pValue
|
||||||
* @param string $pGrouping
|
* @param string $pGrouping
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) {
|
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) {
|
||||||
$this->setOperator($pOperator);
|
$this->setOperator($pOperator);
|
||||||
$this->setValue($pValue);
|
$this->setValue($pValue);
|
||||||
// Only set grouping if it's been passed in as a user-supplied argument,
|
// Only set grouping if it's been passed in as a user-supplied argument,
|
||||||
// otherwise we're calculating it when we setValue() and don't want to overwrite that
|
// otherwise we're calculating it when we setValue() and don't want to overwrite that
|
||||||
// If the user supplies an argumnet for grouping, then on their own head be it
|
// If the user supplies an argumnet for grouping, then on their own head be it
|
||||||
if ($pGrouping !== NULL)
|
if ($pGrouping !== NULL)
|
||||||
$this->setGrouping($pGrouping);
|
$this->setGrouping($pGrouping);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this Rule's AutoFilter Column Parent
|
* Get this Rule's AutoFilter Column Parent
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||||
*/
|
*/
|
||||||
public function getParent() {
|
public function getParent() {
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this Rule's AutoFilter Column Parent
|
* Set this Rule's AutoFilter Column Parent
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet_AutoFilter_Column
|
* @param PHPExcel_Worksheet_AutoFilter_Column
|
||||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||||
*/
|
*/
|
||||||
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) {
|
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) {
|
||||||
$this->_parent = $pParent;
|
$this->_parent = $pParent;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
if ($key == '_parent') {
|
if ($key == '_parent') {
|
||||||
// Detach from autofilter column parent
|
// Detach from autofilter column parent
|
||||||
$this->$key = NULL;
|
$this->$key = NULL;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,118 +35,118 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Image counter
|
* Image counter
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private static $_imageCounter = 0;
|
private static $_imageCounter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image index
|
* Image index
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_imageIndex = 0;
|
private $_imageIndex = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name
|
* Name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_name;
|
protected $_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description
|
* Description
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_description;
|
protected $_description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Worksheet
|
* Worksheet
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet
|
* @var PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
protected $_worksheet;
|
protected $_worksheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coordinates
|
* Coordinates
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_coordinates;
|
protected $_coordinates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset X
|
* Offset X
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_offsetX;
|
protected $_offsetX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset Y
|
* Offset Y
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_offsetY;
|
protected $_offsetY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Width
|
* Width
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_width;
|
protected $_width;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Height
|
* Height
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_height;
|
protected $_height;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proportional resize
|
* Proportional resize
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $_resizeProportional;
|
protected $_resizeProportional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotation
|
* Rotation
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_rotation;
|
protected $_rotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shadow
|
* Shadow
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet_Drawing_Shadow
|
* @var PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
protected $_shadow;
|
protected $_shadow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_BaseDrawing
|
* Create a new PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_name = '';
|
$this->_name = '';
|
||||||
$this->_description = '';
|
$this->_description = '';
|
||||||
$this->_worksheet = null;
|
$this->_worksheet = null;
|
||||||
$this->_coordinates = 'A1';
|
$this->_coordinates = 'A1';
|
||||||
$this->_offsetX = 0;
|
$this->_offsetX = 0;
|
||||||
$this->_offsetY = 0;
|
$this->_offsetY = 0;
|
||||||
$this->_width = 0;
|
$this->_width = 0;
|
||||||
$this->_height = 0;
|
$this->_height = 0;
|
||||||
$this->_resizeProportional = true;
|
$this->_resizeProportional = true;
|
||||||
$this->_rotation = 0;
|
$this->_rotation = 0;
|
||||||
$this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow();
|
$this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow();
|
||||||
|
|
||||||
// Set image index
|
// Set image index
|
||||||
self::$_imageCounter++;
|
self::$_imageCounter++;
|
||||||
$this->_imageIndex = self::$_imageCounter;
|
$this->_imageIndex = self::$_imageCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,7 +155,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getImageIndex() {
|
public function getImageIndex() {
|
||||||
return $this->_imageIndex;
|
return $this->_imageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +164,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->_name;
|
return $this->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,8 +174,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setName($pValue = '') {
|
public function setName($pValue = '') {
|
||||||
$this->_name = $pValue;
|
$this->_name = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,7 +184,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDescription() {
|
public function getDescription() {
|
||||||
return $this->_description;
|
return $this->_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,8 +194,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setDescription($pValue = '') {
|
public function setDescription($pValue = '') {
|
||||||
$this->_description = $pValue;
|
$this->_description = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,43 +204,43 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function getWorksheet() {
|
public function getWorksheet() {
|
||||||
return $this->_worksheet;
|
return $this->_worksheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Worksheet
|
* Set Worksheet
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pValue
|
* @param PHPExcel_Worksheet $pValue
|
||||||
* @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
|
* @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) {
|
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) {
|
||||||
if (is_null($this->_worksheet)) {
|
if (is_null($this->_worksheet)) {
|
||||||
// Add drawing to PHPExcel_Worksheet
|
// Add drawing to PHPExcel_Worksheet
|
||||||
$this->_worksheet = $pValue;
|
$this->_worksheet = $pValue;
|
||||||
$this->_worksheet->getCell($this->_coordinates);
|
$this->_worksheet->getCell($this->_coordinates);
|
||||||
$this->_worksheet->getDrawingCollection()->append($this);
|
$this->_worksheet->getDrawingCollection()->append($this);
|
||||||
} else {
|
} else {
|
||||||
if ($pOverrideOld) {
|
if ($pOverrideOld) {
|
||||||
// Remove drawing from old PHPExcel_Worksheet
|
// Remove drawing from old PHPExcel_Worksheet
|
||||||
$iterator = $this->_worksheet->getDrawingCollection()->getIterator();
|
$iterator = $this->_worksheet->getDrawingCollection()->getIterator();
|
||||||
|
|
||||||
while ($iterator->valid()) {
|
while ($iterator->valid()) {
|
||||||
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
|
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
|
||||||
$this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() );
|
$this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() );
|
||||||
$this->_worksheet = null;
|
$this->_worksheet = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set new PHPExcel_Worksheet
|
// Set new PHPExcel_Worksheet
|
||||||
$this->setWorksheet($pValue);
|
$this->setWorksheet($pValue);
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
|
throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -249,7 +249,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCoordinates() {
|
public function getCoordinates() {
|
||||||
return $this->_coordinates;
|
return $this->_coordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -259,8 +259,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setCoordinates($pValue = 'A1') {
|
public function setCoordinates($pValue = 'A1') {
|
||||||
$this->_coordinates = $pValue;
|
$this->_coordinates = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -269,7 +269,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getOffsetX() {
|
public function getOffsetX() {
|
||||||
return $this->_offsetX;
|
return $this->_offsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -279,8 +279,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setOffsetX($pValue = 0) {
|
public function setOffsetX($pValue = 0) {
|
||||||
$this->_offsetX = $pValue;
|
$this->_offsetX = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,7 +289,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getOffsetY() {
|
public function getOffsetY() {
|
||||||
return $this->_offsetY;
|
return $this->_offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -299,8 +299,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setOffsetY($pValue = 0) {
|
public function setOffsetY($pValue = 0) {
|
||||||
$this->_offsetY = $pValue;
|
$this->_offsetY = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -309,7 +309,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getWidth() {
|
public function getWidth() {
|
||||||
return $this->_width;
|
return $this->_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -319,16 +319,16 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setWidth($pValue = 0) {
|
public function setWidth($pValue = 0) {
|
||||||
// Resize proportional?
|
// Resize proportional?
|
||||||
if ($this->_resizeProportional && $pValue != 0) {
|
if ($this->_resizeProportional && $pValue != 0) {
|
||||||
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
|
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
|
||||||
$this->_height = round($ratio * $pValue);
|
$this->_height = round($ratio * $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set width
|
// Set width
|
||||||
$this->_width = $pValue;
|
$this->_width = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -337,7 +337,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getHeight() {
|
public function getHeight() {
|
||||||
return $this->_height;
|
return $this->_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -347,49 +347,49 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setHeight($pValue = 0) {
|
public function setHeight($pValue = 0) {
|
||||||
// Resize proportional?
|
// Resize proportional?
|
||||||
if ($this->_resizeProportional && $pValue != 0) {
|
if ($this->_resizeProportional && $pValue != 0) {
|
||||||
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
|
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
|
||||||
$this->_width = round($ratio * $pValue);
|
$this->_width = round($ratio * $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set height
|
// Set height
|
||||||
$this->_height = $pValue;
|
$this->_height = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set width and height with proportional resize
|
* Set width and height with proportional resize
|
||||||
* Example:
|
* Example:
|
||||||
* <code>
|
* <code>
|
||||||
* $objDrawing->setResizeProportional(true);
|
* $objDrawing->setResizeProportional(true);
|
||||||
* $objDrawing->setWidthAndHeight(160,120);
|
* $objDrawing->setWidthAndHeight(160,120);
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @author Vincent@luo MSN:kele_100@hotmail.com
|
* @author Vincent@luo MSN:kele_100@hotmail.com
|
||||||
* @param int $width
|
* @param int $width
|
||||||
* @param int $height
|
* @param int $height
|
||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||||
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
|
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
|
||||||
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
|
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
|
||||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||||
if (($xratio * $this->_height) < $height) {
|
if (($xratio * $this->_height) < $height) {
|
||||||
$this->_height = ceil($xratio * $this->_height);
|
$this->_height = ceil($xratio * $this->_height);
|
||||||
$this->_width = $width;
|
$this->_width = $width;
|
||||||
} else {
|
} else {
|
||||||
$this->_width = ceil($yratio * $this->_width);
|
$this->_width = ceil($yratio * $this->_width);
|
||||||
$this->_height = $height;
|
$this->_height = $height;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_width = $width;
|
$this->_width = $width;
|
||||||
$this->_height = $height;
|
$this->_height = $height;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ResizeProportional
|
* Get ResizeProportional
|
||||||
@ -397,7 +397,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getResizeProportional() {
|
public function getResizeProportional() {
|
||||||
return $this->_resizeProportional;
|
return $this->_resizeProportional;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -407,8 +407,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setResizeProportional($pValue = true) {
|
public function setResizeProportional($pValue = true) {
|
||||||
$this->_resizeProportional = $pValue;
|
$this->_resizeProportional = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -417,7 +417,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getRotation() {
|
public function getRotation() {
|
||||||
return $this->_rotation;
|
return $this->_rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -427,8 +427,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setRotation($pValue = 0) {
|
public function setRotation($pValue = 0) {
|
||||||
$this->_rotation = $pValue;
|
$this->_rotation = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -437,53 +437,53 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function getShadow() {
|
public function getShadow() {
|
||||||
return $this->_shadow;
|
return $this->_shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Shadow
|
* Set Shadow
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet_Drawing_Shadow $pValue
|
* @param PHPExcel_Worksheet_Drawing_Shadow $pValue
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
|
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
|
||||||
$this->_shadow = $pValue;
|
$this->_shadow = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode() {
|
||||||
return md5(
|
return md5(
|
||||||
$this->_name
|
$this->_name
|
||||||
. $this->_description
|
. $this->_description
|
||||||
. $this->_worksheet->getHashCode()
|
. $this->_worksheet->getHashCode()
|
||||||
. $this->_coordinates
|
. $this->_coordinates
|
||||||
. $this->_offsetX
|
. $this->_offsetX
|
||||||
. $this->_offsetY
|
. $this->_offsetY
|
||||||
. $this->_width
|
. $this->_width
|
||||||
. $this->_height
|
. $this->_height
|
||||||
. $this->_rotation
|
. $this->_rotation
|
||||||
. $this->_shadow->getHashCode()
|
. $this->_shadow->getHashCode()
|
||||||
. __CLASS__
|
. __CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_ColumnDimension
|
class PHPExcel_Worksheet_ColumnDimension
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet_Drawing
|
* @package PHPExcel_Worksheet_Drawing
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,23 +35,23 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Path
|
* Path
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_path;
|
private $_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_Drawing
|
* Create a new PHPExcel_Worksheet_Drawing
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_path = '';
|
$this->_path = '';
|
||||||
|
|
||||||
// Initialize parent
|
// Initialize parent
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFilename() {
|
public function getFilename() {
|
||||||
return basename($this->_path);
|
return basename($this->_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,9 +69,9 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIndexedFilename() {
|
public function getIndexedFilename() {
|
||||||
$fileName = $this->getFilename();
|
$fileName = $this->getFilename();
|
||||||
$fileName = str_replace(' ', '_', $fileName);
|
$fileName = str_replace(' ', '_', $fileName);
|
||||||
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
|
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,8 +80,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getExtension() {
|
public function getExtension() {
|
||||||
$exploded = explode(".", basename($this->_path));
|
$exploded = explode(".", basename($this->_path));
|
||||||
return $exploded[count($exploded) - 1];
|
return $exploded[count($exploded) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,59 +90,59 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPath() {
|
public function getPath() {
|
||||||
return $this->_path;
|
return $this->_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Path
|
* Set Path
|
||||||
*
|
*
|
||||||
* @param string $pValue File path
|
* @param string $pValue File path
|
||||||
* @param boolean $pVerifyFile Verify file
|
* @param boolean $pVerifyFile Verify file
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_Drawing
|
* @return PHPExcel_Worksheet_Drawing
|
||||||
*/
|
*/
|
||||||
public function setPath($pValue = '', $pVerifyFile = true) {
|
public function setPath($pValue = '', $pVerifyFile = true) {
|
||||||
if ($pVerifyFile) {
|
if ($pVerifyFile) {
|
||||||
if (file_exists($pValue)) {
|
if (file_exists($pValue)) {
|
||||||
$this->_path = $pValue;
|
$this->_path = $pValue;
|
||||||
|
|
||||||
if ($this->_width == 0 && $this->_height == 0) {
|
if ($this->_width == 0 && $this->_height == 0) {
|
||||||
// Get width/height
|
// Get width/height
|
||||||
list($this->_width, $this->_height) = getimagesize($pValue);
|
list($this->_width, $this->_height) = getimagesize($pValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("File $pValue not found!");
|
throw new PHPExcel_Exception("File $pValue not found!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_path = $pValue;
|
$this->_path = $pValue;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode() {
|
||||||
return md5(
|
return md5(
|
||||||
$this->_path
|
$this->_path
|
||||||
. parent::getHashCode()
|
. parent::getHashCode()
|
||||||
. __CLASS__
|
. __CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet_Drawing
|
* @package PHPExcel_Worksheet_Drawing
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,82 +35,82 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
/* Shadow alignment */
|
/* Shadow alignment */
|
||||||
const SHADOW_BOTTOM = 'b';
|
const SHADOW_BOTTOM = 'b';
|
||||||
const SHADOW_BOTTOM_LEFT = 'bl';
|
const SHADOW_BOTTOM_LEFT = 'bl';
|
||||||
const SHADOW_BOTTOM_RIGHT = 'br';
|
const SHADOW_BOTTOM_RIGHT = 'br';
|
||||||
const SHADOW_CENTER = 'ctr';
|
const SHADOW_CENTER = 'ctr';
|
||||||
const SHADOW_LEFT = 'l';
|
const SHADOW_LEFT = 'l';
|
||||||
const SHADOW_TOP = 't';
|
const SHADOW_TOP = 't';
|
||||||
const SHADOW_TOP_LEFT = 'tl';
|
const SHADOW_TOP_LEFT = 'tl';
|
||||||
const SHADOW_TOP_RIGHT = 'tr';
|
const SHADOW_TOP_RIGHT = 'tr';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visible
|
* Visible
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_visible;
|
private $_visible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blur radius
|
* Blur radius
|
||||||
*
|
*
|
||||||
* Defaults to 6
|
* Defaults to 6
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_blurRadius;
|
private $_blurRadius;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shadow distance
|
* Shadow distance
|
||||||
*
|
*
|
||||||
* Defaults to 2
|
* Defaults to 2
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_distance;
|
private $_distance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shadow direction (in degrees)
|
* Shadow direction (in degrees)
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_direction;
|
private $_direction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shadow alignment
|
* Shadow alignment
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_alignment;
|
private $_alignment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color
|
* Color
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Style_Color
|
* @var PHPExcel_Style_Color
|
||||||
*/
|
*/
|
||||||
private $_color;
|
private $_color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alpha
|
* Alpha
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_alpha;
|
private $_alpha;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_Drawing_Shadow
|
* Create a new PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_visible = false;
|
$this->_visible = false;
|
||||||
$this->_blurRadius = 6;
|
$this->_blurRadius = 6;
|
||||||
$this->_distance = 2;
|
$this->_distance = 2;
|
||||||
$this->_direction = 0;
|
$this->_direction = 0;
|
||||||
$this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
|
$this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
|
||||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
|
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
|
||||||
$this->_alpha = 50;
|
$this->_alpha = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +119,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getVisible() {
|
public function getVisible() {
|
||||||
return $this->_visible;
|
return $this->_visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,8 +129,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setVisible($pValue = false) {
|
public function setVisible($pValue = false) {
|
||||||
$this->_visible = $pValue;
|
$this->_visible = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,7 +139,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getBlurRadius() {
|
public function getBlurRadius() {
|
||||||
return $this->_blurRadius;
|
return $this->_blurRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,8 +149,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setBlurRadius($pValue = 6) {
|
public function setBlurRadius($pValue = 6) {
|
||||||
$this->_blurRadius = $pValue;
|
$this->_blurRadius = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +159,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDistance() {
|
public function getDistance() {
|
||||||
return $this->_distance;
|
return $this->_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,8 +169,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setDistance($pValue = 2) {
|
public function setDistance($pValue = 2) {
|
||||||
$this->_distance = $pValue;
|
$this->_distance = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -179,7 +179,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDirection() {
|
public function getDirection() {
|
||||||
return $this->_direction;
|
return $this->_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,8 +189,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setDirection($pValue = 0) {
|
public function setDirection($pValue = 0) {
|
||||||
$this->_direction = $pValue;
|
$this->_direction = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,7 +199,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getAlignment() {
|
public function getAlignment() {
|
||||||
return $this->_alignment;
|
return $this->_alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,8 +209,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setAlignment($pValue = 0) {
|
public function setAlignment($pValue = 0) {
|
||||||
$this->_alignment = $pValue;
|
$this->_alignment = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,19 +219,19 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Style_Color
|
* @return PHPExcel_Style_Color
|
||||||
*/
|
*/
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return $this->_color;
|
return $this->_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Color
|
* Set Color
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Style_Color $pValue
|
* @param PHPExcel_Style_Color $pValue
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setColor(PHPExcel_Style_Color $pValue = null) {
|
public function setColor(PHPExcel_Style_Color $pValue = null) {
|
||||||
$this->_color = $pValue;
|
$this->_color = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -240,7 +240,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getAlpha() {
|
public function getAlpha() {
|
||||||
return $this->_alpha;
|
return $this->_alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,39 +250,39 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||||
*/
|
*/
|
||||||
public function setAlpha($pValue = 0) {
|
public function setAlpha($pValue = 0) {
|
||||||
$this->_alpha = $pValue;
|
$this->_alpha = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode() {
|
||||||
return md5(
|
return md5(
|
||||||
($this->_visible ? 't' : 'f')
|
($this->_visible ? 't' : 'f')
|
||||||
. $this->_blurRadius
|
. $this->_blurRadius
|
||||||
. $this->_distance
|
. $this->_distance
|
||||||
. $this->_direction
|
. $this->_direction
|
||||||
. $this->_alignment
|
. $this->_alignment
|
||||||
. $this->_color->getHashCode()
|
. $this->_color->getHashCode()
|
||||||
. $this->_alpha
|
. $this->_alpha
|
||||||
. __CLASS__
|
. __CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
* Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on
|
* Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on
|
||||||
* the second line (center section).
|
* the second line (center section).
|
||||||
* &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
|
* &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
|
||||||
*
|
*
|
||||||
* General Rules:
|
* General Rules:
|
||||||
* There is no required order in which these codes must appear.
|
* There is no required order in which these codes must appear.
|
||||||
@ -95,90 +95,90 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_HeaderFooter
|
class PHPExcel_Worksheet_HeaderFooter
|
||||||
{
|
{
|
||||||
/* Header/footer image location */
|
/* Header/footer image location */
|
||||||
const IMAGE_HEADER_LEFT = 'LH';
|
const IMAGE_HEADER_LEFT = 'LH';
|
||||||
const IMAGE_HEADER_CENTER = 'CH';
|
const IMAGE_HEADER_CENTER = 'CH';
|
||||||
const IMAGE_HEADER_RIGHT = 'RH';
|
const IMAGE_HEADER_RIGHT = 'RH';
|
||||||
const IMAGE_FOOTER_LEFT = 'LF';
|
const IMAGE_FOOTER_LEFT = 'LF';
|
||||||
const IMAGE_FOOTER_CENTER = 'CF';
|
const IMAGE_FOOTER_CENTER = 'CF';
|
||||||
const IMAGE_FOOTER_RIGHT = 'RF';
|
const IMAGE_FOOTER_RIGHT = 'RF';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OddHeader
|
* OddHeader
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_oddHeader = '';
|
private $_oddHeader = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OddFooter
|
* OddFooter
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_oddFooter = '';
|
private $_oddFooter = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EvenHeader
|
* EvenHeader
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_evenHeader = '';
|
private $_evenHeader = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EvenFooter
|
* EvenFooter
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_evenFooter = '';
|
private $_evenFooter = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FirstHeader
|
* FirstHeader
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_firstHeader = '';
|
private $_firstHeader = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FirstFooter
|
* FirstFooter
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_firstFooter = '';
|
private $_firstFooter = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Different header for Odd/Even, defaults to false
|
* Different header for Odd/Even, defaults to false
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_differentOddEven = false;
|
private $_differentOddEven = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Different header for first page, defaults to false
|
* Different header for first page, defaults to false
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_differentFirst = false;
|
private $_differentFirst = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale with document, defaults to true
|
* Scale with document, defaults to true
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_scaleWithDocument = true;
|
private $_scaleWithDocument = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Align with margins, defaults to true
|
* Align with margins, defaults to true
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_alignWithMargins = true;
|
private $_alignWithMargins = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header/footer images
|
* Header/footer images
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet_HeaderFooterDrawing[]
|
* @var PHPExcel_Worksheet_HeaderFooterDrawing[]
|
||||||
*/
|
*/
|
||||||
private $_headerFooterImages = array();
|
private $_headerFooterImages = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_HeaderFooter
|
* Create a new PHPExcel_Worksheet_HeaderFooter
|
||||||
@ -193,7 +193,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getOddHeader() {
|
public function getOddHeader() {
|
||||||
return $this->_oddHeader;
|
return $this->_oddHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,8 +203,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setOddHeader($pValue) {
|
public function setOddHeader($pValue) {
|
||||||
$this->_oddHeader = $pValue;
|
$this->_oddHeader = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,7 +213,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getOddFooter() {
|
public function getOddFooter() {
|
||||||
return $this->_oddFooter;
|
return $this->_oddFooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,8 +223,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setOddFooter($pValue) {
|
public function setOddFooter($pValue) {
|
||||||
$this->_oddFooter = $pValue;
|
$this->_oddFooter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -233,7 +233,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEvenHeader() {
|
public function getEvenHeader() {
|
||||||
return $this->_evenHeader;
|
return $this->_evenHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -243,8 +243,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setEvenHeader($pValue) {
|
public function setEvenHeader($pValue) {
|
||||||
$this->_evenHeader = $pValue;
|
$this->_evenHeader = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +253,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEvenFooter() {
|
public function getEvenFooter() {
|
||||||
return $this->_evenFooter;
|
return $this->_evenFooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,8 +263,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setEvenFooter($pValue) {
|
public function setEvenFooter($pValue) {
|
||||||
$this->_evenFooter = $pValue;
|
$this->_evenFooter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -273,7 +273,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstHeader() {
|
public function getFirstHeader() {
|
||||||
return $this->_firstHeader;
|
return $this->_firstHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -283,8 +283,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setFirstHeader($pValue) {
|
public function setFirstHeader($pValue) {
|
||||||
$this->_firstHeader = $pValue;
|
$this->_firstHeader = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,7 +293,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstFooter() {
|
public function getFirstFooter() {
|
||||||
return $this->_firstFooter;
|
return $this->_firstFooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -303,8 +303,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setFirstFooter($pValue) {
|
public function setFirstFooter($pValue) {
|
||||||
$this->_firstFooter = $pValue;
|
$this->_firstFooter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -313,7 +313,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getDifferentOddEven() {
|
public function getDifferentOddEven() {
|
||||||
return $this->_differentOddEven;
|
return $this->_differentOddEven;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -323,8 +323,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setDifferentOddEven($pValue = false) {
|
public function setDifferentOddEven($pValue = false) {
|
||||||
$this->_differentOddEven = $pValue;
|
$this->_differentOddEven = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,7 +333,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getDifferentFirst() {
|
public function getDifferentFirst() {
|
||||||
return $this->_differentFirst;
|
return $this->_differentFirst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -343,8 +343,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setDifferentFirst($pValue = false) {
|
public function setDifferentFirst($pValue = false) {
|
||||||
$this->_differentFirst = $pValue;
|
$this->_differentFirst = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,7 +353,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getScaleWithDocument() {
|
public function getScaleWithDocument() {
|
||||||
return $this->_scaleWithDocument;
|
return $this->_scaleWithDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -363,8 +363,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setScaleWithDocument($pValue = true) {
|
public function setScaleWithDocument($pValue = true) {
|
||||||
$this->_scaleWithDocument = $pValue;
|
$this->_scaleWithDocument = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -373,7 +373,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getAlignWithMargins() {
|
public function getAlignWithMargins() {
|
||||||
return $this->_alignWithMargins;
|
return $this->_alignWithMargins;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -383,8 +383,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setAlignWithMargins($pValue = true) {
|
public function setAlignWithMargins($pValue = true) {
|
||||||
$this->_alignWithMargins = $pValue;
|
$this->_alignWithMargins = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -396,8 +396,8 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @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;
|
$this->_headerFooterImages[$location] = $image;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -408,10 +408,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @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])) {
|
if (isset($this->_headerFooterImages[$location])) {
|
||||||
unset($this->_headerFooterImages[$location]);
|
unset($this->_headerFooterImages[$location]);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -422,12 +422,12 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooter
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
*/
|
*/
|
||||||
public function setImages($images) {
|
public function setImages($images) {
|
||||||
if (!is_array($images)) {
|
if (!is_array($images)) {
|
||||||
throw new PHPExcel_Exception('Invalid parameter!');
|
throw new PHPExcel_Exception('Invalid parameter!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_headerFooterImages = $images;
|
$this->_headerFooterImages = $images;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -436,30 +436,30 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
|
||||||
*/
|
*/
|
||||||
public function getImages() {
|
public function getImages() {
|
||||||
// Sort array
|
// Sort array
|
||||||
$images = 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_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_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_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_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_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_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
|
||||||
$this->_headerFooterImages = $images;
|
$this->_headerFooterImages = $images;
|
||||||
|
|
||||||
return $this->_headerFooterImages;
|
return $this->_headerFooterImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,68 +35,68 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Path
|
* Path
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_path;
|
private $_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name
|
* Name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_name;
|
protected $_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset X
|
* Offset X
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_offsetX;
|
protected $_offsetX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset Y
|
* Offset Y
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_offsetY;
|
protected $_offsetY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Width
|
* Width
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_width;
|
protected $_width;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Height
|
* Height
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_height;
|
protected $_height;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proportional resize
|
* Proportional resize
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $_resizeProportional;
|
protected $_resizeProportional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_HeaderFooterDrawing
|
* Create a new PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_path = '';
|
$this->_path = '';
|
||||||
$this->_name = '';
|
$this->_name = '';
|
||||||
$this->_offsetX = 0;
|
$this->_offsetX = 0;
|
||||||
$this->_offsetY = 0;
|
$this->_offsetY = 0;
|
||||||
$this->_width = 0;
|
$this->_width = 0;
|
||||||
$this->_height = 0;
|
$this->_height = 0;
|
||||||
$this->_resizeProportional = true;
|
$this->_resizeProportional = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +105,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->_name;
|
return $this->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,8 +115,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setName($pValue = '') {
|
public function setName($pValue = '') {
|
||||||
$this->_name = $pValue;
|
$this->_name = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,7 +125,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getOffsetX() {
|
public function getOffsetX() {
|
||||||
return $this->_offsetX;
|
return $this->_offsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,8 +135,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setOffsetX($pValue = 0) {
|
public function setOffsetX($pValue = 0) {
|
||||||
$this->_offsetX = $pValue;
|
$this->_offsetX = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +145,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getOffsetY() {
|
public function getOffsetY() {
|
||||||
return $this->_offsetY;
|
return $this->_offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,8 +155,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setOffsetY($pValue = 0) {
|
public function setOffsetY($pValue = 0) {
|
||||||
$this->_offsetY = $pValue;
|
$this->_offsetY = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,7 +165,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getWidth() {
|
public function getWidth() {
|
||||||
return $this->_width;
|
return $this->_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,16 +175,16 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setWidth($pValue = 0) {
|
public function setWidth($pValue = 0) {
|
||||||
// Resize proportional?
|
// Resize proportional?
|
||||||
if ($this->_resizeProportional && $pValue != 0) {
|
if ($this->_resizeProportional && $pValue != 0) {
|
||||||
$ratio = $this->_width / $this->_height;
|
$ratio = $this->_width / $this->_height;
|
||||||
$this->_height = round($ratio * $pValue);
|
$this->_height = round($ratio * $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set width
|
// Set width
|
||||||
$this->_width = $pValue;
|
$this->_width = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,7 +193,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getHeight() {
|
public function getHeight() {
|
||||||
return $this->_height;
|
return $this->_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,45 +203,45 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setHeight($pValue = 0) {
|
public function setHeight($pValue = 0) {
|
||||||
// Resize proportional?
|
// Resize proportional?
|
||||||
if ($this->_resizeProportional && $pValue != 0) {
|
if ($this->_resizeProportional && $pValue != 0) {
|
||||||
$ratio = $this->_width / $this->_height;
|
$ratio = $this->_width / $this->_height;
|
||||||
$this->_width = round($ratio * $pValue);
|
$this->_width = round($ratio * $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set height
|
// Set height
|
||||||
$this->_height = $pValue;
|
$this->_height = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set width and height with proportional resize
|
* Set width and height with proportional resize
|
||||||
* Example:
|
* Example:
|
||||||
* <code>
|
* <code>
|
||||||
* $objDrawing->setResizeProportional(true);
|
* $objDrawing->setResizeProportional(true);
|
||||||
* $objDrawing->setWidthAndHeight(160,120);
|
* $objDrawing->setWidthAndHeight(160,120);
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @author Vincent@luo MSN:kele_100@hotmail.com
|
* @author Vincent@luo MSN:kele_100@hotmail.com
|
||||||
* @param int $width
|
* @param int $width
|
||||||
* @param int $height
|
* @param int $height
|
||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||||
$xratio = $width / $this->_width;
|
$xratio = $width / $this->_width;
|
||||||
$yratio = $height / $this->_height;
|
$yratio = $height / $this->_height;
|
||||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||||
if (($xratio * $this->_height) < $height) {
|
if (($xratio * $this->_height) < $height) {
|
||||||
$this->_height = ceil($xratio * $this->_height);
|
$this->_height = ceil($xratio * $this->_height);
|
||||||
$this->_width = $width;
|
$this->_width = $width;
|
||||||
} else {
|
} else {
|
||||||
$this->_width = ceil($yratio * $this->_width);
|
$this->_width = ceil($yratio * $this->_width);
|
||||||
$this->_height = $height;
|
$this->_height = $height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ResizeProportional
|
* Get ResizeProportional
|
||||||
@ -249,7 +249,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getResizeProportional() {
|
public function getResizeProportional() {
|
||||||
return $this->_resizeProportional;
|
return $this->_resizeProportional;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -259,8 +259,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setResizeProportional($pValue = true) {
|
public function setResizeProportional($pValue = true) {
|
||||||
$this->_resizeProportional = $pValue;
|
$this->_resizeProportional = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -269,7 +269,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFilename() {
|
public function getFilename() {
|
||||||
return basename($this->_path);
|
return basename($this->_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,63 +288,63 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPath() {
|
public function getPath() {
|
||||||
return $this->_path;
|
return $this->_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Path
|
* Set Path
|
||||||
*
|
*
|
||||||
* @param string $pValue File path
|
* @param string $pValue File path
|
||||||
* @param boolean $pVerifyFile Verify file
|
* @param boolean $pVerifyFile Verify file
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||||
*/
|
*/
|
||||||
public function setPath($pValue = '', $pVerifyFile = true) {
|
public function setPath($pValue = '', $pVerifyFile = true) {
|
||||||
if ($pVerifyFile) {
|
if ($pVerifyFile) {
|
||||||
if (file_exists($pValue)) {
|
if (file_exists($pValue)) {
|
||||||
$this->_path = $pValue;
|
$this->_path = $pValue;
|
||||||
|
|
||||||
if ($this->_width == 0 && $this->_height == 0) {
|
if ($this->_width == 0 && $this->_height == 0) {
|
||||||
// Get width/height
|
// Get width/height
|
||||||
list($this->_width, $this->_height) = getimagesize($pValue);
|
list($this->_width, $this->_height) = getimagesize($pValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("File $pValue not found!");
|
throw new PHPExcel_Exception("File $pValue not found!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_path = $pValue;
|
$this->_path = $pValue;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode() {
|
||||||
return md5(
|
return md5(
|
||||||
$this->_path
|
$this->_path
|
||||||
. $this->_name
|
. $this->_name
|
||||||
. $this->_offsetX
|
. $this->_offsetX
|
||||||
. $this->_offsetY
|
. $this->_offsetY
|
||||||
. $this->_width
|
. $this->_width
|
||||||
. $this->_height
|
. $this->_height
|
||||||
. __CLASS__
|
. __CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,59 +35,59 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
/* Rendering functions */
|
/* Rendering functions */
|
||||||
const RENDERING_DEFAULT = 'imagepng';
|
const RENDERING_DEFAULT = 'imagepng';
|
||||||
const RENDERING_PNG = 'imagepng';
|
const RENDERING_PNG = 'imagepng';
|
||||||
const RENDERING_GIF = 'imagegif';
|
const RENDERING_GIF = 'imagegif';
|
||||||
const RENDERING_JPEG = 'imagejpeg';
|
const RENDERING_JPEG = 'imagejpeg';
|
||||||
|
|
||||||
/* MIME types */
|
/* MIME types */
|
||||||
const MIMETYPE_DEFAULT = 'image/png';
|
const MIMETYPE_DEFAULT = 'image/png';
|
||||||
const MIMETYPE_PNG = 'image/png';
|
const MIMETYPE_PNG = 'image/png';
|
||||||
const MIMETYPE_GIF = 'image/gif';
|
const MIMETYPE_GIF = 'image/gif';
|
||||||
const MIMETYPE_JPEG = 'image/jpeg';
|
const MIMETYPE_JPEG = 'image/jpeg';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image resource
|
* Image resource
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_imageResource;
|
private $_imageResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rendering function
|
* Rendering function
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_renderingFunction;
|
private $_renderingFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mime type
|
* Mime type
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_mimeType;
|
private $_mimeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique name
|
* Unique name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_uniqueName;
|
private $_uniqueName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_MemoryDrawing
|
* Create a new PHPExcel_Worksheet_MemoryDrawing
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_imageResource = null;
|
$this->_imageResource = null;
|
||||||
$this->_renderingFunction = self::RENDERING_DEFAULT;
|
$this->_renderingFunction = self::RENDERING_DEFAULT;
|
||||||
$this->_mimeType = self::MIMETYPE_DEFAULT;
|
$this->_mimeType = self::MIMETYPE_DEFAULT;
|
||||||
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
|
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
|
||||||
|
|
||||||
// Initialize parent
|
// Initialize parent
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,24 +96,24 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
public function getImageResource() {
|
public function getImageResource() {
|
||||||
return $this->_imageResource;
|
return $this->_imageResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set image resource
|
* Set image resource
|
||||||
*
|
*
|
||||||
* @param $value resource
|
* @param $value resource
|
||||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||||
*/
|
*/
|
||||||
public function setImageResource($value = null) {
|
public function setImageResource($value = null) {
|
||||||
$this->_imageResource = $value;
|
$this->_imageResource = $value;
|
||||||
|
|
||||||
if (!is_null($this->_imageResource)) {
|
if (!is_null($this->_imageResource)) {
|
||||||
// Get width/height
|
// Get width/height
|
||||||
$this->_width = imagesx($this->_imageResource);
|
$this->_width = imagesx($this->_imageResource);
|
||||||
$this->_height = imagesy($this->_imageResource);
|
$this->_height = imagesy($this->_imageResource);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,7 +122,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getRenderingFunction() {
|
public function getRenderingFunction() {
|
||||||
return $this->_renderingFunction;
|
return $this->_renderingFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,8 +132,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||||
*/
|
*/
|
||||||
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
|
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
|
||||||
$this->_renderingFunction = $value;
|
$this->_renderingFunction = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +142,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMimeType() {
|
public function getMimeType() {
|
||||||
return $this->_mimeType;
|
return $this->_mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,8 +152,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||||
*/
|
*/
|
||||||
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
|
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
|
||||||
$this->_mimeType = $value;
|
$this->_mimeType = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,39 +162,39 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIndexedFilename() {
|
public function getIndexedFilename() {
|
||||||
$extension = strtolower($this->getMimeType());
|
$extension = strtolower($this->getMimeType());
|
||||||
$extension = explode('/', $extension);
|
$extension = explode('/', $extension);
|
||||||
$extension = $extension[1];
|
$extension = $extension[1];
|
||||||
|
|
||||||
return $this->_uniqueName . $this->getImageIndex() . '.' . $extension;
|
return $this->_uniqueName . $this->getImageIndex() . '.' . $extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode() {
|
||||||
return md5(
|
return md5(
|
||||||
$this->_renderingFunction
|
$this->_renderingFunction
|
||||||
. $this->_mimeType
|
. $this->_mimeType
|
||||||
. $this->_uniqueName
|
. $this->_uniqueName
|
||||||
. parent::getHashCode()
|
. parent::getHashCode()
|
||||||
. __CLASS__
|
. __CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,47 +35,47 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_PageMargins
|
class PHPExcel_Worksheet_PageMargins
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Left
|
* Left
|
||||||
*
|
*
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
private $_left = 0.7;
|
private $_left = 0.7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Right
|
* Right
|
||||||
*
|
*
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
private $_right = 0.7;
|
private $_right = 0.7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top
|
* Top
|
||||||
*
|
*
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
private $_top = 0.75;
|
private $_top = 0.75;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bottom
|
* Bottom
|
||||||
*
|
*
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
private $_bottom = 0.75;
|
private $_bottom = 0.75;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header
|
* Header
|
||||||
*
|
*
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
private $_header = 0.3;
|
private $_header = 0.3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Footer
|
* Footer
|
||||||
*
|
*
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
private $_footer = 0.3;
|
private $_footer = 0.3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_PageMargins
|
* Create a new PHPExcel_Worksheet_PageMargins
|
||||||
@ -90,7 +90,7 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getLeft() {
|
public function getLeft() {
|
||||||
return $this->_left;
|
return $this->_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,8 +100,8 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return PHPExcel_Worksheet_PageMargins
|
* @return PHPExcel_Worksheet_PageMargins
|
||||||
*/
|
*/
|
||||||
public function setLeft($pValue) {
|
public function setLeft($pValue) {
|
||||||
$this->_left = $pValue;
|
$this->_left = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +110,7 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getRight() {
|
public function getRight() {
|
||||||
return $this->_right;
|
return $this->_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,8 +120,8 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return PHPExcel_Worksheet_PageMargins
|
* @return PHPExcel_Worksheet_PageMargins
|
||||||
*/
|
*/
|
||||||
public function setRight($pValue) {
|
public function setRight($pValue) {
|
||||||
$this->_right = $pValue;
|
$this->_right = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,7 +130,7 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getTop() {
|
public function getTop() {
|
||||||
return $this->_top;
|
return $this->_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,8 +140,8 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return PHPExcel_Worksheet_PageMargins
|
* @return PHPExcel_Worksheet_PageMargins
|
||||||
*/
|
*/
|
||||||
public function setTop($pValue) {
|
public function setTop($pValue) {
|
||||||
$this->_top = $pValue;
|
$this->_top = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,7 +150,7 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getBottom() {
|
public function getBottom() {
|
||||||
return $this->_bottom;
|
return $this->_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,8 +160,8 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return PHPExcel_Worksheet_PageMargins
|
* @return PHPExcel_Worksheet_PageMargins
|
||||||
*/
|
*/
|
||||||
public function setBottom($pValue) {
|
public function setBottom($pValue) {
|
||||||
$this->_bottom = $pValue;
|
$this->_bottom = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,7 +170,7 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getHeader() {
|
public function getHeader() {
|
||||||
return $this->_header;
|
return $this->_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -180,8 +180,8 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return PHPExcel_Worksheet_PageMargins
|
* @return PHPExcel_Worksheet_PageMargins
|
||||||
*/
|
*/
|
||||||
public function setHeader($pValue) {
|
public function setHeader($pValue) {
|
||||||
$this->_header = $pValue;
|
$this->_header = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +190,7 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getFooter() {
|
public function getFooter() {
|
||||||
return $this->_footer;
|
return $this->_footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,21 +200,21 @@ class PHPExcel_Worksheet_PageMargins
|
|||||||
* @return PHPExcel_Worksheet_PageMargins
|
* @return PHPExcel_Worksheet_PageMargins
|
||||||
*/
|
*/
|
||||||
public function setFooter($pValue) {
|
public function setFooter($pValue) {
|
||||||
$this->_footer = $pValue;
|
$this->_footer = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,124 +35,124 @@
|
|||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Protection
|
class PHPExcel_Worksheet_Protection
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Sheet
|
* Sheet
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_sheet = false;
|
private $_sheet = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Objects
|
* Objects
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_objects = false;
|
private $_objects = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scenarios
|
* Scenarios
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_scenarios = false;
|
private $_scenarios = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format cells
|
* Format cells
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_formatCells = false;
|
private $_formatCells = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format columns
|
* Format columns
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_formatColumns = false;
|
private $_formatColumns = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format rows
|
* Format rows
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_formatRows = false;
|
private $_formatRows = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert columns
|
* Insert columns
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_insertColumns = false;
|
private $_insertColumns = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert rows
|
* Insert rows
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_insertRows = false;
|
private $_insertRows = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert hyperlinks
|
* Insert hyperlinks
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_insertHyperlinks = false;
|
private $_insertHyperlinks = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete columns
|
* Delete columns
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_deleteColumns = false;
|
private $_deleteColumns = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete rows
|
* Delete rows
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_deleteRows = false;
|
private $_deleteRows = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select locked cells
|
* Select locked cells
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_selectLockedCells = false;
|
private $_selectLockedCells = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort
|
* Sort
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_sort = false;
|
private $_sort = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutoFilter
|
* AutoFilter
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_autoFilter = false;
|
private $_autoFilter = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pivot tables
|
* Pivot tables
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_pivotTables = false;
|
private $_pivotTables = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select unlocked cells
|
* Select unlocked cells
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_selectUnlockedCells = false;
|
private $_selectUnlockedCells = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password
|
* Password
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_password = '';
|
private $_password = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_Protection
|
* Create a new PHPExcel_Worksheet_Protection
|
||||||
@ -167,22 +167,22 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isProtectionEnabled() {
|
function isProtectionEnabled() {
|
||||||
return $this->_sheet ||
|
return $this->_sheet ||
|
||||||
$this->_objects ||
|
$this->_objects ||
|
||||||
$this->_scenarios ||
|
$this->_scenarios ||
|
||||||
$this->_formatCells ||
|
$this->_formatCells ||
|
||||||
$this->_formatColumns ||
|
$this->_formatColumns ||
|
||||||
$this->_formatRows ||
|
$this->_formatRows ||
|
||||||
$this->_insertColumns ||
|
$this->_insertColumns ||
|
||||||
$this->_insertRows ||
|
$this->_insertRows ||
|
||||||
$this->_insertHyperlinks ||
|
$this->_insertHyperlinks ||
|
||||||
$this->_deleteColumns ||
|
$this->_deleteColumns ||
|
||||||
$this->_deleteRows ||
|
$this->_deleteRows ||
|
||||||
$this->_selectLockedCells ||
|
$this->_selectLockedCells ||
|
||||||
$this->_sort ||
|
$this->_sort ||
|
||||||
$this->_autoFilter ||
|
$this->_autoFilter ||
|
||||||
$this->_pivotTables ||
|
$this->_pivotTables ||
|
||||||
$this->_selectUnlockedCells;
|
$this->_selectUnlockedCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -191,7 +191,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getSheet() {
|
function getSheet() {
|
||||||
return $this->_sheet;
|
return $this->_sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,8 +201,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setSheet($pValue = false) {
|
function setSheet($pValue = false) {
|
||||||
$this->_sheet = $pValue;
|
$this->_sheet = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -211,7 +211,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getObjects() {
|
function getObjects() {
|
||||||
return $this->_objects;
|
return $this->_objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,8 +221,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setObjects($pValue = false) {
|
function setObjects($pValue = false) {
|
||||||
$this->_objects = $pValue;
|
$this->_objects = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,7 +231,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getScenarios() {
|
function getScenarios() {
|
||||||
return $this->_scenarios;
|
return $this->_scenarios;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -241,8 +241,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setScenarios($pValue = false) {
|
function setScenarios($pValue = false) {
|
||||||
$this->_scenarios = $pValue;
|
$this->_scenarios = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -251,7 +251,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getFormatCells() {
|
function getFormatCells() {
|
||||||
return $this->_formatCells;
|
return $this->_formatCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,8 +261,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setFormatCells($pValue = false) {
|
function setFormatCells($pValue = false) {
|
||||||
$this->_formatCells = $pValue;
|
$this->_formatCells = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,7 +271,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getFormatColumns() {
|
function getFormatColumns() {
|
||||||
return $this->_formatColumns;
|
return $this->_formatColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -281,8 +281,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setFormatColumns($pValue = false) {
|
function setFormatColumns($pValue = false) {
|
||||||
$this->_formatColumns = $pValue;
|
$this->_formatColumns = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,7 +291,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getFormatRows() {
|
function getFormatRows() {
|
||||||
return $this->_formatRows;
|
return $this->_formatRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,8 +301,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setFormatRows($pValue = false) {
|
function setFormatRows($pValue = false) {
|
||||||
$this->_formatRows = $pValue;
|
$this->_formatRows = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,7 +311,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getInsertColumns() {
|
function getInsertColumns() {
|
||||||
return $this->_insertColumns;
|
return $this->_insertColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -321,8 +321,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setInsertColumns($pValue = false) {
|
function setInsertColumns($pValue = false) {
|
||||||
$this->_insertColumns = $pValue;
|
$this->_insertColumns = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -331,7 +331,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getInsertRows() {
|
function getInsertRows() {
|
||||||
return $this->_insertRows;
|
return $this->_insertRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -341,8 +341,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setInsertRows($pValue = false) {
|
function setInsertRows($pValue = false) {
|
||||||
$this->_insertRows = $pValue;
|
$this->_insertRows = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,7 +351,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getInsertHyperlinks() {
|
function getInsertHyperlinks() {
|
||||||
return $this->_insertHyperlinks;
|
return $this->_insertHyperlinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -361,8 +361,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setInsertHyperlinks($pValue = false) {
|
function setInsertHyperlinks($pValue = false) {
|
||||||
$this->_insertHyperlinks = $pValue;
|
$this->_insertHyperlinks = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,7 +371,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getDeleteColumns() {
|
function getDeleteColumns() {
|
||||||
return $this->_deleteColumns;
|
return $this->_deleteColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -381,8 +381,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setDeleteColumns($pValue = false) {
|
function setDeleteColumns($pValue = false) {
|
||||||
$this->_deleteColumns = $pValue;
|
$this->_deleteColumns = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -391,7 +391,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getDeleteRows() {
|
function getDeleteRows() {
|
||||||
return $this->_deleteRows;
|
return $this->_deleteRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -401,8 +401,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setDeleteRows($pValue = false) {
|
function setDeleteRows($pValue = false) {
|
||||||
$this->_deleteRows = $pValue;
|
$this->_deleteRows = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -411,7 +411,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getSelectLockedCells() {
|
function getSelectLockedCells() {
|
||||||
return $this->_selectLockedCells;
|
return $this->_selectLockedCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -421,8 +421,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setSelectLockedCells($pValue = false) {
|
function setSelectLockedCells($pValue = false) {
|
||||||
$this->_selectLockedCells = $pValue;
|
$this->_selectLockedCells = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -431,7 +431,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getSort() {
|
function getSort() {
|
||||||
return $this->_sort;
|
return $this->_sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -441,8 +441,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setSort($pValue = false) {
|
function setSort($pValue = false) {
|
||||||
$this->_sort = $pValue;
|
$this->_sort = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -451,7 +451,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getAutoFilter() {
|
function getAutoFilter() {
|
||||||
return $this->_autoFilter;
|
return $this->_autoFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -461,8 +461,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setAutoFilter($pValue = false) {
|
function setAutoFilter($pValue = false) {
|
||||||
$this->_autoFilter = $pValue;
|
$this->_autoFilter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -471,7 +471,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getPivotTables() {
|
function getPivotTables() {
|
||||||
return $this->_pivotTables;
|
return $this->_pivotTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -481,8 +481,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setPivotTables($pValue = false) {
|
function setPivotTables($pValue = false) {
|
||||||
$this->_pivotTables = $pValue;
|
$this->_pivotTables = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -491,7 +491,7 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getSelectUnlockedCells() {
|
function getSelectUnlockedCells() {
|
||||||
return $this->_selectUnlockedCells;
|
return $this->_selectUnlockedCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -501,8 +501,8 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setSelectUnlockedCells($pValue = false) {
|
function setSelectUnlockedCells($pValue = false) {
|
||||||
$this->_selectUnlockedCells = $pValue;
|
$this->_selectUnlockedCells = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -511,35 +511,35 @@ class PHPExcel_Worksheet_Protection
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getPassword() {
|
function getPassword() {
|
||||||
return $this->_password;
|
return $this->_password;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Password
|
* Set Password
|
||||||
*
|
*
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||||
* @return PHPExcel_Worksheet_Protection
|
* @return PHPExcel_Worksheet_Protection
|
||||||
*/
|
*/
|
||||||
function setPassword($pValue = '', $pAlreadyHashed = false) {
|
function setPassword($pValue = '', $pAlreadyHashed = false) {
|
||||||
if (!$pAlreadyHashed) {
|
if (!$pAlreadyHashed) {
|
||||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||||
}
|
}
|
||||||
$this->_password = $pValue;
|
$this->_password = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -36,43 +36,43 @@
|
|||||||
class PHPExcel_Worksheet_SheetView
|
class PHPExcel_Worksheet_SheetView
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Sheet View types */
|
/* Sheet View types */
|
||||||
const SHEETVIEW_NORMAL = 'normal';
|
const SHEETVIEW_NORMAL = 'normal';
|
||||||
const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
|
const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
|
||||||
const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
|
const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
|
||||||
|
|
||||||
private static $_sheetViewTypes = array(
|
private static $_sheetViewTypes = array(
|
||||||
self::SHEETVIEW_NORMAL,
|
self::SHEETVIEW_NORMAL,
|
||||||
self::SHEETVIEW_PAGE_LAYOUT,
|
self::SHEETVIEW_PAGE_LAYOUT,
|
||||||
self::SHEETVIEW_PAGE_BREAK_PREVIEW,
|
self::SHEETVIEW_PAGE_BREAK_PREVIEW,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ZoomScale
|
* ZoomScale
|
||||||
*
|
*
|
||||||
* Valid values range from 10 to 400.
|
* Valid values range from 10 to 400.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_zoomScale = 100;
|
private $_zoomScale = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ZoomScaleNormal
|
* ZoomScaleNormal
|
||||||
*
|
*
|
||||||
* Valid values range from 10 to 400.
|
* Valid values range from 10 to 400.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_zoomScaleNormal = 100;
|
private $_zoomScaleNormal = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View
|
* View
|
||||||
*
|
*
|
||||||
* Valid values range from 10 to 400.
|
* Valid values range from 10 to 400.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_sheetviewType = self::SHEETVIEW_NORMAL;
|
private $_sheetviewType = self::SHEETVIEW_NORMAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_SheetView
|
* Create a new PHPExcel_Worksheet_SheetView
|
||||||
@ -81,108 +81,108 @@ class PHPExcel_Worksheet_SheetView
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ZoomScale
|
* Get ZoomScale
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getZoomScale() {
|
public function getZoomScale() {
|
||||||
return $this->_zoomScale;
|
return $this->_zoomScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ZoomScale
|
* Set ZoomScale
|
||||||
*
|
*
|
||||||
* Valid values range from 10 to 400.
|
* Valid values range from 10 to 400.
|
||||||
*
|
*
|
||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_SheetView
|
* @return PHPExcel_Worksheet_SheetView
|
||||||
*/
|
*/
|
||||||
public function setZoomScale($pValue = 100) {
|
public function setZoomScale($pValue = 100) {
|
||||||
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
|
// 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 >= 1
|
// but it is apparently still able to handle any scale >= 1
|
||||||
if (($pValue >= 1) || is_null($pValue)) {
|
if (($pValue >= 1) || is_null($pValue)) {
|
||||||
$this->_zoomScale = $pValue;
|
$this->_zoomScale = $pValue;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ZoomScaleNormal
|
* Get ZoomScaleNormal
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getZoomScaleNormal() {
|
public function getZoomScaleNormal() {
|
||||||
return $this->_zoomScaleNormal;
|
return $this->_zoomScaleNormal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ZoomScale
|
* Set ZoomScale
|
||||||
*
|
*
|
||||||
* Valid values range from 10 to 400.
|
* Valid values range from 10 to 400.
|
||||||
*
|
*
|
||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_SheetView
|
* @return PHPExcel_Worksheet_SheetView
|
||||||
*/
|
*/
|
||||||
public function setZoomScaleNormal($pValue = 100) {
|
public function setZoomScaleNormal($pValue = 100) {
|
||||||
if (($pValue >= 1) || is_null($pValue)) {
|
if (($pValue >= 1) || is_null($pValue)) {
|
||||||
$this->_zoomScaleNormal = $pValue;
|
$this->_zoomScaleNormal = $pValue;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get View
|
* Get View
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getView() {
|
public function getView() {
|
||||||
return $this->_sheetviewType;
|
return $this->_sheetviewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set View
|
* Set View
|
||||||
*
|
*
|
||||||
* Valid values are
|
* Valid values are
|
||||||
* 'normal' self::SHEETVIEW_NORMAL
|
* 'normal' self::SHEETVIEW_NORMAL
|
||||||
* 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
|
* 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
|
||||||
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
|
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
|
||||||
*
|
*
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet_SheetView
|
* @return PHPExcel_Worksheet_SheetView
|
||||||
*/
|
*/
|
||||||
public function setView($pValue = NULL) {
|
public function setView($pValue = NULL) {
|
||||||
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
|
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
|
||||||
// via the user interface
|
// via the user interface
|
||||||
if ($pValue === NULL)
|
if ($pValue === NULL)
|
||||||
$pValue = self::SHEETVIEW_NORMAL;
|
$pValue = self::SHEETVIEW_NORMAL;
|
||||||
if (in_array($pValue, self::$_sheetViewTypes)) {
|
if (in_array($pValue, self::$_sheetViewTypes)) {
|
||||||
$this->_sheetviewType = $pValue;
|
$this->_sheetviewType = $pValue;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("Invalid sheetview layout type.");
|
throw new PHPExcel_Exception("Invalid sheetview layout type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$this->$key = clone $value;
|
$this->$key = clone $value;
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -48,7 +48,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
|||||||
* @param PHPExcel_Writer_IWriter $pWriter
|
* @param PHPExcel_Writer_IWriter $pWriter
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) {
|
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null)
|
||||||
|
{
|
||||||
$this->_parentWriter = $pWriter;
|
$this->_parentWriter = $pWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +59,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
|||||||
* @return PHPExcel_Writer_IWriter
|
* @return PHPExcel_Writer_IWriter
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function getParentWriter() {
|
public function getParentWriter()
|
||||||
|
{
|
||||||
if (!is_null($this->_parentWriter)) {
|
if (!is_null($this->_parentWriter)) {
|
||||||
return $this->_parentWriter;
|
return $this->_parentWriter;
|
||||||
} else {
|
} else {
|
||||||
@ -72,10 +74,10 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
|||||||
* @param PHPExcel_Writer_IWriter $pWriter
|
* @param PHPExcel_Writer_IWriter $pWriter
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel_Writer_IWriter $pWriter = null) {
|
public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
|
||||||
|
{
|
||||||
if (!is_null($pWriter)) {
|
if (!is_null($pWriter)) {
|
||||||
$this->_parentWriter = $pWriter;
|
$this->_parentWriter = $pWriter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param PHPExcel $phpExcel PHPExcel object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel) {
|
public function __construct(PHPExcel $phpExcel)
|
||||||
|
{
|
||||||
$this->_phpExcel = $phpExcel;
|
$this->_phpExcel = $phpExcel;
|
||||||
|
|
||||||
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
|
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
|
||||||
@ -107,13 +108,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null) {
|
public function save($pFilename = null)
|
||||||
|
{
|
||||||
|
|
||||||
// garbage collect
|
// garbage collect
|
||||||
$this->_phpExcel->garbageCollect();
|
$this->_phpExcel->garbageCollect();
|
||||||
|
|
||||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
|
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
|
||||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
|
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
||||||
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
|
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||||
|
|
||||||
@ -121,18 +123,12 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$this->_colors = array();
|
$this->_colors = array();
|
||||||
|
|
||||||
// Initialise workbook writer
|
// Initialise workbook writer
|
||||||
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel,
|
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
|
||||||
$this->_str_total, $this->_str_unique, $this->_str_table,
|
|
||||||
$this->_colors, $this->_parser);
|
|
||||||
|
|
||||||
// Initialise worksheet writers
|
// Initialise worksheet writers
|
||||||
$countSheets = $this->_phpExcel->getSheetCount();
|
$countSheets = $this->_phpExcel->getSheetCount();
|
||||||
for ($i = 0; $i < $countSheets; ++$i) {
|
for ($i = 0; $i < $countSheets; ++$i) {
|
||||||
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique,
|
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
|
||||||
$this->_str_table, $this->_colors,
|
|
||||||
$this->_parser,
|
|
||||||
$this->_preCalculateFormulas,
|
|
||||||
$this->_phpExcel->getSheet($i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
|
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
|
||||||
@ -190,26 +186,26 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
|
|
||||||
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
|
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
|
||||||
// initialize OLE Document Summary Information
|
// initialize OLE Document Summary Information
|
||||||
if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){
|
if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) {
|
||||||
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
|
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
|
||||||
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
|
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_summaryInformation = $this->_writeSummaryInformation();
|
$this->_summaryInformation = $this->_writeSummaryInformation();
|
||||||
// initialize OLE Summary Information
|
// initialize OLE Summary Information
|
||||||
if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){
|
if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) {
|
||||||
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
|
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
|
||||||
$OLE_SummaryInformation->append($this->_summaryInformation);
|
$OLE_SummaryInformation->append($this->_summaryInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// define OLE Parts
|
// define OLE Parts
|
||||||
$arrRootData = array($OLE);
|
$arrRootData = array($OLE);
|
||||||
// initialize OLE Properties file
|
// initialize OLE Properties file
|
||||||
if(isset($OLE_SummaryInformation)){
|
if (isset($OLE_SummaryInformation)) {
|
||||||
$arrRootData[] = $OLE_SummaryInformation;
|
$arrRootData[] = $OLE_SummaryInformation;
|
||||||
}
|
}
|
||||||
// initialize OLE Extended Properties file
|
// initialize OLE Extended Properties file
|
||||||
if(isset($OLE_DocumentSummaryInformation)){
|
if (isset($OLE_DocumentSummaryInformation)) {
|
||||||
$arrRootData[] = $OLE_DocumentSummaryInformation;
|
$arrRootData[] = $OLE_DocumentSummaryInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +225,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
* @throws PHPExcel_Writer_Exception when directory does not exist
|
* @throws PHPExcel_Writer_Exception when directory does not exist
|
||||||
* @return PHPExcel_Writer_Excel5
|
* @return PHPExcel_Writer_Excel5
|
||||||
*/
|
*/
|
||||||
public function setTempDir($pValue = '') {
|
public function setTempDir($pValue = '')
|
||||||
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,13 +327,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AutoFilters
|
// AutoFilters
|
||||||
if(!empty($filterRange)){
|
if (!empty($filterRange)) {
|
||||||
$rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
|
$rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
|
||||||
$iNumColStart = $rangeBounds[0][0];
|
$iNumColStart = $rangeBounds[0][0];
|
||||||
$iNumColEnd = $rangeBounds[1][0];
|
$iNumColEnd = $rangeBounds[1][0];
|
||||||
|
|
||||||
$iInc = $iNumColStart;
|
$iInc = $iNumColStart;
|
||||||
while($iInc <= $iNumColEnd){
|
while($iInc <= $iNumColEnd) {
|
||||||
++$countShapes[$sheetIndex];
|
++$countShapes[$sheetIndex];
|
||||||
|
|
||||||
// create an Drawing Object for the dropdown
|
// create an Drawing Object for the dropdown
|
||||||
@ -444,8 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
++$sheetCountShapes;
|
++$sheetCountShapes;
|
||||||
++$totalCountShapes;
|
++$totalCountShapes;
|
||||||
|
|
||||||
$spId = $sheetCountShapes
|
$spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
|
||||||
| ($this->_phpExcel->getIndex($sheet) + 1) << 10;
|
|
||||||
$spIdMax = max($spId, $spIdMax);
|
$spIdMax = max($spId, $spIdMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,41 +459,35 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
|
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
|
||||||
foreach ($sheet->getDrawingCollection() as $drawing) {
|
foreach ($sheet->getDrawingCollection() as $drawing) {
|
||||||
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
|
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
|
||||||
|
|
||||||
$filename = $drawing->getPath();
|
$filename = $drawing->getPath();
|
||||||
|
|
||||||
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
|
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
|
||||||
|
|
||||||
switch ($imageFormat) {
|
switch ($imageFormat) {
|
||||||
|
case 1: // GIF, not supported by BIFF8, we convert to PNG
|
||||||
case 1: // GIF, not supported by BIFF8, we convert to PNG
|
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
ob_start();
|
||||||
ob_start();
|
imagepng(imagecreatefromgif ($filename));
|
||||||
imagepng(imagecreatefromgif($filename));
|
$blipData = ob_get_contents();
|
||||||
$blipData = ob_get_contents();
|
ob_end_clean();
|
||||||
ob_end_clean();
|
break;
|
||||||
break;
|
case 2: // JPEG
|
||||||
|
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
||||||
case 2: // JPEG
|
$blipData = file_get_contents($filename);
|
||||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
break;
|
||||||
$blipData = file_get_contents($filename);
|
case 3: // PNG
|
||||||
break;
|
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||||
|
$blipData = file_get_contents($filename);
|
||||||
case 3: // PNG
|
break;
|
||||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
case 6: // Windows DIB (BMP), we convert to PNG
|
||||||
$blipData = file_get_contents($filename);
|
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||||
break;
|
ob_start();
|
||||||
|
imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
|
||||||
case 6: // Windows DIB (BMP), we convert to PNG
|
$blipData = ob_get_contents();
|
||||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
ob_end_clean();
|
||||||
ob_start();
|
break;
|
||||||
imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
|
default:
|
||||||
$blipData = ob_get_contents();
|
continue 2;
|
||||||
ob_end_clean();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: continue 2;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
|
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
|
||||||
@ -508,23 +498,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$BSE->setBlip($blip);
|
$BSE->setBlip($blip);
|
||||||
|
|
||||||
$bstoreContainer->addBSE($BSE);
|
$bstoreContainer->addBSE($BSE);
|
||||||
|
|
||||||
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
|
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
|
||||||
|
|
||||||
switch ($drawing->getRenderingFunction()) {
|
switch ($drawing->getRenderingFunction()) {
|
||||||
|
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
|
||||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
|
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
||||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
$renderingFunction = 'imagejpeg';
|
||||||
$renderingFunction = 'imagejpeg';
|
break;
|
||||||
break;
|
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
|
||||||
|
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
|
||||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
|
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
|
||||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
|
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
|
$renderingFunction = 'imagepng';
|
||||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
break;
|
||||||
$renderingFunction = 'imagepng';
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
@ -552,8 +537,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
* Build the OLE Part for DocumentSummary Information
|
* Build the OLE Part for DocumentSummary Information
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function _writeDocumentSummaryInformation(){
|
private function _writeDocumentSummaryInformation()
|
||||||
|
{
|
||||||
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
|
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
|
||||||
$data = pack('v', 0xFFFE);
|
$data = pack('v', 0xFFFE);
|
||||||
// offset: 2; size: 2;
|
// offset: 2; size: 2;
|
||||||
@ -586,7 +571,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
|
|
||||||
// GKPIDDSI_CATEGORY : Category
|
// GKPIDDSI_CATEGORY : Category
|
||||||
if($this->_phpExcel->getProperties()->getCategory()){
|
if ($this->_phpExcel->getProperties()->getCategory()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getCategory();
|
$dataProp = $this->_phpExcel->getProperties()->getCategory();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -682,7 +667,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
// 4 Property count
|
// 4 Property count
|
||||||
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
|
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
|
||||||
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
|
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
|
||||||
foreach ($dataSection as $dataProp){
|
foreach ($dataSection as $dataProp) {
|
||||||
// Summary
|
// Summary
|
||||||
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
|
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
|
||||||
// Offset
|
// Offset
|
||||||
@ -690,25 +675,25 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
// DataType
|
// DataType
|
||||||
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
|
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
|
||||||
// Data
|
// Data
|
||||||
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
|
if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
|
||||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 4;
|
$dataSection_Content_Offset += 4 + 4;
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
|
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 4;
|
$dataSection_Content_Offset += 4 + 4;
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x0B){ // Boolean
|
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||||
if($dataProp['data']['data'] == false){
|
if ($dataProp['data']['data'] == false) {
|
||||||
$dataSection_Content .= pack('V', 0x0000);
|
$dataSection_Content .= pack('V', 0x0000);
|
||||||
} else {
|
} else {
|
||||||
$dataSection_Content .= pack('V', 0x0001);
|
$dataSection_Content .= pack('V', 0x0001);
|
||||||
}
|
}
|
||||||
$dataSection_Content_Offset += 4 + 4;
|
$dataSection_Content_Offset += 4 + 4;
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
|
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||||
// Null-terminated string
|
// Null-terminated string
|
||||||
$dataProp['data']['data'] .= chr(0);
|
$dataProp['data']['data'] .= chr(0);
|
||||||
$dataProp['data']['length'] += 1;
|
$dataProp['data']['length'] += 1;
|
||||||
@ -721,7 +706,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||||
$dataSection_Content .= $dataProp['data']['data'];
|
$dataSection_Content .= $dataProp['data']['data'];
|
||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 8;
|
$dataSection_Content_Offset += 4 + 8;
|
||||||
@ -753,7 +738,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
* Build the OLE Part for Summary Information
|
* Build the OLE Part for Summary Information
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function _writeSummaryInformation(){
|
private function _writeSummaryInformation()
|
||||||
|
{
|
||||||
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
|
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
|
||||||
$data = pack('v', 0xFFFE);
|
$data = pack('v', 0xFFFE);
|
||||||
// offset: 2; size: 2;
|
// offset: 2; size: 2;
|
||||||
@ -786,7 +772,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
if($this->_phpExcel->getProperties()->getTitle()){
|
if ($this->_phpExcel->getProperties()->getTitle()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getTitle();
|
$dataProp = $this->_phpExcel->getProperties()->getTitle();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -795,7 +781,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Subject
|
// Subject
|
||||||
if($this->_phpExcel->getProperties()->getSubject()){
|
if ($this->_phpExcel->getProperties()->getSubject()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getSubject();
|
$dataProp = $this->_phpExcel->getProperties()->getSubject();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -804,7 +790,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Author (Creator)
|
// Author (Creator)
|
||||||
if($this->_phpExcel->getProperties()->getCreator()){
|
if ($this->_phpExcel->getProperties()->getCreator()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getCreator();
|
$dataProp = $this->_phpExcel->getProperties()->getCreator();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -813,7 +799,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Keywords
|
// Keywords
|
||||||
if($this->_phpExcel->getProperties()->getKeywords()){
|
if ($this->_phpExcel->getProperties()->getKeywords()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
|
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -822,7 +808,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Comments (Description)
|
// Comments (Description)
|
||||||
if($this->_phpExcel->getProperties()->getDescription()){
|
if ($this->_phpExcel->getProperties()->getDescription()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getDescription();
|
$dataProp = $this->_phpExcel->getProperties()->getDescription();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -831,7 +817,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Last Saved By (LastModifiedBy)
|
// Last Saved By (LastModifiedBy)
|
||||||
if($this->_phpExcel->getProperties()->getLastModifiedBy()){
|
if ($this->_phpExcel->getProperties()->getLastModifiedBy()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
|
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -840,7 +826,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Created Date/Time
|
// Created Date/Time
|
||||||
if($this->_phpExcel->getProperties()->getCreated()){
|
if ($this->_phpExcel->getProperties()->getCreated()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getCreated();
|
$dataProp = $this->_phpExcel->getProperties()->getCreated();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -849,7 +835,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
$dataSection_NumProps++;
|
$dataSection_NumProps++;
|
||||||
}
|
}
|
||||||
// Modified Date/Time
|
// Modified Date/Time
|
||||||
if($this->_phpExcel->getProperties()->getModified()){
|
if ($this->_phpExcel->getProperties()->getModified()) {
|
||||||
$dataProp = $this->_phpExcel->getProperties()->getModified();
|
$dataProp = $this->_phpExcel->getProperties()->getModified();
|
||||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
|
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
|
||||||
'offset' => array('pack' => 'V'),
|
'offset' => array('pack' => 'V'),
|
||||||
@ -869,7 +855,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
// 4 Property count
|
// 4 Property count
|
||||||
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
|
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
|
||||||
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
|
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
|
||||||
foreach ($dataSection as $dataProp){
|
foreach ($dataSection as $dataProp) {
|
||||||
// Summary
|
// Summary
|
||||||
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
|
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
|
||||||
// Offset
|
// Offset
|
||||||
@ -877,17 +863,17 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
// DataType
|
// DataType
|
||||||
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
|
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
|
||||||
// Data
|
// Data
|
||||||
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
|
if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
|
||||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 4;
|
$dataSection_Content_Offset += 4 + 4;
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
|
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 4;
|
$dataSection_Content_Offset += 4 + 4;
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
|
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||||
// Null-terminated string
|
// Null-terminated string
|
||||||
$dataProp['data']['data'] .= chr(0);
|
$dataProp['data']['data'] .= chr(0);
|
||||||
$dataProp['data']['length'] += 1;
|
$dataProp['data']['length'] += 1;
|
||||||
@ -900,7 +886,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||||
}
|
}
|
||||||
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||||
$dataSection_Content .= $dataProp['data']['data'];
|
$dataSection_Content .= $dataProp['data']['data'];
|
||||||
|
|
||||||
$dataSection_Content_Offset += 4 + 8;
|
$dataSection_Content_Offset += 4 + 8;
|
||||||
|
@ -118,7 +118,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
|
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
|
||||||
if ($number == $teststr) {
|
if ($number == $teststr) {
|
||||||
$byte_order = 0; // Little Endian
|
$byte_order = 0; // Little Endian
|
||||||
} elseif ($number == strrev($teststr)){
|
} elseif ($number == strrev($teststr)) {
|
||||||
$byte_order = 1; // Big Endian
|
$byte_order = 1; // Big Endian
|
||||||
} else {
|
} else {
|
||||||
// Give up. I'll fix this in a later version.
|
// Give up. I'll fix this in a later version.
|
||||||
@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
* @param string $data binary data to append
|
* @param string $data binary data to append
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _append($data)
|
private function _append($data)
|
||||||
{
|
{
|
||||||
if (strlen($data) - 4 > $this->_limit) {
|
if (strlen($data) - 4 > $this->_limit) {
|
||||||
$data = $this->_addContinue($data);
|
$data = $this->_addContinue($data);
|
||||||
@ -169,7 +169,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
* 0x0010 Worksheet.
|
* 0x0010 Worksheet.
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _storeBof($type)
|
private function _storeBof($type)
|
||||||
{
|
{
|
||||||
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
|
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
|
||||||
$length = 0x0010;
|
$length = 0x0010;
|
||||||
@ -182,7 +182,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
|
|
||||||
$version = 0x0600; // BIFF8
|
$version = 0x0600; // BIFF8
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack("vvvv", $version, $type, $build, $year);
|
$data = pack("vvvv", $version, $type, $build, $year);
|
||||||
$this->_append($header . $data . $unknown);
|
$this->_append($header . $data . $unknown);
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _storeEof()
|
private function _storeEof()
|
||||||
{
|
{
|
||||||
$record = 0x000A; // Record identifier
|
$record = 0x000A; // Record identifier
|
||||||
$length = 0x0000; // Number of bytes to follow
|
$length = 0x0000; // Number of bytes to follow
|
||||||
@ -226,7 +226,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
* @return string A very convenient string of continue blocks
|
* @return string A very convenient string of continue blocks
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _addContinue($data)
|
private function _addContinue($data)
|
||||||
{
|
{
|
||||||
$limit = $this->_limit;
|
$limit = $this->_limit;
|
||||||
$record = 0x003C; // Record identifier
|
$record = 0x003C; // Record identifier
|
||||||
@ -251,5 +251,4 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
|
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,436 +78,423 @@ class PHPExcel_Writer_Excel5_Escher
|
|||||||
$this->_data = '';
|
$this->_data = '';
|
||||||
|
|
||||||
switch (get_class($this->_object)) {
|
switch (get_class($this->_object)) {
|
||||||
|
case 'PHPExcel_Shared_Escher':
|
||||||
|
if ($dggContainer = $this->_object->getDggContainer()) {
|
||||||
|
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
|
||||||
|
$this->_data = $writer->close();
|
||||||
|
} else if ($dgContainer = $this->_object->getDgContainer()) {
|
||||||
|
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
|
||||||
|
$this->_data = $writer->close();
|
||||||
|
$this->_spOffsets = $writer->getSpOffsets();
|
||||||
|
$this->_spTypes = $writer->getSpTypes();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DggContainer':
|
||||||
|
// this is a container record
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher':
|
// initialize
|
||||||
if ($dggContainer = $this->_object->getDggContainer()) {
|
$innerData = '';
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
|
|
||||||
$this->_data = $writer->close();
|
|
||||||
} else if ($dgContainer = $this->_object->getDgContainer()) {
|
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
|
|
||||||
$this->_data = $writer->close();
|
|
||||||
$this->_spOffsets = $writer->getSpOffsets();
|
|
||||||
$this->_spTypes = $writer->getSpTypes();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DggContainer':
|
// write the dgg
|
||||||
// this is a container record
|
$recVer = 0x0;
|
||||||
|
$recInstance = 0x0000;
|
||||||
|
$recType = 0xF006;
|
||||||
|
|
||||||
// initialize
|
$recVerInstance = $recVer;
|
||||||
$innerData = '';
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
// write the dgg
|
// dgg data
|
||||||
$recVer = 0x0;
|
$dggData =
|
||||||
$recInstance = 0x0000;
|
pack('VVVV',
|
||||||
$recType = 0xF006;
|
$this->_object->getSpIdMax(), // maximum shape identifier increased by one
|
||||||
|
$this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
|
||||||
|
$this->_object->getCSpSaved(),
|
||||||
|
$this->_object->getCDgSaved() // count total number of drawings saved
|
||||||
|
);
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
// add file identifier clusters (one per drawing)
|
||||||
$recVerInstance |= $recInstance << 4;
|
$IDCLs = $this->_object->getIDCLs();
|
||||||
|
|
||||||
// dgg data
|
foreach ($IDCLs as $dgId => $maxReducedSpId) {
|
||||||
$dggData =
|
$dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
|
||||||
pack('VVVV'
|
}
|
||||||
, $this->_object->getSpIdMax() // maximum shape identifier increased by one
|
|
||||||
, $this->_object->getCDgSaved() + 1 // number of file identifier clusters increased by one
|
|
||||||
, $this->_object->getCSpSaved()
|
|
||||||
, $this->_object->getCDgSaved() // count total number of drawings saved
|
|
||||||
);
|
|
||||||
|
|
||||||
// add file identifier clusters (one per drawing)
|
$header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
|
||||||
$IDCLs = $this->_object->getIDCLs();
|
$innerData .= $header . $dggData;
|
||||||
|
|
||||||
foreach ($IDCLs as $dgId => $maxReducedSpId) {
|
// write the bstoreContainer
|
||||||
$dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
|
if ($bstoreContainer = $this->_object->getBstoreContainer()) {
|
||||||
}
|
$writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
|
|
||||||
$innerData .= $header . $dggData;
|
|
||||||
|
|
||||||
// write the bstoreContainer
|
|
||||||
if ($bstoreContainer = $this->_object->getBstoreContainer()) {
|
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
|
|
||||||
$innerData .= $writer->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// write the record
|
|
||||||
$recVer = 0xF;
|
|
||||||
$recInstance = 0x0000;
|
|
||||||
$recType = 0xF000;
|
|
||||||
$length = strlen($innerData);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$this->_data = $header . $innerData;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
|
|
||||||
// this is a container record
|
|
||||||
|
|
||||||
// initialize
|
|
||||||
$innerData = '';
|
|
||||||
|
|
||||||
// treat the inner data
|
|
||||||
if ($BSECollection = $this->_object->getBSECollection()) {
|
|
||||||
foreach ($BSECollection as $BSE) {
|
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($BSE);
|
|
||||||
$innerData .= $writer->close();
|
$innerData .= $writer->close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// write the record
|
// write the record
|
||||||
$recVer = 0xF;
|
$recVer = 0xF;
|
||||||
$recInstance = count($this->_object->getBSECollection());
|
$recInstance = 0x0000;
|
||||||
$recType = 0xF001;
|
$recType = 0xF000;
|
||||||
$length = strlen($innerData);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$this->_data = $header . $innerData;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
|
|
||||||
// this is a semi-container record
|
|
||||||
|
|
||||||
// initialize
|
|
||||||
$innerData = '';
|
|
||||||
|
|
||||||
// here we treat the inner data
|
|
||||||
if ($blip = $this->_object->getBlip()) {
|
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($blip);
|
|
||||||
$innerData .= $writer->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialize
|
|
||||||
$data = '';
|
|
||||||
|
|
||||||
$btWin32 = $this->_object->getBlipType();
|
|
||||||
$btMacOS = $this->_object->getBlipType();
|
|
||||||
$data .= pack('CC', $btWin32, $btMacOS);
|
|
||||||
|
|
||||||
$rgbUid = pack('VVVV', 0,0,0,0); // todo
|
|
||||||
$data .= $rgbUid;
|
|
||||||
|
|
||||||
$tag = 0;
|
|
||||||
$size = strlen($innerData);
|
|
||||||
$cRef = 1;
|
|
||||||
$foDelay = 0; //todo
|
|
||||||
$unused1 = 0x0;
|
|
||||||
$cbName = 0x0;
|
|
||||||
$unused2 = 0x0;
|
|
||||||
$unused3 = 0x0;
|
|
||||||
$data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
|
|
||||||
|
|
||||||
$data .= $innerData;
|
|
||||||
|
|
||||||
// write the record
|
|
||||||
$recVer = 0x2;
|
|
||||||
$recInstance = $this->_object->getBlipType();
|
|
||||||
$recType = 0xF007;
|
|
||||||
$length = strlen($data);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$this->_data = $header;
|
|
||||||
|
|
||||||
$this->_data .= $data;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
|
|
||||||
// this is an atom record
|
|
||||||
|
|
||||||
// write the record
|
|
||||||
switch ($this->_object->getParent()->getBlipType()) {
|
|
||||||
|
|
||||||
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
|
|
||||||
// initialize
|
|
||||||
$innerData = '';
|
|
||||||
|
|
||||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
|
||||||
$innerData .= $rgbUid1;
|
|
||||||
|
|
||||||
$tag = 0xFF; // todo
|
|
||||||
$innerData .= pack('C', $tag);
|
|
||||||
|
|
||||||
$innerData .= $this->_object->getData();
|
|
||||||
|
|
||||||
$recVer = 0x0;
|
|
||||||
$recInstance = 0x46A;
|
|
||||||
$recType = 0xF01D;
|
|
||||||
$length = strlen($innerData);
|
$length = strlen($innerData);
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
$recVerInstance = $recVer;
|
||||||
$recVerInstance |= $recInstance << 4;
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
$this->_data = $header;
|
$this->_data = $header . $innerData;
|
||||||
|
|
||||||
$this->_data .= $innerData;
|
|
||||||
break;
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
|
||||||
|
// this is a container record
|
||||||
|
|
||||||
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
|
|
||||||
// initialize
|
// initialize
|
||||||
$innerData = '';
|
$innerData = '';
|
||||||
|
|
||||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
// treat the inner data
|
||||||
$innerData .= $rgbUid1;
|
if ($BSECollection = $this->_object->getBSECollection()) {
|
||||||
|
foreach ($BSECollection as $BSE) {
|
||||||
$tag = 0xFF; // todo
|
$writer = new PHPExcel_Writer_Excel5_Escher($BSE);
|
||||||
$innerData .= pack('C', $tag);
|
$innerData .= $writer->close();
|
||||||
|
}
|
||||||
$innerData .= $this->_object->getData();
|
|
||||||
|
|
||||||
$recVer = 0x0;
|
|
||||||
$recInstance = 0x6E0;
|
|
||||||
$recType = 0xF01E;
|
|
||||||
$length = strlen($innerData);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$this->_data = $header;
|
|
||||||
|
|
||||||
$this->_data .= $innerData;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DgContainer':
|
|
||||||
// this is a container record
|
|
||||||
|
|
||||||
// initialize
|
|
||||||
$innerData = '';
|
|
||||||
|
|
||||||
// write the dg
|
|
||||||
$recVer = 0x0;
|
|
||||||
$recInstance = $this->_object->getDgId();
|
|
||||||
$recType = 0xF008;
|
|
||||||
$length = 8;
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
// number of shapes in this drawing (including group shape)
|
|
||||||
$countShapes = count($this->_object->getSpgrContainer()->getChildren());
|
|
||||||
$innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
|
|
||||||
//$innerData .= $header . pack('VV', 0, 0);
|
|
||||||
|
|
||||||
// write the spgrContainer
|
|
||||||
if ($spgrContainer = $this->_object->getSpgrContainer()) {
|
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
|
|
||||||
$innerData .= $writer->close();
|
|
||||||
|
|
||||||
// get the shape offsets relative to the spgrContainer record
|
|
||||||
$spOffsets = $writer->getSpOffsets();
|
|
||||||
$spTypes = $writer->getSpTypes();
|
|
||||||
|
|
||||||
// save the shape offsets relative to dgContainer
|
|
||||||
foreach ($spOffsets as & $spOffset) {
|
|
||||||
$spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write the record
|
||||||
|
$recVer = 0xF;
|
||||||
|
$recInstance = count($this->_object->getBSECollection());
|
||||||
|
$recType = 0xF001;
|
||||||
|
$length = strlen($innerData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
$this->_data = $header . $innerData;
|
||||||
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
|
||||||
|
// this is a semi-container record
|
||||||
|
|
||||||
|
// initialize
|
||||||
|
$innerData = '';
|
||||||
|
|
||||||
|
// here we treat the inner data
|
||||||
|
if ($blip = $this->_object->getBlip()) {
|
||||||
|
$writer = new PHPExcel_Writer_Excel5_Escher($blip);
|
||||||
|
$innerData .= $writer->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize
|
||||||
|
$data = '';
|
||||||
|
|
||||||
|
$btWin32 = $this->_object->getBlipType();
|
||||||
|
$btMacOS = $this->_object->getBlipType();
|
||||||
|
$data .= pack('CC', $btWin32, $btMacOS);
|
||||||
|
|
||||||
|
$rgbUid = pack('VVVV', 0,0,0,0); // todo
|
||||||
|
$data .= $rgbUid;
|
||||||
|
|
||||||
|
$tag = 0;
|
||||||
|
$size = strlen($innerData);
|
||||||
|
$cRef = 1;
|
||||||
|
$foDelay = 0; //todo
|
||||||
|
$unused1 = 0x0;
|
||||||
|
$cbName = 0x0;
|
||||||
|
$unused2 = 0x0;
|
||||||
|
$unused3 = 0x0;
|
||||||
|
$data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
|
||||||
|
|
||||||
|
$data .= $innerData;
|
||||||
|
|
||||||
|
// write the record
|
||||||
|
$recVer = 0x2;
|
||||||
|
$recInstance = $this->_object->getBlipType();
|
||||||
|
$recType = 0xF007;
|
||||||
|
$length = strlen($data);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
$this->_data = $header;
|
||||||
|
|
||||||
|
$this->_data .= $data;
|
||||||
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
|
||||||
|
// this is an atom record
|
||||||
|
|
||||||
|
// write the record
|
||||||
|
switch ($this->_object->getParent()->getBlipType()) {
|
||||||
|
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
|
||||||
|
// initialize
|
||||||
|
$innerData = '';
|
||||||
|
|
||||||
|
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||||
|
$innerData .= $rgbUid1;
|
||||||
|
|
||||||
|
$tag = 0xFF; // todo
|
||||||
|
$innerData .= pack('C', $tag);
|
||||||
|
|
||||||
|
$innerData .= $this->_object->getData();
|
||||||
|
|
||||||
|
$recVer = 0x0;
|
||||||
|
$recInstance = 0x46A;
|
||||||
|
$recType = 0xF01D;
|
||||||
|
$length = strlen($innerData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
$this->_data = $header;
|
||||||
|
|
||||||
|
$this->_data .= $innerData;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
|
||||||
|
// initialize
|
||||||
|
$innerData = '';
|
||||||
|
|
||||||
|
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||||
|
$innerData .= $rgbUid1;
|
||||||
|
|
||||||
|
$tag = 0xFF; // todo
|
||||||
|
$innerData .= pack('C', $tag);
|
||||||
|
|
||||||
|
$innerData .= $this->_object->getData();
|
||||||
|
|
||||||
|
$recVer = 0x0;
|
||||||
|
$recInstance = 0x6E0;
|
||||||
|
$recType = 0xF01E;
|
||||||
|
$length = strlen($innerData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
$this->_data = $header;
|
||||||
|
|
||||||
|
$this->_data .= $innerData;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DgContainer':
|
||||||
|
// this is a container record
|
||||||
|
|
||||||
|
// initialize
|
||||||
|
$innerData = '';
|
||||||
|
|
||||||
|
// write the dg
|
||||||
|
$recVer = 0x0;
|
||||||
|
$recInstance = $this->_object->getDgId();
|
||||||
|
$recType = 0xF008;
|
||||||
|
$length = 8;
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
// number of shapes in this drawing (including group shape)
|
||||||
|
$countShapes = count($this->_object->getSpgrContainer()->getChildren());
|
||||||
|
$innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
|
||||||
|
//$innerData .= $header . pack('VV', 0, 0);
|
||||||
|
|
||||||
|
// write the spgrContainer
|
||||||
|
if ($spgrContainer = $this->_object->getSpgrContainer()) {
|
||||||
|
$writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
|
||||||
|
$innerData .= $writer->close();
|
||||||
|
|
||||||
|
// get the shape offsets relative to the spgrContainer record
|
||||||
|
$spOffsets = $writer->getSpOffsets();
|
||||||
|
$spTypes = $writer->getSpTypes();
|
||||||
|
|
||||||
|
// save the shape offsets relative to dgContainer
|
||||||
|
foreach ($spOffsets as & $spOffset) {
|
||||||
|
$spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_spOffsets = $spOffsets;
|
||||||
|
$this->_spTypes = $spTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write the record
|
||||||
|
$recVer = 0xF;
|
||||||
|
$recInstance = 0x0000;
|
||||||
|
$recType = 0xF002;
|
||||||
|
$length = strlen($innerData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
$this->_data = $header . $innerData;
|
||||||
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
|
||||||
|
// this is a container record
|
||||||
|
|
||||||
|
// initialize
|
||||||
|
$innerData = '';
|
||||||
|
|
||||||
|
// initialize spape offsets
|
||||||
|
$totalSize = 8;
|
||||||
|
$spOffsets = array();
|
||||||
|
$spTypes = array();
|
||||||
|
|
||||||
|
// treat the inner data
|
||||||
|
foreach ($this->_object->getChildren() as $spContainer) {
|
||||||
|
$writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
|
||||||
|
$spData = $writer->close();
|
||||||
|
$innerData .= $spData;
|
||||||
|
|
||||||
|
// save the shape offsets (where new shape records begin)
|
||||||
|
$totalSize += strlen($spData);
|
||||||
|
$spOffsets[] = $totalSize;
|
||||||
|
|
||||||
|
$spTypes = array_merge($spTypes, $writer->getSpTypes());
|
||||||
|
}
|
||||||
|
|
||||||
|
// write the record
|
||||||
|
$recVer = 0xF;
|
||||||
|
$recInstance = 0x0000;
|
||||||
|
$recType = 0xF003;
|
||||||
|
$length = strlen($innerData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
|
||||||
|
$this->_data = $header . $innerData;
|
||||||
$this->_spOffsets = $spOffsets;
|
$this->_spOffsets = $spOffsets;
|
||||||
$this->_spTypes = $spTypes;
|
$this->_spTypes = $spTypes;
|
||||||
}
|
break;
|
||||||
|
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
|
||||||
|
// initialize
|
||||||
|
$data = '';
|
||||||
|
|
||||||
// write the record
|
// build the data
|
||||||
$recVer = 0xF;
|
|
||||||
$recInstance = 0x0000;
|
|
||||||
$recType = 0xF002;
|
|
||||||
$length = strlen($innerData);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
// write group shape record, if necessary?
|
||||||
$recVerInstance |= $recInstance << 4;
|
if ($this->_object->getSpgr()) {
|
||||||
|
$recVer = 0x1;
|
||||||
|
$recInstance = 0x0000;
|
||||||
|
$recType = 0xF009;
|
||||||
|
$length = 0x00000010;
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
$this->_data = $header . $innerData;
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
|
$data .= $header . pack('VVVV', 0,0,0,0);
|
||||||
// this is a container record
|
|
||||||
|
|
||||||
// initialize
|
|
||||||
$innerData = '';
|
|
||||||
|
|
||||||
// initialize spape offsets
|
|
||||||
$totalSize = 8;
|
|
||||||
$spOffsets = array();
|
|
||||||
$spTypes = array();
|
|
||||||
|
|
||||||
// treat the inner data
|
|
||||||
foreach ($this->_object->getChildren() as $spContainer) {
|
|
||||||
$writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
|
|
||||||
$spData = $writer->close();
|
|
||||||
$innerData .= $spData;
|
|
||||||
|
|
||||||
// save the shape offsets (where new shape records begin)
|
|
||||||
$totalSize += strlen($spData);
|
|
||||||
$spOffsets[] = $totalSize;
|
|
||||||
|
|
||||||
$spTypes = array_merge($spTypes, $writer->getSpTypes());
|
|
||||||
}
|
|
||||||
|
|
||||||
// write the record
|
|
||||||
$recVer = 0xF;
|
|
||||||
$recInstance = 0x0000;
|
|
||||||
$recType = 0xF003;
|
|
||||||
$length = strlen($innerData);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$this->_data = $header . $innerData;
|
|
||||||
$this->_spOffsets = $spOffsets;
|
|
||||||
$this->_spTypes = $spTypes;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
|
|
||||||
// initialize
|
|
||||||
$data = '';
|
|
||||||
|
|
||||||
// build the data
|
|
||||||
|
|
||||||
// write group shape record, if necessary?
|
|
||||||
if ($this->_object->getSpgr()) {
|
|
||||||
$recVer = 0x1;
|
|
||||||
$recInstance = 0x0000;
|
|
||||||
$recType = 0xF009;
|
|
||||||
$length = 0x00000010;
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$data .= $header . pack('VVVV', 0,0,0,0);
|
|
||||||
}
|
|
||||||
$this->_spTypes[] = ($this->_object->getSpType());
|
|
||||||
|
|
||||||
// write the shape record
|
|
||||||
$recVer = 0x2;
|
|
||||||
$recInstance = $this->_object->getSpType(); // shape type
|
|
||||||
$recType = 0xF00A;
|
|
||||||
$length = 0x00000008;
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
|
|
||||||
|
|
||||||
|
|
||||||
// the options
|
|
||||||
if ($this->_object->getOPTCollection()) {
|
|
||||||
$optData = '';
|
|
||||||
|
|
||||||
$recVer = 0x3;
|
|
||||||
$recInstance = count($this->_object->getOPTCollection());
|
|
||||||
$recType = 0xF00B;
|
|
||||||
foreach ($this->_object->getOPTCollection() as $property => $value) {
|
|
||||||
$optData .= pack('vV', $property, $value);
|
|
||||||
}
|
}
|
||||||
$length = strlen($optData);
|
$this->_spTypes[] = ($this->_object->getSpType());
|
||||||
|
|
||||||
|
// write the shape record
|
||||||
|
$recVer = 0x2;
|
||||||
|
$recInstance = $this->_object->getSpType(); // shape type
|
||||||
|
$recType = 0xF00A;
|
||||||
|
$length = 0x00000008;
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
$recVerInstance = $recVer;
|
||||||
$recVerInstance |= $recInstance << 4;
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
$data .= $header . $optData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the client anchor
|
$data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
|
||||||
if ($this->_object->getStartCoordinates()) {
|
|
||||||
$clientAnchorData = '';
|
|
||||||
|
|
||||||
$recVer = 0x0;
|
|
||||||
$recInstance = 0x0;
|
|
||||||
$recType = 0xF010;
|
|
||||||
|
|
||||||
// start coordinates
|
// the options
|
||||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
|
if ($this->_object->getOPTCollection()) {
|
||||||
$c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
$optData = '';
|
||||||
$r1 = $row - 1;
|
|
||||||
|
|
||||||
// start offsetX
|
$recVer = 0x3;
|
||||||
$startOffsetX = $this->_object->getStartOffsetX();
|
$recInstance = count($this->_object->getOPTCollection());
|
||||||
|
$recType = 0xF00B;
|
||||||
|
foreach ($this->_object->getOPTCollection() as $property => $value) {
|
||||||
|
$optData .= pack('vV', $property, $value);
|
||||||
|
}
|
||||||
|
$length = strlen($optData);
|
||||||
|
|
||||||
// start offsetY
|
$recVerInstance = $recVer;
|
||||||
$startOffsetY = $this->_object->getStartOffsetY();
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
// end coordinates
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
|
$data .= $header . $optData;
|
||||||
$c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
}
|
||||||
$r2 = $row - 1;
|
|
||||||
|
|
||||||
// end offsetX
|
// the client anchor
|
||||||
$endOffsetX = $this->_object->getEndOffsetX();
|
if ($this->_object->getStartCoordinates()) {
|
||||||
|
$clientAnchorData = '';
|
||||||
|
|
||||||
// end offsetY
|
$recVer = 0x0;
|
||||||
$endOffsetY = $this->_object->getEndOffsetY();
|
$recInstance = 0x0;
|
||||||
|
$recType = 0xF010;
|
||||||
|
|
||||||
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(),
|
// start coordinates
|
||||||
$c1, $startOffsetX, $r1, $startOffsetY,
|
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
|
||||||
$c2, $endOffsetX, $r2, $endOffsetY);
|
$c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||||
|
$r1 = $row - 1;
|
||||||
$length = strlen($clientAnchorData);
|
|
||||||
|
// start offsetX
|
||||||
|
$startOffsetX = $this->_object->getStartOffsetX();
|
||||||
|
|
||||||
|
// start offsetY
|
||||||
|
$startOffsetY = $this->_object->getStartOffsetY();
|
||||||
|
|
||||||
|
// end coordinates
|
||||||
|
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
|
||||||
|
$c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||||
|
$r2 = $row - 1;
|
||||||
|
|
||||||
|
// end offsetX
|
||||||
|
$endOffsetX = $this->_object->getEndOffsetX();
|
||||||
|
|
||||||
|
// end offsetY
|
||||||
|
$endOffsetY = $this->_object->getEndOffsetY();
|
||||||
|
|
||||||
|
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
|
||||||
|
|
||||||
|
$length = strlen($clientAnchorData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
$data .= $header . $clientAnchorData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the client data, just empty for now
|
||||||
|
if (!$this->_object->getSpgr()) {
|
||||||
|
$clientDataData = '';
|
||||||
|
|
||||||
|
$recVer = 0x0;
|
||||||
|
$recInstance = 0x0;
|
||||||
|
$recType = 0xF011;
|
||||||
|
|
||||||
|
$length = strlen($clientDataData);
|
||||||
|
|
||||||
|
$recVerInstance = $recVer;
|
||||||
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
|
$data .= $header . $clientDataData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write the record
|
||||||
|
$recVer = 0xF;
|
||||||
|
$recInstance = 0x0000;
|
||||||
|
$recType = 0xF004;
|
||||||
|
$length = strlen($data);
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
$recVerInstance = $recVer;
|
||||||
$recVerInstance |= $recInstance << 4;
|
$recVerInstance |= $recInstance << 4;
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||||
$data .= $header . $clientAnchorData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the client data, just empty for now
|
|
||||||
if (!$this->_object->getSpgr()) {
|
|
||||||
$clientDataData = '';
|
|
||||||
|
|
||||||
$recVer = 0x0;
|
|
||||||
$recInstance = 0x0;
|
|
||||||
$recType = 0xF011;
|
|
||||||
|
|
||||||
$length = strlen($clientDataData);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
$data .= $header . $clientDataData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// write the record
|
|
||||||
$recVer = 0xF;
|
|
||||||
$recInstance = 0x0000;
|
|
||||||
$recType = 0xF004;
|
|
||||||
$length = strlen($data);
|
|
||||||
|
|
||||||
$recVerInstance = $recVer;
|
|
||||||
$recVerInstance |= $recInstance << 4;
|
|
||||||
|
|
||||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
|
||||||
|
|
||||||
$this->_data = $header . $data;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
$this->_data = $header . $data;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_data;
|
return $this->_data;
|
||||||
@ -532,6 +519,4 @@ class PHPExcel_Writer_Excel5_Escher
|
|||||||
{
|
{
|
||||||
return $this->_spTypes;
|
return $this->_spTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,12 +107,17 @@ class PHPExcel_Writer_Excel5_Font
|
|||||||
$grbit |= 0x20;
|
$grbit |= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = pack("vvvvvCCCC",
|
$data = pack(
|
||||||
$this->_font->getSize() * 20, // Fontsize (in twips)
|
"vvvvvCCCC",
|
||||||
|
// Fontsize (in twips)
|
||||||
|
$this->_font->getSize() * 20,
|
||||||
$grbit,
|
$grbit,
|
||||||
$icv, // Colour
|
// Colour
|
||||||
self::_mapBold($this->_font->getBold()), // Font weight
|
$icv,
|
||||||
$sss, // Superscript/Subscript
|
// Font weight
|
||||||
|
self::_mapBold($this->_font->getBold()),
|
||||||
|
// Superscript/Subscript
|
||||||
|
$sss,
|
||||||
self::_mapUnderline($this->_font->getUnderline()),
|
self::_mapUnderline($this->_font->getUnderline()),
|
||||||
$bFamily,
|
$bFamily,
|
||||||
$bCharSet,
|
$bCharSet,
|
||||||
@ -132,7 +137,8 @@ class PHPExcel_Writer_Excel5_Font
|
|||||||
* @param boolean $bold
|
* @param boolean $bold
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapBold($bold) {
|
private static function _mapBold($bold)
|
||||||
|
{
|
||||||
if ($bold) {
|
if ($bold) {
|
||||||
return 0x2BC; // 700 = Bold font weight
|
return 0x2BC; // 700 = Bold font weight
|
||||||
}
|
}
|
||||||
@ -144,22 +150,24 @@ class PHPExcel_Writer_Excel5_Font
|
|||||||
* @static array of int
|
* @static array of int
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
|
private static $_mapUnderline = array(
|
||||||
PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
|
PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
|
||||||
PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
|
PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
|
||||||
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
|
PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
|
||||||
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
|
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
|
||||||
);
|
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* Map underline
|
* Map underline
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapUnderline($underline) {
|
private static function _mapUnderline($underline)
|
||||||
if (isset(self::$_mapUnderline[$underline]))
|
{
|
||||||
|
if (isset(self::$_mapUnderline[$underline])) {
|
||||||
return self::$_mapUnderline[$underline];
|
return self::$_mapUnderline[$underline];
|
||||||
|
}
|
||||||
return 0x00;
|
return 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _initializeHashes()
|
private function _initializeHashes()
|
||||||
{
|
{
|
||||||
// The Excel ptg indices
|
// The Excel ptg indices
|
||||||
$this->ptg = array(
|
$this->ptg = array(
|
||||||
@ -512,7 +512,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param mixed $token The token to convert.
|
* @param mixed $token The token to convert.
|
||||||
* @return mixed the converted token on success
|
* @return mixed the converted token on success
|
||||||
*/
|
*/
|
||||||
function _convert($token)
|
private function _convert($token)
|
||||||
{
|
{
|
||||||
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
|
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
|
||||||
return $this->_convertString($token);
|
return $this->_convertString($token);
|
||||||
@ -521,15 +521,15 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $this->_convertNumber($token);
|
return $this->_convertNumber($token);
|
||||||
|
|
||||||
// match references like A1 or $A$1
|
// match references like A1 or $A$1
|
||||||
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/',$token)) {
|
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
|
||||||
return $this->_convertRef2d($token);
|
return $this->_convertRef2d($token);
|
||||||
|
|
||||||
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
|
// match external references like 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]\\$?(\d+)$/u",$token)) {
|
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
|
||||||
return $this->_convertRef3d($token);
|
return $this->_convertRef3d($token);
|
||||||
|
|
||||||
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
|
// match external references like '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]\\$?(\d+)$/u",$token)) {
|
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
|
||||||
return $this->_convertRef3d($token);
|
return $this->_convertRef3d($token);
|
||||||
|
|
||||||
// match ranges like A1:B2 or $A$1:$B$2
|
// match ranges like A1:B2 or $A$1:$B$2
|
||||||
@ -537,11 +537,11 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $this->_convertRange2d($token);
|
return $this->_convertRange2d($token);
|
||||||
|
|
||||||
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
|
// match external ranges like 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])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
|
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
|
||||||
return $this->_convertRange3d($token);
|
return $this->_convertRange3d($token);
|
||||||
|
|
||||||
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
|
// match external ranges like '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_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
|
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
|
||||||
return $this->_convertRange3d($token);
|
return $this->_convertRange3d($token);
|
||||||
|
|
||||||
// operators (including parentheses)
|
// operators (including parentheses)
|
||||||
@ -553,9 +553,9 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $this->_convertError($token);
|
return $this->_convertError($token);
|
||||||
|
|
||||||
// commented so argument number can be processed correctly. See toReversePolish().
|
// commented so argument number can be processed correctly. See toReversePolish().
|
||||||
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token))
|
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
|
||||||
{
|
{
|
||||||
return($this->_convertFunction($token,$this->_func_args));
|
return($this->_convertFunction($token, $this->_func_args));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// if it's an argument, ignore the token (the argument remains)
|
// if it's an argument, ignore the token (the argument remains)
|
||||||
@ -573,7 +573,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @access private
|
* @access private
|
||||||
* @param mixed $num an integer or double for conversion to its ptg value
|
* @param mixed $num an integer or double for conversion to its ptg value
|
||||||
*/
|
*/
|
||||||
function _convertNumber($num)
|
private function _convertNumber($num)
|
||||||
{
|
{
|
||||||
// Integer in the range 0..2**16-1
|
// Integer in the range 0..2**16-1
|
||||||
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
|
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
|
||||||
@ -593,7 +593,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $string A string for conversion to its ptg value.
|
* @param string $string A string for conversion to its ptg value.
|
||||||
* @return mixed the converted token on success
|
* @return mixed the converted token on success
|
||||||
*/
|
*/
|
||||||
function _convertString($string)
|
private function _convertString($string)
|
||||||
{
|
{
|
||||||
// chop away beggining and ending quotes
|
// chop away beggining and ending quotes
|
||||||
$string = substr($string, 1, strlen($string) - 2);
|
$string = substr($string, 1, strlen($string) - 2);
|
||||||
@ -613,16 +613,16 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param integer $num_args The number of arguments the function receives.
|
* @param integer $num_args The number of arguments the function receives.
|
||||||
* @return string The packed ptg for the function
|
* @return string The packed ptg for the function
|
||||||
*/
|
*/
|
||||||
function _convertFunction($token, $num_args)
|
private function _convertFunction($token, $num_args)
|
||||||
{
|
{
|
||||||
$args = $this->_functions[$token][1];
|
$args = $this->_functions[$token][1];
|
||||||
// $volatile = $this->_functions[$token][3];
|
// $volatile = $this->_functions[$token][3];
|
||||||
|
|
||||||
// Fixed number of args eg. TIME($i,$j,$k).
|
// Fixed number of args eg. TIME($i, $j, $k).
|
||||||
if ($args >= 0) {
|
if ($args >= 0) {
|
||||||
return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]);
|
return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]);
|
||||||
}
|
}
|
||||||
// Variable number of args eg. SUM($i,$j,$k, ..).
|
// Variable number of args eg. SUM($i, $j, $k, ..).
|
||||||
if ($args == -1) {
|
if ($args == -1) {
|
||||||
return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]);
|
return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]);
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $range An Excel range in the A1:A2
|
* @param string $range An Excel range in the A1:A2
|
||||||
* @param int $class
|
* @param int $class
|
||||||
*/
|
*/
|
||||||
function _convertRange2d($range, $class=0)
|
private function _convertRange2d($range, $class = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: possible class value 0,1,2 check Formula.pm
|
// TODO: possible class value 0,1,2 check Formula.pm
|
||||||
@ -673,7 +673,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $token An Excel range in the Sheet1!A1:A2 format.
|
* @param string $token An Excel range in the Sheet1!A1:A2 format.
|
||||||
* @return mixed The packed ptgArea3d token on success.
|
* @return mixed The packed ptgArea3d token on success.
|
||||||
*/
|
*/
|
||||||
function _convertRange3d($token)
|
private function _convertRange3d($token)
|
||||||
{
|
{
|
||||||
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
|
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $cell An Excel cell reference
|
* @param string $cell An Excel cell reference
|
||||||
* @return string The cell in packed() format with the corresponding ptg
|
* @return string The cell in packed() format with the corresponding ptg
|
||||||
*/
|
*/
|
||||||
function _convertRef2d($cell)
|
private function _convertRef2d($cell)
|
||||||
{
|
{
|
||||||
// $class = 2; // as far as I know, this is magick.
|
// $class = 2; // as far as I know, this is magick.
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $cell An Excel cell reference
|
* @param string $cell An Excel cell reference
|
||||||
* @return mixed The packed ptgRef3d token on success.
|
* @return mixed The packed ptgRef3d token on success.
|
||||||
*/
|
*/
|
||||||
function _convertRef3d($cell)
|
private function _convertRef3d($cell)
|
||||||
{
|
{
|
||||||
// $class = 2; // as far as I know, this is magick.
|
// $class = 2; // as far as I know, this is magick.
|
||||||
|
|
||||||
@ -779,16 +779,23 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $errorCode The error code for conversion to its ptg value
|
* @param string $errorCode The error code for conversion to its ptg value
|
||||||
* @return string The error code ptgErr
|
* @return string The error code ptgErr
|
||||||
*/
|
*/
|
||||||
function _convertError($errorCode)
|
private function _convertError($errorCode)
|
||||||
{
|
{
|
||||||
switch ($errorCode) {
|
switch ($errorCode) {
|
||||||
case '#NULL!': return pack("C", 0x00);
|
case '#NULL!':
|
||||||
case '#DIV/0!': return pack("C", 0x07);
|
return pack("C", 0x00);
|
||||||
case '#VALUE!': return pack("C", 0x0F);
|
case '#DIV/0!':
|
||||||
case '#REF!': return pack("C", 0x17);
|
return pack("C", 0x07);
|
||||||
case '#NAME?': return pack("C", 0x1D);
|
case '#VALUE!':
|
||||||
case '#NUM!': return pack("C", 0x24);
|
return pack("C", 0x0F);
|
||||||
case '#N/A': return pack("C", 0x2A);
|
case '#REF!':
|
||||||
|
return pack("C", 0x17);
|
||||||
|
case '#NAME?':
|
||||||
|
return pack("C", 0x1D);
|
||||||
|
case '#NUM!':
|
||||||
|
return pack("C", 0x24);
|
||||||
|
case '#N/A':
|
||||||
|
return pack("C", 0x2A);
|
||||||
}
|
}
|
||||||
return pack("C", 0xFF);
|
return pack("C", 0xFF);
|
||||||
}
|
}
|
||||||
@ -801,7 +808,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $ext_ref The name of the external reference
|
* @param string $ext_ref The name of the external reference
|
||||||
* @return string The reference index in packed() format
|
* @return string The reference index in packed() format
|
||||||
*/
|
*/
|
||||||
function _packExtRef($ext_ref)
|
private function _packExtRef($ext_ref)
|
||||||
{
|
{
|
||||||
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
|
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
|
||||||
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
|
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
|
||||||
@ -846,7 +853,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $ext_ref The name of the external reference
|
* @param string $ext_ref The name of the external reference
|
||||||
* @return mixed The reference index in packed() format on success
|
* @return mixed The reference index in packed() format on success
|
||||||
*/
|
*/
|
||||||
function _getRefIndex($ext_ref)
|
private function _getRefIndex($ext_ref)
|
||||||
{
|
{
|
||||||
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
|
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
|
||||||
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
|
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
|
||||||
@ -906,7 +913,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $sheet_name Sheet name
|
* @param string $sheet_name Sheet name
|
||||||
* @return integer The sheet index, -1 if the sheet was not found
|
* @return integer The sheet index, -1 if the sheet was not found
|
||||||
*/
|
*/
|
||||||
function _getSheetIndex($sheet_name)
|
private function _getSheetIndex($sheet_name)
|
||||||
{
|
{
|
||||||
if (!isset($this->_ext_sheets[$sheet_name])) {
|
if (!isset($this->_ext_sheets[$sheet_name])) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -925,7 +932,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $name The name of the worksheet being added
|
* @param string $name The name of the worksheet being added
|
||||||
* @param integer $index The index of the worksheet being added
|
* @param integer $index The index of the worksheet being added
|
||||||
*/
|
*/
|
||||||
function setExtSheet($name, $index)
|
public function setExtSheet($name, $index)
|
||||||
{
|
{
|
||||||
$this->_ext_sheets[$name] = $index;
|
$this->_ext_sheets[$name] = $index;
|
||||||
}
|
}
|
||||||
@ -937,7 +944,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $cell The Excel cell reference to be packed
|
* @param string $cell The Excel cell reference to be packed
|
||||||
* @return array Array containing the row and column in packed() format
|
* @return array Array containing the row and column in packed() format
|
||||||
*/
|
*/
|
||||||
function _cellToPackedRowcol($cell)
|
private function _cellToPackedRowcol($cell)
|
||||||
{
|
{
|
||||||
$cell = strtoupper($cell);
|
$cell = strtoupper($cell);
|
||||||
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
|
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
|
||||||
@ -966,7 +973,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $range The Excel range to be packed
|
* @param string $range The Excel range to be packed
|
||||||
* @return array Array containing (row1,col1,row2,col2) in packed() format
|
* @return array Array containing (row1,col1,row2,col2) in packed() format
|
||||||
*/
|
*/
|
||||||
function _rangeToPackedRange($range)
|
private function _rangeToPackedRange($range)
|
||||||
{
|
{
|
||||||
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
|
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
|
||||||
// return absolute rows if there is a $ in the ref
|
// return absolute rows if there is a $ in the ref
|
||||||
@ -1007,9 +1014,9 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param string $cell The Excel cell reference in A1 format.
|
* @param string $cell The Excel cell reference in A1 format.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function _cellToRowcol($cell)
|
private function _cellToRowcol($cell)
|
||||||
{
|
{
|
||||||
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/',$cell,$match);
|
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
|
||||||
// return absolute column if there is a $ in the ref
|
// return absolute column if there is a $ in the ref
|
||||||
$col_rel = empty($match[1]) ? 1 : 0;
|
$col_rel = empty($match[1]) ? 1 : 0;
|
||||||
$col_ref = $match[2];
|
$col_ref = $match[2];
|
||||||
@ -1037,7 +1044,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _advance()
|
private function _advance()
|
||||||
{
|
{
|
||||||
$i = $this->_current_char;
|
$i = $this->_current_char;
|
||||||
$formula_length = strlen($this->_formula);
|
$formula_length = strlen($this->_formula);
|
||||||
@ -1088,7 +1095,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param mixed $token The token to check.
|
* @param mixed $token The token to check.
|
||||||
* @return mixed The checked token or false on failure
|
* @return mixed The checked token or false on failure
|
||||||
*/
|
*/
|
||||||
function _match($token)
|
private function _match($token)
|
||||||
{
|
{
|
||||||
switch($token) {
|
switch($token) {
|
||||||
case "+":
|
case "+":
|
||||||
@ -1123,65 +1130,55 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// if it's a reference A1 or $A$1 or $A1 or A$1
|
// if it's a reference A1 or $A$1 or $A1 or A$1
|
||||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
|
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
|
||||||
!preg_match("/[0-9]/",$this->_lookahead) and
|
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||||
($this->_lookahead != ':') and ($this->_lookahead != '.') and
|
($this->_lookahead != ':') and ($this->_lookahead != '.') and
|
||||||
($this->_lookahead != '!'))
|
($this->_lookahead != '!')) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
// 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",$token) and
|
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
|
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
// 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",$token) and
|
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
|
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// if it's a range A1:A2 or $A$1:$A$2
|
// if it's a range A1:A2 or $A$1:$A$2
|
||||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
|
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
|
||||||
!preg_match("/[0-9]/",$this->_lookahead))
|
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
|
// If it's an external range like 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",$token) and
|
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", $token) and
|
||||||
!preg_match("/[0-9]/",$this->_lookahead))
|
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
|
// If it's an external range like '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_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
|
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", $token) and
|
||||||
!preg_match("/[0-9]/",$this->_lookahead))
|
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's a number (check that it's not a sheet name or range)
|
// If it's a number (check that it's not a sheet name or range)
|
||||||
elseif (is_numeric($token) and
|
elseif (is_numeric($token) and
|
||||||
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
|
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
|
||||||
($this->_lookahead != '!') and ($this->_lookahead != ':'))
|
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's a string (of maximum 255 characters)
|
// If it's a string (of maximum 255 characters)
|
||||||
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/",$token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0))
|
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// If it's an error code
|
// If it's an error code
|
||||||
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A')
|
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// if it's a function call
|
// if it's a function call
|
||||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
|
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
|
||||||
{
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
// It's an argument of some description (e.g. a named range),
|
// It's an argument of some description (e.g. a named range),
|
||||||
@ -1201,7 +1198,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* sign (=).
|
* sign (=).
|
||||||
* @return mixed true on success
|
* @return mixed true on success
|
||||||
*/
|
*/
|
||||||
function parse($formula)
|
public function parse($formula)
|
||||||
{
|
{
|
||||||
$this->_current_char = 0;
|
$this->_current_char = 0;
|
||||||
$this->_formula = $formula;
|
$this->_formula = $formula;
|
||||||
@ -1218,7 +1215,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @access private
|
* @access private
|
||||||
* @return mixed The parsed ptg'd tree on success
|
* @return mixed The parsed ptg'd tree on success
|
||||||
*/
|
*/
|
||||||
function _condition()
|
private function _condition()
|
||||||
{
|
{
|
||||||
$result = $this->_expression();
|
$result = $this->_expression();
|
||||||
if ($this->_current_token == "<") {
|
if ($this->_current_token == "<") {
|
||||||
@ -1264,7 +1261,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @access private
|
* @access private
|
||||||
* @return mixed The parsed ptg'd tree on success
|
* @return mixed The parsed ptg'd tree on success
|
||||||
*/
|
*/
|
||||||
function _expression()
|
private function _expression()
|
||||||
{
|
{
|
||||||
// If it's a string return a string node
|
// If it's a string return a string node
|
||||||
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
|
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
|
||||||
@ -1323,7 +1320,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @see _fact()
|
* @see _fact()
|
||||||
* @return array The parsed ptg'd tree
|
* @return array The parsed ptg'd tree
|
||||||
*/
|
*/
|
||||||
function _parenthesizedExpression()
|
private function _parenthesizedExpression()
|
||||||
{
|
{
|
||||||
$result = $this->_createTree('ptgParen', $this->_expression(), '');
|
$result = $this->_createTree('ptgParen', $this->_expression(), '');
|
||||||
return $result;
|
return $result;
|
||||||
@ -1336,7 +1333,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @access private
|
* @access private
|
||||||
* @return mixed The parsed ptg'd tree on success
|
* @return mixed The parsed ptg'd tree on success
|
||||||
*/
|
*/
|
||||||
function _term()
|
private function _term()
|
||||||
{
|
{
|
||||||
$result = $this->_fact();
|
$result = $this->_fact();
|
||||||
while (($this->_current_token == "*") or
|
while (($this->_current_token == "*") or
|
||||||
@ -1366,7 +1363,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @access private
|
* @access private
|
||||||
* @return mixed The parsed ptg'd tree on success
|
* @return mixed The parsed ptg'd tree on success
|
||||||
*/
|
*/
|
||||||
function _fact()
|
private function _fact()
|
||||||
{
|
{
|
||||||
if ($this->_current_token == "(") {
|
if ($this->_current_token == "(") {
|
||||||
$this->_advance(); // eat the "("
|
$this->_advance(); // eat the "("
|
||||||
@ -1378,29 +1375,29 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
// if it's a reference
|
// if it's a reference
|
||||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token))
|
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
|
||||||
{
|
{
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
// 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))
|
||||||
{
|
{
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
// 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))
|
||||||
{
|
{
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
// if it's a range A1:B2 or $A$1:$B$2
|
// 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))
|
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
|
||||||
{
|
{
|
||||||
// must be an error?
|
// must be an error?
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
@ -1408,7 +1405,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $result;
|
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)
|
// 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))
|
||||||
{
|
{
|
||||||
// must be an error?
|
// must be an error?
|
||||||
//$result = $this->_current_token;
|
//$result = $this->_current_token;
|
||||||
@ -1417,7 +1414,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $result;
|
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)
|
// 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))
|
||||||
{
|
{
|
||||||
// must be an error?
|
// must be an error?
|
||||||
//$result = $this->_current_token;
|
//$result = $this->_current_token;
|
||||||
@ -1438,7 +1435,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
// if it's a function call
|
// 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))
|
||||||
{
|
{
|
||||||
$result = $this->_func();
|
$result = $this->_func();
|
||||||
return $result;
|
return $result;
|
||||||
@ -1455,7 +1452,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @access private
|
* @access private
|
||||||
* @return mixed The parsed ptg'd tree on success
|
* @return mixed The parsed ptg'd tree on success
|
||||||
*/
|
*/
|
||||||
function _func()
|
private function _func()
|
||||||
{
|
{
|
||||||
$num_args = 0; // number of arguments received
|
$num_args = 0; // number of arguments received
|
||||||
$function = strtoupper($this->_current_token);
|
$function = strtoupper($this->_current_token);
|
||||||
@ -1485,7 +1482,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
|
throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
|
||||||
}
|
}
|
||||||
$args = $this->_functions[$function][1];
|
$args = $this->_functions[$function][1];
|
||||||
// If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
|
// If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
|
||||||
if (($args >= 0) and ($args != $num_args)) {
|
if (($args >= 0) and ($args != $num_args)) {
|
||||||
throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
|
throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
|
||||||
}
|
}
|
||||||
@ -1505,7 +1502,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param mixed $right The right array (sub-tree) or a final node.
|
* @param mixed $right The right array (sub-tree) or a final node.
|
||||||
* @return array A tree
|
* @return array A tree
|
||||||
*/
|
*/
|
||||||
function _createTree($value, $left, $right)
|
private function _createTree($value, $left, $right)
|
||||||
{
|
{
|
||||||
return array('value' => $value, 'left' => $left, 'right' => $right);
|
return array('value' => $value, 'left' => $left, 'right' => $right);
|
||||||
}
|
}
|
||||||
@ -1537,7 +1534,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
* @param array $tree The optional tree to convert.
|
* @param array $tree The optional tree to convert.
|
||||||
* @return string The tree in reverse polish notation
|
* @return string The tree in reverse polish notation
|
||||||
*/
|
*/
|
||||||
function toReversePolish($tree = array())
|
public function toReversePolish($tree = array())
|
||||||
{
|
{
|
||||||
$polish = ""; // the string we are going to return
|
$polish = ""; // the string we are going to return
|
||||||
if (empty($tree)) { // If it's the first call use _parse_tree
|
if (empty($tree)) { // If it's the first call use _parse_tree
|
||||||
@ -1559,9 +1556,9 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
$polish .= $converted_tree;
|
$polish .= $converted_tree;
|
||||||
}
|
}
|
||||||
// if it's a function convert it here (so we can set it's arguments)
|
// if it's a function convert it here (so we can set it's arguments)
|
||||||
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$tree['value']) and
|
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
|
||||||
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/',$tree['value']) and
|
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
|
||||||
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/",$tree['value']) and
|
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
|
||||||
!is_numeric($tree['value']) and
|
!is_numeric($tree['value']) and
|
||||||
!isset($this->ptg[$tree['value']]))
|
!isset($this->ptg[$tree['value']]))
|
||||||
{
|
{
|
||||||
@ -1579,5 +1576,4 @@ class PHPExcel_Writer_Excel5_Parser
|
|||||||
$polish .= $converted_tree;
|
$polish .= $converted_tree;
|
||||||
return $polish;
|
return $polish;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,9 +200,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
* @param array &$colors Colour Table
|
* @param array &$colors Colour Table
|
||||||
* @param mixed $parser The formula parser created for the Workbook
|
* @param mixed $parser The formula parser created for the Workbook
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel = null,
|
public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
|
||||||
&$str_total, &$str_unique, &$str_table, &$colors,
|
|
||||||
$parser )
|
|
||||||
{
|
{
|
||||||
// It needs to call its parent's constructor explicitly
|
// It needs to call its parent's constructor explicitly
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -303,7 +301,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
public function _addFont(PHPExcel_Style_Font $font)
|
public function _addFont(PHPExcel_Style_Font $font)
|
||||||
{
|
{
|
||||||
$fontHashCode = $font->getHashCode();
|
$fontHashCode = $font->getHashCode();
|
||||||
if(isset($this->_addedFonts[$fontHashCode])){
|
if (isset($this->_addedFonts[$fontHashCode])) {
|
||||||
$fontIndex = $this->_addedFonts[$fontHashCode];
|
$fontIndex = $this->_addedFonts[$fontHashCode];
|
||||||
} else {
|
} else {
|
||||||
$countFonts = count($this->_fontWriters);
|
$countFonts = count($this->_fontWriters);
|
||||||
@ -324,7 +322,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
* @param string $rgb E.g. 'FF00AA'
|
* @param string $rgb E.g. 'FF00AA'
|
||||||
* @return int Color index
|
* @return int Color index
|
||||||
*/
|
*/
|
||||||
private function _addColor($rgb) {
|
private function _addColor($rgb)
|
||||||
|
{
|
||||||
if (!isset($this->_colors[$rgb])) {
|
if (!isset($this->_colors[$rgb])) {
|
||||||
if (count($this->_colors) < 57) {
|
if (count($this->_colors) < 57) {
|
||||||
// then we add a custom color altering the palette
|
// then we add a custom color altering the palette
|
||||||
@ -354,7 +353,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _setPaletteXl97()
|
private function _setPaletteXl97()
|
||||||
{
|
{
|
||||||
$this->_palette = array(
|
$this->_palette = array(
|
||||||
0x08 => array(0x00, 0x00, 0x00, 0x00),
|
0x08 => array(0x00, 0x00, 0x00, 0x00),
|
||||||
@ -477,7 +476,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _calcSheetOffsets()
|
private function _calcSheetOffsets()
|
||||||
{
|
{
|
||||||
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
|
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
|
||||||
|
|
||||||
@ -583,7 +582,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$print_rowmax,
|
$print_rowmax,
|
||||||
$print_colmin,
|
$print_colmin,
|
||||||
$print_colmax
|
$print_colmax
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,11 +607,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$rowmax,
|
$rowmax,
|
||||||
$colmin,
|
$colmin,
|
||||||
$colmax
|
$colmax
|
||||||
);
|
);
|
||||||
|
|
||||||
// (exclusive) either repeatColumns or repeatRows
|
// (exclusive) either repeatColumns or repeatRows
|
||||||
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
|
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
|
||||||
|
|
||||||
// Columns to repeat
|
// Columns to repeat
|
||||||
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
|
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
|
||||||
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
|
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
|
||||||
@ -640,7 +638,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$rowmax,
|
$rowmax,
|
||||||
$colmin,
|
$colmin,
|
||||||
$colmax
|
$colmax
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -658,7 +656,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
// Loop named ranges
|
// Loop named ranges
|
||||||
$namedRanges = $this->_phpExcel->getNamedRanges();
|
$namedRanges = $this->_phpExcel->getNamedRanges();
|
||||||
foreach ($namedRanges as $namedRange) {
|
foreach ($namedRanges as $namedRange) {
|
||||||
|
|
||||||
// Create absolute coordinate
|
// Create absolute coordinate
|
||||||
$range = PHPExcel_Cell::splitRange($namedRange->getRange());
|
$range = PHPExcel_Cell::splitRange($namedRange->getRange());
|
||||||
for ($i = 0; $i < count($range); $i++) {
|
for ($i = 0; $i < count($range); $i++) {
|
||||||
@ -688,7 +685,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
}
|
}
|
||||||
$chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
|
$chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
|
||||||
|
|
||||||
} catch(PHPExcel_Exception $e) {
|
} catch (PHPExcel_Exception $e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,7 +718,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
|
|
||||||
// (exclusive) either repeatColumns or repeatRows
|
// (exclusive) either repeatColumns or repeatRows
|
||||||
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
|
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
|
||||||
|
|
||||||
// Columns to repeat
|
// Columns to repeat
|
||||||
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
|
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
|
||||||
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
|
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
|
||||||
@ -785,7 +781,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
for ($i = 0; $i < $total_worksheets; ++$i) {
|
for ($i = 0; $i < $total_worksheets; ++$i) {
|
||||||
$sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter();
|
$sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter();
|
||||||
$autoFilterRange = $sheetAutoFilter->getRange();
|
$autoFilterRange = $sheetAutoFilter->getRange();
|
||||||
if(!empty($autoFilterRange)) {
|
if (!empty($autoFilterRange)) {
|
||||||
$rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
$rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||||
|
|
||||||
//Autofilter built in name
|
//Autofilter built in name
|
||||||
@ -842,19 +838,21 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
* @param boolean $isHidden
|
* @param boolean $isHidden
|
||||||
* @return string Complete binary record data
|
* @return string Complete binary record data
|
||||||
* */
|
* */
|
||||||
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false){
|
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
|
||||||
|
{
|
||||||
$record = 0x0018;
|
$record = 0x0018;
|
||||||
|
|
||||||
// option flags
|
// option flags
|
||||||
$options = ($isHidden ? 0x21 : 0x00);
|
$options = ($isHidden ? 0x21 : 0x00);
|
||||||
|
|
||||||
$extra = pack('Cvvvvv',
|
$extra = pack('Cvvvvv',
|
||||||
0x3B,
|
0x3B,
|
||||||
$sheetIndex - 1,
|
$sheetIndex - 1,
|
||||||
$rangeBounds[0][1] - 1,
|
$rangeBounds[0][1] - 1,
|
||||||
$rangeBounds[1][1] - 1,
|
$rangeBounds[1][1] - 1,
|
||||||
$rangeBounds[0][0] - 1,
|
$rangeBounds[0][0] - 1,
|
||||||
$rangeBounds[1][0] - 1);
|
$rangeBounds[1][0] - 1
|
||||||
|
);
|
||||||
|
|
||||||
// size of the formula (in bytes)
|
// size of the formula (in bytes)
|
||||||
$sz = strlen($extra);
|
$sz = strlen($extra);
|
||||||
@ -879,7 +877,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$cv = $this->_codepage; // The code page
|
$cv = $this->_codepage; // The code page
|
||||||
|
|
||||||
$header = pack('vv', $record, $length);
|
$header = pack('vv', $record, $length);
|
||||||
$data = pack('v', $cv);
|
$data = pack('v', $cv);
|
||||||
|
|
||||||
$this->_append($header . $data);
|
$this->_append($header . $data);
|
||||||
}
|
}
|
||||||
@ -909,10 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
|
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
|
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
|
||||||
$grbit,
|
|
||||||
$itabCur, $itabFirst,
|
|
||||||
$ctabsel, $wTabRatio);
|
|
||||||
$this->_append($header . $data);
|
$this->_append($header . $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -929,10 +924,18 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
|
|
||||||
// sheet state
|
// sheet state
|
||||||
switch ($sheet->getSheetState()) {
|
switch ($sheet->getSheetState()) {
|
||||||
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break;
|
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
|
||||||
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break;
|
$ss = 0x00;
|
||||||
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break;
|
break;
|
||||||
default: $ss = 0x00; break;
|
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN:
|
||||||
|
$ss = 0x01;
|
||||||
|
break;
|
||||||
|
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN:
|
||||||
|
$ss = 0x02;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$ss = 0x00;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sheet type
|
// sheet type
|
||||||
@ -944,7 +947,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
|
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
|
||||||
|
|
||||||
$length = strlen($data);
|
$length = strlen($data);
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$this->_append($header . $data);
|
$this->_append($header . $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,7 +976,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$length = 2 + 6 * $total_references; // Number of bytes to follow
|
$length = 2 + 6 * $total_references; // Number of bytes to follow
|
||||||
|
|
||||||
$supbook_index = 0; // FIXME: only using internal SUPBOOK record
|
$supbook_index = 0; // FIXME: only using internal SUPBOOK record
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack('v', $total_references);
|
$data = pack('v', $total_references);
|
||||||
for ($i = 0; $i < $total_references; ++$i) {
|
for ($i = 0; $i < $total_references; ++$i) {
|
||||||
$data .= $this->_parser->_references[$i];
|
$data .= $this->_parser->_references[$i];
|
||||||
@ -993,7 +996,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$BuiltIn = 0x00; // Built-in style
|
$BuiltIn = 0x00; // Built-in style
|
||||||
$iLevel = 0xff; // Outline style level
|
$iLevel = 0xff; // Outline style level
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
|
$data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
|
||||||
$this->_append($header . $data);
|
$this->_append($header . $data);
|
||||||
}
|
}
|
||||||
@ -1051,7 +1054,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$length = 0x0002; // Number of bytes to follow
|
$length = 0x0002; // Number of bytes to follow
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack("v", $cxals);
|
$data = pack("v", $cxals);
|
||||||
$this->_append($header . $data);
|
$this->_append($header . $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,7 +1075,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$cch = strlen($sheetname); // Length of sheet name
|
$cch = strlen($sheetname); // Length of sheet name
|
||||||
$rgch = 0x03; // Filename encoding
|
$rgch = 0x03; // Filename encoding
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack("CC", $cch, $rgch);
|
$data = pack("CC", $cch, $rgch);
|
||||||
$this->_append($header . $data . $sheetname);
|
$this->_append($header . $data . $sheetname);
|
||||||
}
|
}
|
||||||
@ -1177,7 +1180,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$unknown07 = 0x1087;
|
$unknown07 = 0x1087;
|
||||||
$unknown08 = 0x8008;
|
$unknown08 = 0x8008;
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
$data = pack("v", $grbit);
|
$data = pack("v", $grbit);
|
||||||
$data .= pack("C", $chKey);
|
$data .= pack("C", $chKey);
|
||||||
$data .= pack("C", $cch);
|
$data .= pack("C", $cch);
|
||||||
@ -1232,7 +1235,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$record = 0x008C; // Record identifier
|
$record = 0x008C; // Record identifier
|
||||||
$length = 4; // Number of bytes to follow
|
$length = 4; // Number of bytes to follow
|
||||||
|
|
||||||
$header = pack('vv', $record, $length);
|
$header = pack('vv', $record, $length);
|
||||||
/* using the same country code always for simplicity */
|
/* using the same country code always for simplicity */
|
||||||
$data = pack('vv', $this->_country_code, $this->_country_code);
|
$data = pack('vv', $this->_country_code, $this->_country_code);
|
||||||
//$this->_append($header . $data);
|
//$this->_append($header . $data);
|
||||||
@ -1249,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$record = 0x01C1; // Record identifier
|
$record = 0x01C1; // Record identifier
|
||||||
$length = 8; // Number of bytes to follow
|
$length = 8; // Number of bytes to follow
|
||||||
|
|
||||||
$header = pack('vv', $record, $length);
|
$header = pack('vv', $record, $length);
|
||||||
|
|
||||||
// by inspection of real Excel files, MS Office Excel 2007 writes this
|
// by inspection of real Excel files, MS Office Excel 2007 writes this
|
||||||
$data = pack('VV', 0x000001C1, 0x00001E667);
|
$data = pack('VV', 0x000001C1, 0x00001E667);
|
||||||
@ -1276,7 +1279,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$header = pack("vvv", $record, $length, $ccv);
|
$header = pack("vvv", $record, $length, $ccv);
|
||||||
$this->_append($header . $data);
|
$this->_append($header . $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1307,7 +1310,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
|
|
||||||
// loop through all (unique) strings in shared strings table
|
// loop through all (unique) strings in shared strings table
|
||||||
foreach (array_keys($this->_str_table) as $string) {
|
foreach (array_keys($this->_str_table) as $string) {
|
||||||
|
|
||||||
// here $string is a BIFF8 encoded string
|
// here $string is a BIFF8 encoded string
|
||||||
|
|
||||||
// length = character count
|
// length = character count
|
||||||
@ -1320,7 +1322,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$finished = false;
|
$finished = false;
|
||||||
|
|
||||||
while ($finished === false) {
|
while ($finished === false) {
|
||||||
|
|
||||||
// normally, there will be only one cycle, but if string cannot immediately be written as is
|
// normally, there will be only one cycle, but if string cannot immediately be written as is
|
||||||
// there will be need for more than one cylcle, if string longer than one record data block, there
|
// there will be need for more than one cylcle, if string longer than one record data block, there
|
||||||
// may be need for even more cycles
|
// may be need for even more cycles
|
||||||
@ -1369,7 +1370,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
$effective_space_remaining = $space_remaining;
|
$effective_space_remaining = $space_remaining;
|
||||||
|
|
||||||
// for uncompressed strings, sometimes effective space remaining is reduced by 1
|
// for uncompressed strings, sometimes effective space remaining is reduced by 1
|
||||||
if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) {
|
if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) {
|
||||||
--$effective_space_remaining;
|
--$effective_space_remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,10 +1420,9 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||||||
|
|
||||||
$record = 0x00EB;
|
$record = 0x00EB;
|
||||||
$length = strlen($data);
|
$length = strlen($data);
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
|
|
||||||
return $this->writeData($header . $data);
|
return $this->writeData($header . $data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
*
|
*
|
||||||
* @return string The XF record
|
* @return string The XF record
|
||||||
*/
|
*/
|
||||||
function writeXf()
|
public function writeXf()
|
||||||
{
|
{
|
||||||
// Set the type of the XF record and some of the attributes.
|
// Set the type of the XF record and some of the attributes.
|
||||||
if ($this->_isStyleXf) {
|
if ($this->_isStyleXf) {
|
||||||
@ -249,18 +249,14 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
|
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
|
||||||
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26;
|
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26;
|
||||||
|
|
||||||
$header = pack("vv", $record, $length);
|
$header = pack("vv", $record, $length);
|
||||||
|
|
||||||
//BIFF8 options: identation, shrinkToFit and text direction
|
//BIFF8 options: identation, shrinkToFit and text direction
|
||||||
$biff8_options = $this->_style->getAlignment()->getIndent();
|
$biff8_options = $this->_style->getAlignment()->getIndent();
|
||||||
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
|
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
|
||||||
|
|
||||||
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
|
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
|
||||||
$data .= pack("CCC"
|
$data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
|
||||||
, self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
|
|
||||||
, $biff8_options
|
|
||||||
, $used_attrib
|
|
||||||
);
|
|
||||||
$data .= pack("VVv", $border1, $border2, $icv);
|
$data .= pack("VVv", $border1, $border2, $icv);
|
||||||
|
|
||||||
return($header . $data);
|
return($header . $data);
|
||||||
@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setBottomColor($colorIndex)
|
public function setBottomColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_bottom_color = $colorIndex;
|
$this->_bottom_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setTopColor($colorIndex)
|
public function setTopColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_top_color = $colorIndex;
|
$this->_top_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setLeftColor($colorIndex)
|
public function setLeftColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_left_color = $colorIndex;
|
$this->_left_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setRightColor($colorIndex)
|
public function setRightColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_right_color = $colorIndex;
|
$this->_right_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setDiagColor($colorIndex)
|
public function setDiagColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_diag_color = $colorIndex;
|
$this->_diag_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setFgColor($colorIndex)
|
public function setFgColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_fg_color = $colorIndex;
|
$this->_fg_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param int $colorIndex Color index
|
* @param int $colorIndex Color index
|
||||||
*/
|
*/
|
||||||
function setBgColor($colorIndex)
|
public function setBgColor($colorIndex)
|
||||||
{
|
{
|
||||||
$this->_bg_color = $colorIndex;
|
$this->_bg_color = $colorIndex;
|
||||||
}
|
}
|
||||||
@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @access public
|
* @access public
|
||||||
* @param integer $numberFormatIndex Index to format record
|
* @param integer $numberFormatIndex Index to format record
|
||||||
*/
|
*/
|
||||||
function setNumberFormatIndex($numberFormatIndex)
|
public function setNumberFormatIndex($numberFormatIndex)
|
||||||
{
|
{
|
||||||
$this->_numberFormatIndex = $numberFormatIndex;
|
$this->_numberFormatIndex = $numberFormatIndex;
|
||||||
}
|
}
|
||||||
@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @param string $borderStyle
|
* @param string $borderStyle
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapBorderStyle($borderStyle) {
|
private static function _mapBorderStyle($borderStyle)
|
||||||
if (isset(self::$_mapBorderStyle[$borderStyle]))
|
{
|
||||||
|
if (isset(self::$_mapBorderStyle[$borderStyle])) {
|
||||||
return self::$_mapBorderStyle[$borderStyle];
|
return self::$_mapBorderStyle[$borderStyle];
|
||||||
|
}
|
||||||
return 0x00;
|
return 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @param string $fillType
|
* @param string $fillType
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapFillType($fillType) {
|
private static function _mapFillType($fillType)
|
||||||
if (isset(self::$_mapFillType[$fillType]))
|
{
|
||||||
|
if (isset(self::$_mapFillType[$fillType])) {
|
||||||
return self::$_mapFillType[$fillType];
|
return self::$_mapFillType[$fillType];
|
||||||
|
}
|
||||||
return 0x00;
|
return 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
*/
|
*/
|
||||||
private function _mapHAlign($hAlign)
|
private function _mapHAlign($hAlign)
|
||||||
{
|
{
|
||||||
if (isset(self::$_mapHAlign[$hAlign]))
|
if (isset(self::$_mapHAlign[$hAlign])) {
|
||||||
return self::$_mapHAlign[$hAlign];
|
return self::$_mapHAlign[$hAlign];
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,9 +491,11 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @param string $vAlign
|
* @param string $vAlign
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapVAlign($vAlign) {
|
private static function _mapVAlign($vAlign)
|
||||||
if (isset(self::$_mapVAlign[$vAlign]))
|
{
|
||||||
|
if (isset(self::$_mapVAlign[$vAlign])) {
|
||||||
return self::$_mapVAlign[$vAlign];
|
return self::$_mapVAlign[$vAlign];
|
||||||
|
}
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +505,8 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @param int $textRotation
|
* @param int $textRotation
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapTextRotation($textRotation) {
|
private static function _mapTextRotation($textRotation)
|
||||||
|
{
|
||||||
if ($textRotation >= 0) {
|
if ($textRotation >= 0) {
|
||||||
return $textRotation;
|
return $textRotation;
|
||||||
}
|
}
|
||||||
@ -520,12 +524,17 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @param string
|
* @param string
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapLocked($locked) {
|
private static function _mapLocked($locked)
|
||||||
|
{
|
||||||
switch ($locked) {
|
switch ($locked) {
|
||||||
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1;
|
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
|
||||||
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
|
return 1;
|
||||||
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
|
case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
|
||||||
default: return 1;
|
return 1;
|
||||||
|
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,13 +544,17 @@ class PHPExcel_Writer_Excel5_Xf
|
|||||||
* @param string
|
* @param string
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function _mapHidden($hidden) {
|
private static function _mapHidden($hidden)
|
||||||
|
{
|
||||||
switch ($hidden) {
|
switch ($hidden) {
|
||||||
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0;
|
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
|
||||||
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
|
return 0;
|
||||||
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
|
case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
|
||||||
default: return 0;
|
return 1;
|
||||||
|
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -944,7 +944,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||||||
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
|
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
|
||||||
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
|
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
|
||||||
$css['text-align'] = $textAlign;
|
$css['text-align'] = $textAlign;
|
||||||
if (in_array($textAlign,array('left','right'))) {
|
if (in_array($textAlign, array('left', 'right'))) {
|
||||||
$css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
|
$css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1015,7 +1015,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||||||
{
|
{
|
||||||
// Create CSS
|
// Create CSS
|
||||||
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
|
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
|
||||||
// Create CSS - add !important to non-none border styles for merged cells
|
// Create CSS - add !important to non-none border styles for merged cells
|
||||||
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
|
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
|
||||||
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
|
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
|
||||||
|
|
||||||
@ -1265,10 +1265,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// General horizontal alignment: Actual horizontal alignment depends on dataType
|
// General horizontal alignment: Actual horizontal alignment depends on dataType
|
||||||
$sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() );
|
$sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex());
|
||||||
if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
|
if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
|
||||||
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align']))
|
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) {
|
||||||
{
|
|
||||||
$cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
|
$cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1303,39 +1302,39 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||||||
if ($writeCell) {
|
if ($writeCell) {
|
||||||
// Column start
|
// Column start
|
||||||
$html .= ' <' . $cellType;
|
$html .= ' <' . $cellType;
|
||||||
if (!$this->_useInlineCss) {
|
if (!$this->_useInlineCss) {
|
||||||
$html .= ' class="' . $cssClass . '"';
|
$html .= ' class="' . $cssClass . '"';
|
||||||
} else {
|
} else {
|
||||||
//** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
|
//** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
|
||||||
// We must explicitly write the width of the <td> element because TCPDF
|
// We must explicitly write the width of the <td> element because TCPDF
|
||||||
// does not recognize e.g. <col style="width:42pt">
|
// does not recognize e.g. <col style="width:42pt">
|
||||||
$width = 0;
|
$width = 0;
|
||||||
$i = $colNum - 1;
|
$i = $colNum - 1;
|
||||||
$e = $colNum + $colSpan - 1;
|
$e = $colNum + $colSpan - 1;
|
||||||
while ($i++ < $e) {
|
while ($i++ < $e) {
|
||||||
if (isset($this->_columnWidths[$sheetIndex][$i])) {
|
if (isset($this->_columnWidths[$sheetIndex][$i])) {
|
||||||
$width += $this->_columnWidths[$sheetIndex][$i];
|
$width += $this->_columnWidths[$sheetIndex][$i];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$cssClass['width'] = $width . 'pt';
|
}
|
||||||
|
$cssClass['width'] = $width . 'pt';
|
||||||
|
|
||||||
// We must also explicitly write the height of the <td> element because TCPDF
|
// We must also explicitly write the height of the <td> element because TCPDF
|
||||||
// does not recognize e.g. <tr style="height:50pt">
|
// does not recognize e.g. <tr style="height:50pt">
|
||||||
if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
|
if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
|
||||||
$height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
|
$height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
|
||||||
$cssClass['height'] = $height;
|
$cssClass['height'] = $height;
|
||||||
}
|
}
|
||||||
//** end of redundant code **
|
//** end of redundant code **
|
||||||
|
|
||||||
$html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
|
$html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
|
||||||
}
|
}
|
||||||
if ($colSpan > 1) {
|
if ($colSpan > 1) {
|
||||||
$html .= ' colspan="' . $colSpan . '"';
|
$html .= ' colspan="' . $colSpan . '"';
|
||||||
}
|
}
|
||||||
if ($rowSpan > 1) {
|
if ($rowSpan > 1) {
|
||||||
$html .= ' rowspan="' . $rowSpan . '"';
|
$html .= ' rowspan="' . $rowSpan . '"';
|
||||||
}
|
}
|
||||||
$html .= '>';
|
$html .= '>';
|
||||||
|
|
||||||
// Image?
|
// Image?
|
||||||
$html .= $this->_writeImageInCell($pSheet, $coordinate);
|
$html .= $this->_writeImageInCell($pSheet, $coordinate);
|
||||||
@ -1510,13 +1509,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||||||
|
|
||||||
// loop through the individual cells in the individual merge
|
// loop through the individual cells in the individual merge
|
||||||
$r = $fr - 1;
|
$r = $fr - 1;
|
||||||
while($r++ < $lr) {
|
while ($r++ < $lr) {
|
||||||
// also, flag this row as a HTML row that is candidate to be omitted
|
// also, flag this row as a HTML row that is candidate to be omitted
|
||||||
$candidateSpannedRow[$r] = $r;
|
$candidateSpannedRow[$r] = $r;
|
||||||
|
|
||||||
$c = $fc - 1;
|
$c = $fc - 1;
|
||||||
while($c++ < $lc) {
|
while ($c++ < $lc) {
|
||||||
if ( !($c == $fc && $r == $fr) ) {
|
if (!($c == $fc && $r == $fr)) {
|
||||||
// not the upper-left cell (should not be written in HTML)
|
// not the upper-left cell (should not be written in HTML)
|
||||||
$this->_isSpannedCell[$sheetIndex][$r][$c] = array(
|
$this->_isSpannedCell[$sheetIndex][$r][$c] = array(
|
||||||
'baseCell' => array($fr, $fc),
|
'baseCell' => array($fr, $fc),
|
||||||
@ -1546,15 +1545,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
|
// For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
|
||||||
if ( isset($this->_isSpannedRow[$sheetIndex]) ) {
|
if (isset($this->_isSpannedRow[$sheetIndex])) {
|
||||||
foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
|
foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
|
||||||
$adjustedBaseCells = array();
|
$adjustedBaseCells = array();
|
||||||
$c = -1;
|
$c = -1;
|
||||||
$e = $countColumns - 1;
|
$e = $countColumns - 1;
|
||||||
while($c++ < $e) {
|
while ($c++ < $e) {
|
||||||
$baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
|
$baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
|
||||||
|
|
||||||
if ( !in_array($baseCell, $adjustedBaseCells) ) {
|
if (!in_array($baseCell, $adjustedBaseCells)) {
|
||||||
// subtract rowspan by 1
|
// subtract rowspan by 1
|
||||||
--$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
|
--$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
|
||||||
$adjustedBaseCells[] = $baseCell;
|
$adjustedBaseCells[] = $baseCell;
|
||||||
|
@ -34,5 +34,4 @@ interface PHPExcel_Writer_IWriter
|
|||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null);
|
public function save($pFilename = null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_OpenDocument
|
* @package PHPExcel_Writer_OpenDocument
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_OpenDocument
|
* @package PHPExcel_Writer_OpenDocument
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"ext-xmlwriter": "*"
|
"ext-xmlwriter": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "1.*"
|
"squizlabs/php_codesniffer": "2.*"
|
||||||
},
|
},
|
||||||
"recommend": {
|
"recommend": {
|
||||||
"ext-zip": "*",
|
"ext-zip": "*",
|
||||||
|
Loading…
Reference in New Issue
Block a user