Delete debug and commented out code

This commit is contained in:
Adrien Crivelli 2016-08-26 18:08:26 +09:00
parent f917b3b1f4
commit 91417ad1c3
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
75 changed files with 22 additions and 715 deletions

View File

@ -18,8 +18,6 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) {
}
/**
* \PhpSpreadsheet\Calculation (Multiton)
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -3099,34 +3097,25 @@ class Calculation
// The guts of the lexical parser
// Loop through the formula extracting each operator and operand in turn
while (true) {
//echo 'Assessing Expression '.substr($formula, $index), PHP_EOL;
$opCharacter = $formula{$index}; // Get the first character of the value at the current index position
//echo 'Initial character of expression block is '.$opCharacter, PHP_EOL;
if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index + 1}]))) {
$opCharacter .= $formula{++$index};
//echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL;
}
// Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand
$isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match);
//echo '$isOperandOrFunction is '.(($isOperandOrFunction) ? 'True' : 'False').PHP_EOL;
//var_dump($match);
if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus?
//echo 'Element is a Negation operator', PHP_EOL;
$stack->push('Unary Operator', '~'); // Put a negation on the stack
++$index; // and drop the negation symbol
} elseif ($opCharacter == '%' && $expectingOperator) {
//echo 'Element is a Percentage operator', PHP_EOL;
$stack->push('Unary Operator', '%'); // Put a percentage on the stack
++$index;
} elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded?
//echo 'Element is a Positive number, not Plus operator', PHP_EOL;
++$index; // Drop the redundant plus symbol
} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal
return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
} elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
//echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL;
while ($stack->count() > 0 &&
($o2 = $stack->last()) &&
isset(self::$operators[$o2['value']]) &&
@ -3137,7 +3126,6 @@ class Calculation
++$index;
$expectingOperator = false;
} elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis?
//echo 'Element is a Closing bracket', PHP_EOL;
$expectingOperand = false;
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
if ($o2 === null) {
@ -3149,24 +3137,14 @@ class Calculation
$d = $stack->last(2);
if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function?
$functionName = $matches[1]; // Get the function name
//echo 'Closed Function is '.$functionName, PHP_EOL;
$d = $stack->pop();
$argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack)
//if ($argumentCount == 0) {
// echo 'With no arguments', PHP_EOL;
//} elseif ($argumentCount == 1) {
// echo 'With 1 argument', PHP_EOL;
//} else {
// echo 'With '.$argumentCount.' arguments', PHP_EOL;
//}
$output[] = $d; // Dump the argument count on the output
$output[] = $stack->pop(); // Pop the function and push onto the output
if (isset(self::$controlFunctions[$functionName])) {
//echo 'Built-in function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount'];
$functionCall = self::$controlFunctions[$functionName]['functionCall'];
} elseif (isset(self::$phpSpreadsheetFunctions[$functionName])) {
//echo 'PhpSpreadsheet function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$phpSpreadsheetFunctions[$functionName]['argumentCount'];
$functionCall = self::$phpSpreadsheetFunctions[$functionName]['functionCall'];
} else { // did we somehow push a non-function on the stack? this should never happen
@ -3176,13 +3154,11 @@ class Calculation
$argumentCountError = false;
if (is_numeric($expectedArgumentCount)) {
if ($expectedArgumentCount < 0) {
//echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount), PHP_EOL;
if ($argumentCount > abs($expectedArgumentCount)) {
$argumentCountError = true;
$expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount);
}
} else {
//echo '$expectedArgumentCount is numeric '.$expectedArgumentCount, PHP_EOL;
if ($argumentCount != $expectedArgumentCount) {
$argumentCountError = true;
$expectedArgumentCountString = $expectedArgumentCount;
@ -3190,8 +3166,6 @@ class Calculation
}
} elseif ($expectedArgumentCount != '*') {
$isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/', $expectedArgumentCount, $argMatch);
//print_r($argMatch);
//echo PHP_EOL;
switch ($argMatch[2]) {
case '+':
if ($argumentCount < $argMatch[1]) {
@ -3219,7 +3193,6 @@ class Calculation
}
++$index;
} elseif ($opCharacter == ',') { // Is this the separator for function arguments?
//echo 'Element is a Function argument separator', PHP_EOL;
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
if ($o2 === null) {
return $this->raiseFormulaError('Formula Error: Unexpected ,');
@ -3244,7 +3217,6 @@ class Calculation
$expectingOperand = true;
++$index;
} elseif ($opCharacter == '(' && !$expectingOperator) {
// echo 'Element is an Opening Bracket<br />';
$stack->push('Brace', '(');
++$index;
} elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number?
@ -3252,11 +3224,9 @@ class Calculation
$expectingOperand = false;
$val = $match[1];
$length = strlen($val);
// echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />';
if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $val, $matches)) {
$val = preg_replace('/\s/u', '', $val);
// echo 'Element '.$val.' is a Function<br />';
if (isset(self::$phpSpreadsheetFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function
$stack->push('Function', strtoupper($val));
$ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index + $length), $amatch);
@ -3272,7 +3242,6 @@ class Calculation
$output[] = ['type' => 'Value', 'value' => $matches[1], 'reference' => null];
}
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $val, $matches)) {
// echo 'Element '.$val.' is a Cell reference<br />';
// Watch for this case-change when modifying to allow cell references in different worksheets...
// Should only be applied to the actual cell column, not the worksheet name
@ -3294,9 +3263,7 @@ class Calculation
}
$output[] = ['type' => 'Cell Reference', 'value' => $val, 'reference' => $val];
// $expectingOperator = FALSE;
} else { // it's a variable, constant, string, number or boolean
// echo 'Element is a Variable, Constant, String, Number or Boolean<br />';
// If the last entry on the stack was a : operator, then we may have a row or column range reference
$testPrevOp = $stack->last(1);
if ($testPrevOp['value'] == ':') {
@ -3332,24 +3299,18 @@ class Calculation
$localeConstant = false;
if ($opCharacter == '"') {
// echo 'Element is a String<br />';
// UnEscape any quotes within the string
$val = self::wrapResult(str_replace('""', '"', self::unwrapResult($val)));
} elseif (is_numeric($val)) {
// echo 'Element is a Number<br />';
if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
// echo 'Casting '.$val.' to float<br />';
$val = (float) $val;
} else {
// echo 'Casting '.$val.' to integer<br />';
$val = (integer) $val;
}
} elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
$excelConstant = trim(strtoupper($val));
// echo 'Element '.$excelConstant.' is an Excel Constant<br />';
$val = self::$excelConstants[$excelConstant];
} elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) {
// echo 'Element '.$localeConstant.' is an Excel Constant<br />';
$val = self::$excelConstants[$localeConstant];
}
$details = ['type' => 'Value', 'value' => $val, 'reference' => null];
@ -3394,10 +3355,8 @@ class Calculation
}
// If we're expecting an operator, but only have a space between the previous and next operands (and both are
// Cell References) then we have an INTERSECTION operator
// echo 'Possible Intersect Operator<br />';
if (($expectingOperator) && (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) &&
($output[count($output) - 1]['type'] == 'Cell Reference')) {
// echo 'Element is an Intersect Operator<br />';
while ($stack->count() > 0 &&
($o2 = $stack->last()) &&
isset(self::$operators[$o2['value']]) &&
@ -3455,13 +3414,9 @@ class Calculation
// Loop through each token in turn
foreach ($tokens as $tokenData) {
// print_r($tokenData);
// echo '<br />';
$token = $tokenData['value'];
// echo '<b>Token is '.$token.'</b><br />';
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$binaryOperators[$token])) {
// echo 'Token is a binary operator<br />';
// We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === null) {
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
@ -3604,17 +3559,14 @@ class Calculation
// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
} elseif (($token === '~') || ($token === '%')) {
// echo 'Token is a unary operator<br />';
if (($arg = $stack->pop()) === null) {
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
}
$arg = $arg['value'];
if ($token === '~') {
// echo 'Token is a negation operator<br />';
$this->_debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg));
$multiplier = -1;
} else {
// echo 'Token is a percentile operator<br />';
$this->_debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg));
$multiplier = 0.01;
}
@ -3635,9 +3587,7 @@ class Calculation
}
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) {
$cellRef = null;
// echo 'Element '.$token.' is a Cell reference<br />';
if (isset($matches[8])) {
// echo 'Reference is a Range of cells<br />';
if ($pCell === null) {
// We can't access the range, so return a REF error
$cellValue = Calculation\Functions::REF();
@ -3650,7 +3600,6 @@ class Calculation
return $this->raiseFormulaError('Unable to access External Workbook');
}
$matches[2] = trim($matches[2], "\"'");
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false);
@ -3658,9 +3607,7 @@ class Calculation
return $this->raiseFormulaError('Unable to access Cell Reference');
}
$this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
// $cellRef = $matches[2].'!'.$cellRef;
} else {
// echo '$cellRef='.$cellRef.' in current worksheet<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet');
if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
@ -3671,7 +3618,6 @@ class Calculation
}
}
} else {
// echo 'Reference is a single Cell<br />';
if ($pCell === null) {
// We can't access the cell, so return a REF error
$cellValue = Calculation\Functions::REF();
@ -3683,7 +3629,6 @@ class Calculation
// It's a Reference to an external spreadsheet (not currently supported)
return $this->raiseFormulaError('Unable to access External Workbook');
}
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) {
$cellSheet = $this->spreadsheet->getSheetByName($matches[2]);
@ -3697,9 +3642,7 @@ class Calculation
return $this->raiseFormulaError('Unable to access Cell Reference');
}
$this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
// $cellRef = $matches[2].'!'.$cellRef;
} else {
// echo '$cellRef='.$cellRef.' in current worksheet<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet');
if ($pCellParent->isDataSet($cellRef)) {
$cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
@ -3715,7 +3658,6 @@ class Calculation
// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) {
// echo 'Token is a function<br />';
$functionName = $matches[1];
$argCount = $stack->pop();
$argCount = $argCount['value'];
@ -3733,7 +3675,6 @@ class Calculation
$passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']);
}
// get the arguments for this function
// echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />';
$args = $argArrayVals = [];
for ($i = 0; $i < $argCount; ++$i) {
$arg = $stack->pop();
@ -3765,38 +3706,14 @@ class Calculation
$args[] = $cellID;
$argArrayVals[] = $this->showValue($cellID);
}
// echo 'Arguments are: ';
// print_r($args);
// echo '<br />';
if ($functionName != 'MKMATRIX') {
if ($this->_debugLog->getWriteDebugLog()) {
krsort($argArrayVals);
$this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )');
}
}
// Process each argument in turn, building the return value as an array
// if (($argCount == 1) && (is_array($args[1])) && ($functionName != 'MKMATRIX')) {
// $operand1 = $args[1];
// $this->_debugLog->writeDebugLog('Argument is a matrix: ', $this->showValue($operand1));
// $result = array();
// $row = 0;
// foreach($operand1 as $args) {
// if (is_array($args)) {
// foreach($args as $arg) {
// $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->showValue($arg), ' )');
// $r = call_user_func_array($functionCall, $arg);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($r));
// $result[$row][] = $r;
// }
// ++$row;
// } else {
// $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->showValue($args), ' )');
// $r = call_user_func_array($functionCall, $args);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($r));
// $result[] = $r;
// }
// }
// } else {
// Process the argument with the appropriate function call
if ($passCellReference) {
$args[] = $pCell;
@ -3819,17 +3736,13 @@ class Calculation
// if the token is a number, boolean, string or an Excel error, push it onto the stack
if (isset(self::$excelConstants[strtoupper($token)])) {
$excelConstant = strtoupper($token);
// echo 'Token is a PhpSpreadsheet constant: '.$excelConstant.'<br />';
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
// echo 'Token is a number, boolean, string, null or an Excel error<br />';
$stack->push('Value', $token);
// if the token is a named range, push the named range name onto the stack
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) {
// echo 'Token is a named range<br />';
$namedRange = $matches[6];
// echo 'Named Range is '.$namedRange.'<br />';
$this->_debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
$cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
$pCell->attach($pCellParent);
@ -4130,16 +4043,10 @@ class Calculation
// Return value
$returnValue = [];
// 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) = Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
$pSheet = $this->spreadsheet->getSheetByName($pSheetName);
}
@ -4187,16 +4094,10 @@ class Calculation
// Return value
$returnValue = [];
// 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) = Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
$pSheet = $this->spreadsheet->getSheetByName($pSheetName);
}
@ -4204,7 +4105,6 @@ class Calculation
$namedRange = NamedRange::resolveRange($pRange, $pSheet);
if ($namedRange !== null) {
$pSheet = $namedRange->getWorksheet();
// echo 'Named Range '.$pRange.' (';
$pRange = $namedRange->getRange();
$splitRange = Cell::splitRange($pRange);
// Convert row and column references
@ -4213,22 +4113,12 @@ class Calculation
} 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 Calculation\Functions::REF();
}
// Extract range
$aReferences = Cell::extractAllCellReferencesInRange($pRange);
// var_dump($aReferences);
if (!isset($aReferences[1])) {
// Single cell (or single column or row) in range
list($currentCol, $currentRow) = Cell::coordinateFromString($aReferences[0]);
@ -4243,7 +4133,6 @@ class Calculation
foreach ($aReferences as $reference) {
// Extract range
list($currentCol, $currentRow) = 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);
@ -4252,8 +4141,6 @@ class Calculation
}
}
}
// print_r($returnValue);
// echo '<br />';
}
return $returnValue;

View File

@ -661,8 +661,6 @@ class MathTrig
return $matrixA->times($matrixB)->getArray();
} catch (\PhpSpreadsheet\Exception $ex) {
var_dump($ex->getMessage());
return Functions::VALUE();
}
}

View File

@ -1409,7 +1409,6 @@ class Statistical
$PGuess = $UnscaledPGuess / $TotalUnscaledProbability;
$CumPGuess = $UnscaledCumPGuess / $TotalUnscaledProbability;
// $CumPGuessMinus1 = $CumPGuess - $PGuess;
$CumPGuessMinus1 = $CumPGuess - 1;
while (true) {

View File

@ -262,14 +262,11 @@ class Cell
*/
public function getCalculatedValue($resetLog = true)
{
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->dataType.' with a value of '.$this->getValue().PHP_EOL;
if ($this->dataType == Cell\DataType::TYPE_FORMULA) {
try {
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
$result = Calculation::getInstance(
$this->getWorksheet()->getParent()
)->calculateCellValue($this, $resetLog);
//echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL;
// We don't yet handle array returns
if (is_array($result)) {
while (is_array($result)) {
@ -278,10 +275,8 @@ class Cell
}
} catch (Exception $ex) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->calculatedValue; // Fallback for calculations referencing external files.
}
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
$result = '#N/A';
throw new Calculation\Exception(
$this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage()
@ -289,16 +284,14 @@ class Cell
}
if ($result === '#Not Yet Implemented') {
//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->calculatedValue; // Fallback if calculation engine does not support the formula.
}
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
return $result;
} elseif ($this->value instanceof RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->value.'<br />';
return $this->value->getPlainText();
}
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->value.'<br />';
return $this->value;
}

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Chart;
/**
* \PhpSpreadsheet\Chart\DataSeriesValues
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Chart;
/**
* \PhpSpreadsheet\Chart\Layout
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Chart;
/**
* \PhpSpreadsheet\Chart\Legend
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -96,7 +96,6 @@ class Excel2003XML extends BaseReader implements IReader
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
$this->charSet = strtoupper($matches[1]);
}
// echo 'Character Set is ', $this->charSet,'<br />';
return $valid;
}
@ -404,15 +403,12 @@ class Excel2003XML extends BaseReader implements IReader
foreach ($xml->Styles[0] as $style) {
$style_ss = $style->attributes($namespaces['ss']);
$styleID = (string) $style_ss['ID'];
// echo 'Style ID = '.$styleID.'<br />';
$this->styles[$styleID] = (isset($this->styles['Default'])) ? $this->styles['Default'] : [];
foreach ($style as $styleType => $styleData) {
$styleAttributes = $styleData->attributes($namespaces['ss']);
// echo $styleType.'<br />';
switch ($styleType) {
case 'Alignment':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) {
case 'Vertical':
@ -436,14 +432,11 @@ class Excel2003XML extends BaseReader implements IReader
$borderAttributes = $borderStyle->attributes($namespaces['ss']);
$thisBorder = [];
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
switch ($borderStyleKey) {
case 'LineStyle':
$thisBorder['style'] = \PhpSpreadsheet\Style\Border::BORDER_MEDIUM;
// $thisBorder['style'] = $borderStyleValue;
break;
case 'Weight':
// $thisBorder['style'] = $borderStyleValue;
break;
case 'Position':
$borderPosition = strtolower($borderStyleValue);
@ -463,7 +456,6 @@ class Excel2003XML extends BaseReader implements IReader
break;
case 'Font':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) {
case 'FontName':
@ -491,7 +483,6 @@ class Excel2003XML extends BaseReader implements IReader
break;
case 'Interior':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
switch ($styleAttributeKey) {
case 'Color':
$this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
@ -501,7 +492,6 @@ class Excel2003XML extends BaseReader implements IReader
break;
case 'NumberFormat':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
switch ($styleAttributeValue) {
case 'Short Date':
@ -515,15 +505,11 @@ class Excel2003XML extends BaseReader implements IReader
break;
case 'Protection':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
}
break;
}
}
// print_r($this->styles[$styleID]);
// echo '<hr />';
}
// echo '<hr />';
$worksheetID = 0;
$xml_ss = $xml->children($namespaces['ss']);
@ -536,8 +522,6 @@ class Excel2003XML extends BaseReader implements IReader
continue;
}
// echo '<h3>Worksheet: ', $worksheet_ss['Name'],'<h3>';
//
// Create new Worksheet
$spreadsheet->createSheet();
$spreadsheet->setActiveSheetIndex($worksheetID);
@ -558,7 +542,6 @@ class Excel2003XML extends BaseReader implements IReader
}
if (isset($columnData_ss['Width'])) {
$columnWidth = $columnData_ss['Width'];
// echo '<b>Setting column width for '.$columnID.' to '.$columnWidth.'</b><br />';
$spreadsheet->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4);
}
++$columnID;
@ -574,7 +557,6 @@ class Excel2003XML extends BaseReader implements IReader
if (isset($row_ss['Index'])) {
$rowID = (integer) $row_ss['Index'];
}
// echo '<b>Row '.$rowID.'</b><br />';
$columnID = 'A';
foreach ($rowData->Cell as $cell) {
@ -611,7 +593,6 @@ class Excel2003XML extends BaseReader implements IReader
// added this as a check for array formulas
if (isset($cell_ss['ArrayRange'])) {
$cellDataCSEFormula = $cell_ss['ArrayRange'];
// echo "found an array formula at ".$columnID.$rowID."<br />";
}
$hasCalculatedValue = true;
}
@ -657,12 +638,10 @@ class Excel2003XML extends BaseReader implements IReader
}
if ($hasCalculatedValue) {
// echo 'FORMULA<br />';
$type = \PhpSpreadsheet\Cell\DataType::TYPE_FORMULA;
$columnNumber = \PhpSpreadsheet\Cell::columnIndexFromString($columnID);
if (substr($cellDataFormula, 0, 3) == 'of:') {
$cellDataFormula = substr($cellDataFormula, 3);
// echo 'Before: ', $cellDataFormula,'<br />';
$temp = explode('"', $cellDataFormula);
$key = false;
foreach ($temp as &$value) {
@ -673,7 +652,6 @@ class Excel2003XML extends BaseReader implements IReader
}
} else {
// Convert R1C1 style references to A1 style references (but only when not quoted)
// echo 'Before: ', $cellDataFormula,'<br />';
$temp = explode('"', $cellDataFormula);
$key = false;
foreach ($temp as &$value) {
@ -714,42 +692,29 @@ class Excel2003XML extends BaseReader implements IReader
unset($value);
// Then rebuild the formula string
$cellDataFormula = implode('"', $temp);
// echo 'After: ', $cellDataFormula,'<br />';
}
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
//
$spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type);
if ($hasCalculatedValue) {
// echo 'Formula result is '.$cellValue.'<br />';
$spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setCalculatedValue($cellValue);
}
$cellIsSet = $rowHasData = true;
}
if (isset($cell->Comment)) {
// echo '<b>comment found</b><br />';
$commentAttributes = $cell->Comment->attributes($namespaces['ss']);
$author = 'unknown';
if (isset($commentAttributes->Author)) {
$author = (string) $commentAttributes->Author;
// echo 'Author: ', $author,'<br />';
}
$node = $cell->Comment->Data->asXML();
// $annotation = str_replace('html:','',substr($node,49,-10));
// echo $annotation,'<br />';
$annotation = strip_tags($node);
// echo 'Annotation: ', $annotation,'<br />';
$spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation));
}
if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
$style = (string) $cell_ss['StyleID'];
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) {
// echo 'Cell '.$columnID.$rowID.'<br />';
// print_r($this->styles[$style]);
// echo '<br />';
if (!$spreadsheet->getActiveSheet()->cellExists($columnID . $rowID)) {
$spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValue(null);
}
@ -769,7 +734,6 @@ class Excel2003XML extends BaseReader implements IReader
}
if (isset($row_ss['Height'])) {
$rowHeight = $row_ss['Height'];
// echo '<b>Setting row height to '.$rowHeight.'</b><br />';
$spreadsheet->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);
}
}

View File

@ -259,7 +259,6 @@ class Excel2007 extends BaseReader implements IReader
private static function castToBoolean($c)
{
// echo 'Initial Cast to Boolean', PHP_EOL;
$value = isset($c->v) ? (string) $c->v : null;
if ($value == '0') {
return false;
@ -274,44 +273,27 @@ class Excel2007 extends BaseReader implements IReader
private static function castToError($c)
{
// echo 'Initial Cast to Error', PHP_EOL;
return isset($c->v) ? (string) $c->v : null;
}
private static function castToString($c)
{
// echo 'Initial Cast to String, PHP_EOL;
return isset($c->v) ? (string) $c->v : null;
}
private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
{
// echo 'Formula', PHP_EOL;
// echo '$c->f is ', $c->f, PHP_EOL;
$cellDataType = 'f';
$value = "={$c->f}";
$calculatedValue = self::$castBaseType($c);
// Shared formula?
if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') {
// echo 'SHARED FORMULA', PHP_EOL;
$instance = (string) $c->f['si'];
// echo 'Instance ID = ', $instance, PHP_EOL;
//
// echo 'Shared Formula Array:', PHP_EOL;
// print_r($sharedFormulas);
if (!isset($sharedFormulas[(string) $c->f['si']])) {
// echo 'SETTING NEW SHARED FORMULA', PHP_EOL;
// echo 'Master is ', $r, PHP_EOL;
// echo 'Formula is ', $value, PHP_EOL;
$sharedFormulas[$instance] = ['master' => $r, 'formula' => $value];
// echo 'New Shared Formula Array:', PHP_EOL;
// print_r($sharedFormulas);
} else {
// echo 'GETTING SHARED FORMULA', PHP_EOL;
// echo 'Master is ', $sharedFormulas[$instance]['master'], PHP_EOL;
// echo 'Formula is ', $sharedFormulas[$instance]['formula'], PHP_EOL;
$master = \PhpSpreadsheet\Cell::coordinateFromString($sharedFormulas[$instance]['master']);
$current = \PhpSpreadsheet\Cell::coordinateFromString($r);
@ -320,7 +302,6 @@ class Excel2007 extends BaseReader implements IReader
$difference[1] = $current[1] - $master[1];
$value = $this->referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
// echo 'Adjusted Formula is ', $value, PHP_EOL;
}
}
}
@ -828,11 +809,7 @@ class Excel2007 extends BaseReader implements IReader
if ($col['style'] && !$this->readDataOnly) {
$docSheet->getColumnDimension(\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setXfIndex(intval($col['style']));
}
if (self::boolean($col['bestFit'])) {
//$docSheet->getColumnDimension(\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setAutoSize(true);
}
if (self::boolean($col['hidden'])) {
// echo \PhpSpreadsheet\Cell::stringFromColumnIndex($i), ': HIDDEN COLUMN',PHP_EOL;
$docSheet->getColumnDimension(\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setVisible(false);
}
if (self::boolean($col['collapsed'])) {
@ -898,15 +875,9 @@ class Excel2007 extends BaseReader implements IReader
}
}
// echo 'Reading cell ', $coordinates[0], $coordinates[1], PHP_EOL;
// print_r($c);
// echo PHP_EOL;
// echo 'Cell Data Type is ', $cellDataType, ': ';
//
// Read cell!
switch ($cellDataType) {
case 's':
// echo 'String', PHP_EOL;
if ((string) $c->v != '') {
$value = $sharedStrings[intval($c->v)];
@ -918,7 +889,6 @@ class Excel2007 extends BaseReader implements IReader
}
break;
case 'b':
// echo 'Boolean', PHP_EOL;
if (!isset($c->f)) {
$value = self::castToBoolean($c);
} else {
@ -929,11 +899,9 @@ class Excel2007 extends BaseReader implements IReader
$att = $c->f;
$docSheet->getCell($r)->setFormulaAttributes($att);
}
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
}
break;
case 'inlineStr':
// echo 'Inline String', PHP_EOL;
if (isset($c->f)) {
$this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError');
} else {
@ -941,29 +909,22 @@ class Excel2007 extends BaseReader implements IReader
}
break;
case 'e':
// echo 'Error', PHP_EOL;
if (!isset($c->f)) {
$value = self::castToError($c);
} else {
// Formula
$this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError');
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
}
break;
default:
// echo 'Default', PHP_EOL;
if (!isset($c->f)) {
// echo 'Not a Formula', PHP_EOL;
$value = self::castToString($c);
} else {
// echo 'Treat as Formula', PHP_EOL;
// Formula
$this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToString');
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
}
break;
}
// echo 'Value is ', $value, PHP_EOL;
// Check for numeric values
if (is_numeric($value) && $cellDataType != 's') {
@ -1870,15 +1831,10 @@ class Excel2007 extends BaseReader implements IReader
);
$objChart = \PhpSpreadsheet\Reader\Excel2007\Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
// echo 'Chart ', $chartEntryRef, '<br />';
// var_dump($charts[$chartEntryRef]);
//
if (isset($charts[$chartEntryRef])) {
$chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id'];
// echo 'Position Ref ', $chartPositionRef, '<br />';
if (isset($chartDetails[$chartPositionRef])) {
// var_dump($chartDetails[$chartPositionRef]);
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
$objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']);
@ -1925,14 +1881,7 @@ class Excel2007 extends BaseReader implements IReader
*/
private static function readStyle($docStyle, \PhpSpreadsheet\Style $style)
{
// format code
// if (isset($style->numFmt)) {
// if (isset($style->numFmt['formatCode'])) {
// $docStyle->getNumberFormat()->setFormatCode((string) $style->numFmt['formatCode']);
// } else {
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
// }
// }
// font
if (isset($style->font)) {

View File

@ -240,7 +240,6 @@ class Chart
}
$layout = [];
foreach ($details as $detailKey => $detail) {
// echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
$layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
}

View File

@ -991,10 +991,6 @@ class Excel5 extends BaseReader implements IReader
// treat OBJ records
foreach ($this->objs as $n => $obj) {
// echo '<hr /><b>Object</b> reference is ', $n,'<br />';
// var_dump($obj);
// echo '<br />';
// the first shape container never has a corresponding OBJ record, hence $n + 1
if (isset($allSpContainers[$n + 1]) && is_object($allSpContainers[$n + 1])) {
$spContainer = $allSpContainers[$n + 1];
@ -1023,8 +1019,6 @@ class Excel5 extends BaseReader implements IReader
switch ($obj['otObjType']) {
case 0x19:
// Note
// echo 'Cell Annotation Object<br />';
// echo 'Object ID is ', $obj['idObjID'],'<br />';
if (isset($this->cellNotes[$obj['idObjID']])) {
$cellNote = $this->cellNotes[$obj['idObjID']];
@ -1035,7 +1029,6 @@ class Excel5 extends BaseReader implements IReader
}
break;
case 0x08:
// echo 'Picture Object<br />';
// picture
// get index to BSE entry (1-based)
$BSEindex = $spContainer->getOPT(0x0104);
@ -1099,9 +1092,6 @@ class Excel5 extends BaseReader implements IReader
$noteDetails['objTextData']['text'] = '';
}
}
// echo '<b>Cell annotation ', $note,'</b><br />';
// var_dump($noteDetails);
// echo '<br />';
$cellAddress = str_replace('$', '', $noteDetails['cellRef']);
$this->phpSheet->getComment($cellAddress)->setAuthor($noteDetails['author'])->setText($this->parseRichText($noteDetails['objTextData']['text']));
}
@ -1275,8 +1265,6 @@ class Excel5 extends BaseReader implements IReader
$this->summaryInformation = $ole->getStream($ole->summaryInformation);
// Get additional document summary information data
$this->documentSummaryInformation = $ole->getStream($ole->documentSummaryInformation);
// Get user-defined property data
// $this->userDefinedProperties = $ole->getUserDefinedProperties();
}
/**
@ -1429,21 +1417,17 @@ class Excel5 extends BaseReader implements IReader
// offset: 8; size: 16
// offset: 24; size: 4; section count
$secCount = self::getInt4d($this->documentSummaryInformation, 24);
// echo '$secCount = ', $secCount,'<br />';
// offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
// offset: 44; size: 4; first section offset
$secOffset = self::getInt4d($this->documentSummaryInformation, 44);
// echo '$secOffset = ', $secOffset,'<br />';
// section header
// offset: $secOffset; size: 4; section length
$secLength = self::getInt4d($this->documentSummaryInformation, $secOffset);
// echo '$secLength = ', $secLength,'<br />';
// offset: $secOffset+4; size: 4; property count
$countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset + 4);
// echo '$countProperties = ', $countProperties,'<br />';
// initialize code page (used to resolve string values)
$codePage = 'CP1252';
@ -1451,17 +1435,14 @@ class Excel5 extends BaseReader implements IReader
// offset: ($secOffset+8); size: var
// loop through property decarations and properties
for ($i = 0; $i < $countProperties; ++$i) {
// echo 'Property ', $i,'<br />';
// offset: ($secOffset+8) + (8 * $i); size: 4; property ID
$id = self::getInt4d($this->documentSummaryInformation, ($secOffset + 8) + (8 * $i));
// echo 'ID is ', $id,'<br />';
// Use value of property id as appropriate
// offset: 60 + 8 * $i; size: 4; offset from beginning of section (48)
$offset = self::getInt4d($this->documentSummaryInformation, ($secOffset + 12) + (8 * $i));
$type = self::getInt4d($this->documentSummaryInformation, $secOffset + $offset);
// echo 'Type is ', $type,', ';
// initialize property value
$value = null;
@ -1555,7 +1536,6 @@ class Excel5 extends BaseReader implements IReader
private function readDefault()
{
$length = self::getInt2d($this->data, $this->pos + 2);
// $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
// move stream pointer to next record
$this->pos += 4 + $length;
@ -1567,7 +1547,6 @@ class Excel5 extends BaseReader implements IReader
*/
private function readNote()
{
// echo '<b>Read Cell Annotation</b><br />';
$length = self::getInt2d($this->data, $this->pos + 2);
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
@ -1583,10 +1562,6 @@ class Excel5 extends BaseReader implements IReader
$noteObjID = self::getInt2d($recordData, 6);
$noteAuthor = self::readUnicodeStringLong(substr($recordData, 8));
$noteAuthor = $noteAuthor['value'];
// echo 'Note Address=', $cellAddress,'<br />';
// echo 'Note Object ID=', $noteObjID,'<br />';
// echo 'Note Author=', $noteAuthor,'<hr />';
//
$this->cellNotes[$noteObjID] = [
'cellRef' => $cellAddress,
'objectID' => $noteObjID,
@ -1602,13 +1577,10 @@ class Excel5 extends BaseReader implements IReader
$extension = true;
$cellAddress = array_pop(array_keys($this->phpSheet->getComments()));
}
// echo 'Note Address=', $cellAddress,'<br />';
$cellAddress = str_replace('$', '', $cellAddress);
$noteLength = self::getInt2d($recordData, 4);
$noteText = trim(substr($recordData, 6));
// echo 'Note Length=', $noteLength,'<br />';
// echo 'Note Text=', $noteText,'<br />';
if ($extension) {
// Concatenate this extension with the currently set comment for the cell
@ -1656,10 +1628,6 @@ class Excel5 extends BaseReader implements IReader
'alignment' => $grbitOpts,
'rotation' => $rot,
];
// echo '<b>_readTextObject()</b><br />';
// var_dump($this->textObjects[$this->textObjRef]);
// echo '<br />';
}
/**
@ -4192,10 +4160,6 @@ class Excel5 extends BaseReader implements IReader
'grbitOpts' => $grbitOpts,
];
$this->textObjRef = $idObjID;
// echo '<b>_readObj()</b><br />';
// var_dump(end($this->objs));
// echo '<br />';
}
/**
@ -4280,8 +4244,6 @@ class Excel5 extends BaseReader implements IReader
// move stream pointer to next record
$this->pos += 4 + $length;
//var_dump(unpack("vrt/vgrbitFrt/V2reserved/vwScalePLV/vgrbit", $recordData));
// offset: 0; size: 2; rt
//->ignore
$rt = self::getInt2d($recordData, 0);
@ -5057,22 +5019,18 @@ class Excel5 extends BaseReader implements IReader
// 1. BITMAPCOREHEADER
// offset: 0; size: 4; bcSize, Specifies the number of bytes required by the structure
$bcSize = self::getInt4d($iData, 0);
// var_dump($bcSize);
// offset: 4; size: 2; bcWidth, specifies the width of the bitmap, in pixels
$bcWidth = self::getInt2d($iData, 4);
// var_dump($bcWidth);
// offset: 6; size: 2; bcHeight, specifies the height of the bitmap, in pixels.
$bcHeight = self::getInt2d($iData, 6);
// var_dump($bcHeight);
$ih = imagecreatetruecolor($bcWidth, $bcHeight);
// offset: 8; size: 2; bcPlanes, specifies the number of planes for the target device. This value must be 1
// offset: 10; size: 2; bcBitCount specifies the number of bits-per-pixel. This value must be 1, 4, 8, or 24
$bcBitCount = self::getInt2d($iData, 10);
// var_dump($bcBitCount);
$rgbString = substr($iData, 12);
$rgbTriples = [];
@ -5205,21 +5163,9 @@ class Excel5 extends BaseReader implements IReader
// offset: 2; size: sz
$formulaData = substr($formulaStructure, 2, $sz);
// for debug: dump the formula data
//echo '<xmp>';
//echo 'size: ' . $sz . "\n";
//echo 'the entire formula data: ';
//Debug::dump($formulaData);
//echo "\n----\n";
// offset: 2 + sz; size: variable (optional)
if (strlen($formulaStructure) > 2 + $sz) {
$additionalData = substr($formulaStructure, 2 + $sz);
// for debug: dump the additional data
//echo 'the entire additional data: ';
//Debug::dump($additionalData);
//echo "\n----\n";
} else {
$additionalData = '';
}
@ -5243,9 +5189,6 @@ class Excel5 extends BaseReader implements IReader
while (strlen($formulaData) > 0 and $token = $this->getNextToken($formulaData, $baseCell)) {
$tokens[] = $token;
$formulaData = substr($formulaData, $token['size']);
// for debug: dump the token
//var_dump($token);
}
$formulaString = $this->createFormulaFromTokens($tokens, $additionalData);
@ -5408,10 +5351,6 @@ class Excel5 extends BaseReader implements IReader
}
$formulaString = $formulaStrings[0];
// for debug: dump the human readable formula
//echo '----' . "\n";
//echo 'Formula: ' . $formulaString;
return $formulaString;
}

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Reader;
/**
* \PhpSpreadsheet\Reader\Exception
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -218,15 +218,9 @@ class Gnumeric extends BaseReader implements IReader
$gFileData = $this->gzfileGetContents($pFilename);
// echo '<pre>';
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
// echo '</pre><hr />';
//
$xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', \PhpSpreadsheet\Settings::getLibXmlLoaderOptions());
$namespacesMeta = $xml->getNamespaces(true);
// var_dump($namespacesMeta);
//
$gnmXML = $xml->children($namespacesMeta['gnm']);
$docProps = $spreadsheet->getProperties();
@ -335,7 +329,6 @@ class Gnumeric extends BaseReader implements IReader
$worksheetID = 0;
foreach ($gnmXML->Sheets->Sheet as $sheet) {
$worksheetName = (string) $sheet->Name;
// echo '<b>Worksheet: ', $worksheetName,'</b><br />';
if ((isset($this->loadSheetsOnly)) && (!in_array($worksheetName, $this->loadSheetsOnly))) {
continue;
}
@ -407,9 +400,6 @@ class Gnumeric extends BaseReader implements IReader
$ValueType = $cellAttributes->ValueType;
$ExprID = (string) $cellAttributes->ExprID;
// echo 'Cell ', $column, $row,'<br />';
// echo 'Type is ', $ValueType,'<br />';
// echo 'Value is ', $cell,'<br />';
$type = \PhpSpreadsheet\Cell\DataType::TYPE_FORMULA;
if ($ExprID > '') {
if (((string) $cell) > '') {
@ -418,7 +408,6 @@ class Gnumeric extends BaseReader implements IReader
'row' => $cellAttributes->Row,
'formula' => (string) $cell,
];
// echo 'NEW EXPRESSION ', $ExprID,'<br />';
} else {
$expression = $this->expressions[$ExprID];
@ -429,8 +418,6 @@ class Gnumeric extends BaseReader implements IReader
$cellAttributes->Row - $expression['row'],
$worksheetName
);
// echo 'SHARED EXPRESSION ', $ExprID,'<br />';
// echo 'New Value is ', $cell,'<br />';
}
$type = \PhpSpreadsheet\Cell\DataType::TYPE_FORMULA;
} else {
@ -470,8 +457,6 @@ class Gnumeric extends BaseReader implements IReader
}
}
}
// echo '$maxCol=', $maxCol,'; $maxRow=', $maxRow,'<br />';
//
foreach ($sheet->Styles->StyleRegion as $styleRegion) {
$styleAttributes = $styleRegion->attributes();
if (($styleAttributes['startRow'] <= $maxRow) &&
@ -484,11 +469,8 @@ class Gnumeric extends BaseReader implements IReader
$endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
$endRow += 1;
$cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow;
// echo $cellRange,'<br />';
$styleAttributes = $styleRegion->Style->attributes();
// var_dump($styleAttributes);
// echo '<br />';
// We still set the number format mask for date/time values, even if readDataOnly is true
if ((!$this->readDataOnly) ||
@ -611,8 +593,6 @@ class Gnumeric extends BaseReader implements IReader
}
$fontAttributes = $styleRegion->Style->Font->attributes();
// var_dump($fontAttributes);
// echo '<br />';
$styleArray['font']['name'] = (string) $styleRegion->Style->Font;
$styleArray['font']['size'] = intval($fontAttributes['Unit']);
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
@ -673,8 +653,6 @@ class Gnumeric extends BaseReader implements IReader
$hyperlink = $styleRegion->Style->HyperLink->attributes();
}
}
// var_dump($styleArray);
// echo '<br />';
$spreadsheet->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray);
}
}

View File

@ -208,7 +208,6 @@ class HTML extends BaseReader implements IReader
// Simple String content
if (trim($cellContent) > '') {
// Only actually write it if there's content in the string
// echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
// Write to worksheet to be done here...
// ... we return the cell so we can mess about with styles more easily
$sheet->setCellValue($column . $row, $cellContent, true);
@ -242,11 +241,8 @@ class HTML extends BaseReader implements IReader
// TODO
}
} elseif ($child instanceof DOMElement) {
// echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
$attributeArray = [];
foreach ($child->attributes as $attribute) {
// echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
$attributeArray[$attribute->name] = $attribute->value;
}
@ -274,7 +270,6 @@ class HTML extends BaseReader implements IReader
case 'em':
case 'strong':
case 'b':
// echo 'STYLING, SPAN OR DIV<br />';
if ($cellContent > '') {
$cellContent .= ' ';
}
@ -282,7 +277,6 @@ class HTML extends BaseReader implements IReader
if ($cellContent > '') {
$cellContent .= ' ';
}
// echo 'END OF STYLING, SPAN OR DIV<br />';
break;
case 'hr':
$this->flushCell($sheet, $column, $row, $cellContent);
@ -304,14 +298,11 @@ class HTML extends BaseReader implements IReader
$this->flushCell($sheet, $column, $row, $cellContent);
++$row;
}
// echo 'HARD LINE BREAK: ' , '<br />';
break;
case 'a':
// echo 'START OF HYPERLINK: ' , '<br />';
foreach ($attributeArray as $attributeName => $attributeValue) {
switch ($attributeName) {
case 'href':
// echo 'Link to ' , $attributeValue , '<br />';
$sheet->getCell($column . $row)->getHyperlink()->setUrl($attributeValue);
if (isset($this->formats[$child->nodeName])) {
$sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
@ -321,7 +312,6 @@ class HTML extends BaseReader implements IReader
}
$cellContent .= ' ';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF HYPERLINK:' , '<br />';
break;
case 'h1':
case 'h2':
@ -335,17 +325,13 @@ class HTML extends BaseReader implements IReader
if ($this->tableLevel > 0) {
// If we're inside a table, replace with a \n
$cellContent .= "\n";
// echo 'LIST ENTRY: ' , '<br />';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF LIST ENTRY:' , '<br />';
} else {
if ($cellContent > '') {
$this->flushCell($sheet, $column, $row, $cellContent);
++$row;
}
// echo 'START OF PARAGRAPH: ' , '<br />';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF PARAGRAPH:' , '<br />';
$this->flushCell($sheet, $column, $row, $cellContent);
if (isset($this->formats[$child->nodeName])) {
@ -360,17 +346,13 @@ class HTML extends BaseReader implements IReader
if ($this->tableLevel > 0) {
// If we're inside a table, replace with a \n
$cellContent .= "\n";
// echo 'LIST ENTRY: ' , '<br />';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF LIST ENTRY:' , '<br />';
} else {
if ($cellContent > '') {
$this->flushCell($sheet, $column, $row, $cellContent);
}
++$row;
// echo 'LIST ENTRY: ' , '<br />';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF LIST ENTRY:' , '<br />';
$this->flushCell($sheet, $column, $row, $cellContent);
$column = 'A';
}
@ -378,12 +360,10 @@ class HTML extends BaseReader implements IReader
case 'table':
$this->flushCell($sheet, $column, $row, $cellContent);
$column = $this->setTableStartColumn($column);
// echo 'START OF TABLE LEVEL ' , $this->tableLevel , '<br />';
if ($this->tableLevel > 1) {
--$row;
}
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF TABLE LEVEL ' , $this->tableLevel , '<br />';
$column = $this->releaseTableStartColumn();
if ($this->tableLevel > 1) {
++$column;
@ -398,16 +378,12 @@ class HTML extends BaseReader implements IReader
case 'tr':
$column = $this->getTableStartColumn();
$cellContent = '';
// echo 'START OF TABLE ' , $this->tableLevel , ' ROW<br />';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
++$row;
// echo 'END OF TABLE ' , $this->tableLevel , ' ROW<br />';
break;
case 'th':
case 'td':
// echo 'START OF TABLE ' , $this->tableLevel , ' CELL<br />';
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF TABLE ' , $this->tableLevel , ' CELL<br />';
while (isset($this->rowspan[$column . $row])) {
++$column;
@ -415,14 +391,6 @@ class HTML extends BaseReader implements IReader
$this->flushCell($sheet, $column, $row, $cellContent);
// if (isset($attributeArray['style']) && !empty($attributeArray['style'])) {
// $styleAry = $this->getPhpSpreadsheetStyleArray($attributeArray['style']);
//
// if (!empty($styleAry)) {
// $sheet->getStyle($column . $row)->applyFromArray($styleAry);
// }
// }
if (isset($attributeArray['rowspan']) && isset($attributeArray['colspan'])) {
//create merging rowspan and colspan
$columnTo = $column;

View File

@ -242,41 +242,6 @@ class OOCalc extends BaseReader implements IReader
$worksheetInfo[] = $tmpInfo;
}
}
// foreach ($workbookData->table as $worksheetDataSet) {
// $worksheetData = $worksheetDataSet->children($namespacesContent['table']);
// $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
//
// $rowIndex = 0;
// foreach ($worksheetData as $key => $rowData) {
// switch ($key) {
// case 'table-row' :
// $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
// $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ?
// $rowDataTableAttributes['number-rows-repeated'] : 1;
// $columnIndex = 0;
//
// foreach ($rowData as $key => $cellData) {
// $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
// $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ?
// $cellDataTableAttributes['number-columns-repeated'] : 1;
// $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
// if (isset($cellDataOfficeAttributes['value-type'])) {
// $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex + $colRepeats - 1);
// $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex + $rowRepeats);
// }
// $columnIndex += $colRepeats;
// }
// $rowIndex += $rowRepeats;
// break;
// }
// }
//
// $tmpInfo['lastColumnLetter'] = \PhpSpreadsheet\Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
// $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
//
// }
// }
}
return $worksheetInfo;
@ -337,16 +302,12 @@ class OOCalc extends BaseReader implements IReader
throw new Exception('Could not open ' . $pFilename . ' for reading! Error opening file.');
}
// echo '<h1>Meta Information</h1>';
$xml = simplexml_load_string(
$this->securityScan($zip->getFromName('meta.xml')),
'SimpleXMLElement',
\PhpSpreadsheet\Settings::getLibXmlLoaderOptions()
);
$namespacesMeta = $xml->getNamespaces(true);
// echo '<pre>';
// print_r($namespacesMeta);
// echo '</pre><hr />';
$docProps = $spreadsheet->getProperties();
$officeProperty = $xml->children($namespacesMeta['office']);
@ -426,16 +387,12 @@ class OOCalc extends BaseReader implements IReader
}
}
// echo '<h1>Workbook Content</h1>';
$xml = simplexml_load_string(
$this->securityScan($zip->getFromName('content.xml')),
'SimpleXMLElement',
\PhpSpreadsheet\Settings::getLibXmlLoaderOptions()
);
$namespacesContent = $xml->getNamespaces(true);
// echo '<pre>';
// print_r($namespacesContent);
// echo '</pre><hr />';
$workbook = $xml->children($namespacesContent['office']);
foreach ($workbook->body->spreadsheet as $workbookData) {
@ -443,17 +400,12 @@ class OOCalc extends BaseReader implements IReader
$worksheetID = 0;
foreach ($workbookData->table as $worksheetDataSet) {
$worksheetData = $worksheetDataSet->children($namespacesContent['table']);
// print_r($worksheetData);
// echo '<br />';
$worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
// print_r($worksheetDataAttributes);
// echo '<br />';
if ((isset($this->loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) &&
(!in_array($worksheetDataAttributes['name'], $this->loadSheetsOnly))) {
continue;
}
// echo '<h2>Worksheet '.$worksheetDataAttributes['name'].'</h2>';
// Create new Worksheet
$spreadsheet->createSheet();
$spreadsheet->setActiveSheetIndex($worksheetID);
@ -467,7 +419,6 @@ class OOCalc extends BaseReader implements IReader
$rowID = 1;
foreach ($worksheetData as $key => $rowData) {
// echo '<b>'.$key.'</b><br />';
switch ($key) {
case 'table-header-rows':
foreach ($rowData as $keyRowData => $cellData) {
@ -486,20 +437,11 @@ class OOCalc extends BaseReader implements IReader
}
}
// echo '<b>'.$columnID.$rowID.'</b><br />';
$cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
$cellDataOffice = $cellData->children($namespacesContent['office']);
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
// echo 'Office Attributes: ';
// print_r($cellDataOfficeAttributes);
// echo '<br />Table Attributes: ';
// print_r($cellDataTableAttributes);
// echo '<br />Cell Data Text';
// print_r($cellDataText);
// echo '<br />';
//
$type = $formatting = $hyperlink = null;
$hasCalculatedValue = false;
$cellDataFormula = '';
@ -509,7 +451,6 @@ class OOCalc extends BaseReader implements IReader
}
if (isset($cellDataOffice->annotation)) {
// echo 'Cell has comment<br />';
$annotationText = $cellDataOffice->annotation->children($namespacesContent['text']);
$textArray = [];
foreach ($annotationText as $t) {
@ -522,7 +463,6 @@ class OOCalc extends BaseReader implements IReader
}
}
$text = implode("\n", $textArray);
// echo $text, '<br />';
$spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setText($this->parseRichText($text));
// ->setAuthor( $author )
}
@ -548,7 +488,6 @@ class OOCalc extends BaseReader implements IReader
}
$allCellDataText = implode($dataArray, "\n");
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
switch ($cellDataOfficeAttributes['value-type']) {
case 'string':
$type = \PhpSpreadsheet\Cell\DataType::TYPE_STRING;
@ -608,10 +547,6 @@ class OOCalc extends BaseReader implements IReader
$formatting = \PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4;
break;
}
// echo 'Data value is '.$dataValue.'<br />';
// if ($hyperlink !== null) {
// echo 'Hyperlink is '.$hyperlink.'<br />';
// }
} else {
$type = \PhpSpreadsheet\Cell\DataType::TYPE_NULL;
$dataValue = null;
@ -619,7 +554,6 @@ class OOCalc extends BaseReader implements IReader
if ($hasCalculatedValue) {
$type = \PhpSpreadsheet\Cell\DataType::TYPE_FORMULA;
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
$cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=') + 1);
$temp = explode('"', $cellDataFormula);
$tKey = false;
@ -636,7 +570,6 @@ class OOCalc extends BaseReader implements IReader
unset($value);
// Then rebuild the formula string
$cellDataFormula = implode('"', $temp);
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
}
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $cellDataTableAttributes['number-columns-repeated'] : 1;
@ -650,7 +583,6 @@ class OOCalc extends BaseReader implements IReader
$rID = $rowID + $rowAdjust;
$spreadsheet->getActiveSheet()->getCell($columnID . $rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
if ($hasCalculatedValue) {
// echo 'Forumla result is '.$dataValue.'<br />';
$spreadsheet->getActiveSheet()->getCell($columnID . $rID)->setCalculatedValue($dataValue);
}
if ($formatting !== null) {

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\CodePage
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\Date
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\File
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\Font
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -309,13 +307,9 @@ class Font
// Get corners positions
$lowerLeftCornerX = $textBox[0];
// $lowerLeftCornerY = $textBox[1];
$lowerRightCornerX = $textBox[2];
// $lowerRightCornerY = $textBox[3];
$upperRightCornerX = $textBox[4];
// $upperRightCornerY = $textBox[5];
$upperLeftCornerX = $textBox[6];
// $upperLeftCornerY = $textBox[7];
// Consider the rotation when calculating the width
$textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
@ -345,8 +339,6 @@ class Font
break;
case 'Arial':
// value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
// $columnWidth = (int) (7 * String::countCharacters($columnText));
// value 8 was set because of experience in different exports at Arial 10 font.
$columnWidth = (int) (8 * StringHelper::countCharacters($columnText));
$columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size

View File

@ -20,7 +20,6 @@ namespace PhpSpreadsheet\Shared;
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: OLE.php,v 1.13 2007/03/07 14:38:25 schmidt Exp $
/*
* Array for storing OLE instances that are accessed from
@ -156,8 +155,7 @@ class OLE
$pos = $this->_getBlockOffset(self::_readInt4($fh));
}
// Read Big Block Allocation Table according to chain specified by
// $mbatBlocks
// Read Big Block Allocation Table according to chain specified by $mbatBlocks
for ($i = 0; $i < $bbatBlockCount; ++$i) {
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
fseek($fh, $pos);

View File

@ -20,7 +20,6 @@ namespace PhpSpreadsheet\Shared\OLE;
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: PPS.php,v 1.7 2007/02/13 21:00:42 schmidt Exp $
/**
* Class for creating PPS's for OLE containers
@ -151,13 +150,8 @@ class PPS
if (!isset($this->_data)) {
return 0;
}
//if (isset($this->_PPS_FILE)) {
// fseek($this->_PPS_FILE, 0);
// $stats = fstat($this->_PPS_FILE);
// return $stats[7];
//} else {
return strlen($this->_data);
//}
}
/**

View File

@ -20,7 +20,6 @@ namespace PhpSpreadsheet\Shared\OLE\PPS;
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $
/**
* Class for creating File PPS's for OLE containers

View File

@ -20,7 +20,6 @@ namespace PhpSpreadsheet\Shared\OLE\PPS;
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: Root.php,v 1.9 2005/04/23 21:53:49 dufuz Exp $
/**
* Class for creating Root PPS's for OLE containers
@ -260,17 +259,7 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS
if ($raList[$i]->Type != \PhpSpreadsheet\Shared\OLE::OLE_PPS_TYPE_DIR) {
$raList[$i]->Size = $raList[$i]->getDataLen();
if (($raList[$i]->Size >= \PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == \PhpSpreadsheet\Shared\OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
// Write Data
//if (isset($raList[$i]->_PPS_FILE)) {
// $iLen = 0;
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
// while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
// $iLen += strlen($sBuff);
// fwrite($FILE, $sBuff);
// }
//} else {
fwrite($FILE, $raList[$i]->_data);
//}
if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
@ -281,12 +270,6 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS
(floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
}
// Close file for each PPS, and unlink it
//if (isset($raList[$i]->_PPS_FILE)) {
// fclose($raList[$i]->_PPS_FILE);
// $raList[$i]->_PPS_FILE = null;
// unlink($raList[$i]->_tmp_filename);
//}
}
}
}
@ -319,15 +302,8 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS
}
fwrite($FILE, pack('V', -2));
//// Add to Data String(this will be written for RootEntry)
//if ($raList[$i]->_PPS_FILE) {
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
// while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
// $sRes .= $sBuff;
// }
//} else {
// Add to Data String(this will be written for RootEntry)
$sRes .= $raList[$i]->_data;
//}
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
$sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
}

View File

@ -281,13 +281,11 @@ class OLERead
// Summary information
if ($name == chr(5) . 'SummaryInformation') {
// echo 'Summary Information<br />';
$this->summaryInformation = count($this->props) - 1;
}
// Additional Document Summary information
if ($name == chr(5) . 'DocumentSummaryInformation') {
// echo 'Document Summary Information<br />';
$this->documentSummaryInformation = count($this->props) - 1;
}

View File

@ -25,8 +25,6 @@ namespace PhpSpreadsheet\Shared\PCLZip;
// The use of this software is at the risk of the user.
//
// --------------------------------------------------------------------------------
// $Id: PclZip.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
// --------------------------------------------------------------------------------
// ----- Constants
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
@ -688,7 +686,6 @@ class PclZip
// ----- Set default values
$v_options = [];
// $v_path = "./";
$v_path = '';
$v_remove_path = '';
$v_remove_all_path = false;
@ -839,7 +836,6 @@ class PclZip
// ----- Set default values
$v_options = [];
// $v_path = "./";
$v_path = '';
$v_remove_path = '';
$v_remove_all_path = false;
@ -2726,7 +2722,6 @@ class PclZip
while ($v_size != 0) {
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @fread($v_file_compressed, $v_read_size);
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
}
@ -3690,7 +3685,6 @@ class PclZip
while ($v_size != 0) {
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @gzread($v_src_file, $v_read_size);
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($v_dest_file, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
}

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\PasswordHasher
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\StringHelper
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -43,7 +41,7 @@ class StringHelper
/**
* SYLK Characters array
*
* $var array
* @var array
*/
private static $SYLKCharacters = [];

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared;
/**
* \PhpSpreadsheet\Shared\TimeZone
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -398,11 +398,9 @@ class BestFit
}
// calculate slope
// $this->slope = (($this->valueCount * $xy_sum) - ($x_sum * $y_sum)) / (($this->valueCount * $xx_sum) - ($x_sum * $x_sum));
$this->slope = $mBase / $mDivisor;
// calculate intersect
// $this->intersect = ($y_sum - ($this->slope * $x_sum)) / $this->valueCount;
if ($const) {
$this->intersect = $meanY - ($this->slope * $meanX);
} else {

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Shared\Trend;
/**
* \PhpSpreadsheet\Shared\Trend\powerBestFit
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Style;
/**
* \PhpSpreadsheet\Style\NumberFormat
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -688,7 +686,6 @@ class NumberFormat extends Supervisor implements \PhpSpreadsheet\IComparable
}
if (preg_match('/#?.*\?\/\?/', $format, $m)) {
//echo 'Format mask is fractional '.$format.' <br />';
if ($value != (int) $value) {
self::formatAsFraction($value, $format);
}

View File

@ -2647,15 +2647,7 @@ class Worksheet implements IComparable
{
// Flush cache
$this->cellCollection->getCacheData('A1');
// Build a reference table from images
// $imageCoordinates = array();
// $iterator = $this->getDrawingCollection()->getIterator();
// while ($iterator->valid()) {
// $imageCoordinates[$iterator->current()->getCoordinates()] = true;
//
// $iterator->next();
// }
//
// Lookup highest column and highest row if cells are cleaned
$colRow = $this->cellCollection->getHighestRowAndColumn();
$highestRow = $colRow['row'];

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\AutoFilter
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -593,7 +591,6 @@ class AutoFilter
list($rangeStart, $rangeEnd) = \PhpSpreadsheet\Cell::rangeBoundaries($this->range);
// The heading row should always be visible
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
$this->workSheet->getRowDimension($rangeStart[1])->setVisible(true);
$columnFilterTests = [];
@ -774,31 +771,23 @@ class AutoFilter
}
}
// echo 'Column Filter Test CRITERIA',PHP_EOL;
// var_dump($columnFilterTests);
//
// Execute the column tests for each row in the autoFilter range to determine show/hide,
for ($row = $rangeStart[1] + 1; $row <= $rangeEnd[1]; ++$row) {
// echo 'Testing Row = ', $row,PHP_EOL;
$result = true;
foreach ($columnFilterTests as $columnID => $columnFilterTest) {
// echo 'Testing cell ', $columnID.$row,PHP_EOL;
$cellValue = $this->workSheet->getCell($columnID . $row)->getCalculatedValue();
// echo 'Value is ', $cellValue,PHP_EOL;
// Execute the filter test
$result = $result &&
call_user_func_array(
['\\PhpSpreadsheet\\Worksheet\\AutoFilter', $columnFilterTest['method']],
[$cellValue, $columnFilterTest['arguments']]
);
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
// If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
if (!$result) {
break;
}
}
// Set show/hide for the row based on the result of the autoFilter result
// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
$this->workSheet->getRowDimension($row)->setVisible($result);
}

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet\AutoFilter;
/**
* \PhpSpreadsheet\Worksheet\AutoFilter\Column
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet\AutoFilter\Column;
/**
* \PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_BaseDrawing
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_CellIterator
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\Column
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\ColumnCellIterator
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\ColumnDimension
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -6,8 +6,6 @@ use PhpSpreadsheet\Cell;
use PhpSpreadsheet\Exception;
/**
* \PhpSpreadsheet\Worksheet\ColumnIterator
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_Dimension
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_Drawing
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet\Drawing;
/**
* \PhpSpreadsheet\Worksheet_Drawing_Shadow
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_HeaderFooter
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_HeaderFooterDrawing
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_MemoryDrawing
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\PageMargins
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\PageSetup
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_Protection
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\Row
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\RowCellIterator
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\RowDimension
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet\RowIterator
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Worksheet;
/**
* \PhpSpreadsheet\Worksheet_SheetView
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer;
/**
* \PhpSpreadsheet\Writer\BaseWriter
*
* Copyright (c) 2006 - 2016 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -310,10 +310,6 @@ class Chart extends WriterPart
}
// Generate 2 unique numbers to use for axId values
// $id1 = $id2 = rand(10000000,99999999);
// do {
// $id2 = rand(10000000,99999999);
// } while ($id1 == $id2);
$id1 = '75091328';
$id2 = '75089408';
@ -458,7 +454,6 @@ class Chart extends WriterPart
$caption = $caption[0];
}
$objWriter->startElement('a:t');
// $objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(\PhpSpreadsheet\Shared\StringHelper::controlCharacterPHP2OOXML($caption));
$objWriter->endElement();
@ -808,7 +803,6 @@ class Chart extends WriterPart
}
$objWriter->startElement('a:t');
// $objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(\PhpSpreadsheet\Shared\StringHelper::controlCharacterPHP2OOXML($caption));
$objWriter->endElement();

View File

@ -240,9 +240,6 @@ class Comments extends WriterPart
// x:SizeWithCells
$objWriter->writeElement('x:SizeWithCells', '');
// x:Anchor
//$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18');
// x:AutoFill
$objWriter->writeElement('x:AutoFill', 'False');

View File

@ -242,47 +242,6 @@ class Drawing extends WriterPart
$objWriter->endElement();
// // a:solidFill
// $objWriter->startElement('a:solidFill');
// // a:srgbClr
// $objWriter->startElement('a:srgbClr');
// $objWriter->writeAttribute('val', 'FFFFFF');
///* SHADE
// // a:shade
// $objWriter->startElement('a:shade');
// $objWriter->writeAttribute('val', '85000');
// $objWriter->endElement();
//*/
// $objWriter->endElement();
// $objWriter->endElement();
/*
// a:ln
$objWriter->startElement('a:ln');
$objWriter->writeAttribute('w', '88900');
$objWriter->writeAttribute('cap', 'sq');
// a:solidFill
$objWriter->startElement('a:solidFill');
// a:srgbClr
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', 'FFFFFF');
$objWriter->endElement();
$objWriter->endElement();
// a:miter
$objWriter->startElement('a:miter');
$objWriter->writeAttribute('lim', '800000');
$objWriter->endElement();
$objWriter->endElement();
*/
if ($pDrawing->getShadow()->getVisible()) {
// a:effectLst
$objWriter->startElement('a:effectLst');

View File

@ -221,21 +221,6 @@ class Rels extends WriterPart
);
}
// Write chart relationships?
// $chartCount = 0;
// $charts = $pWorksheet->getChartCollection();
// echo 'Chart Rels: ' , count($charts) , '<br />';
// if (count($charts) > 0) {
// foreach ($charts as $chart) {
// $this->writeRelationship(
// $objWriter,
// ++$d,
// 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
// '../charts/chart' . ++$chartCount . '.xml'
// );
// }
// }
//
// Write hyperlink relationships?
$i = 1;
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {

View File

@ -264,22 +264,10 @@ class StringTable extends WriterPart
$objWriter->writeAttribute('typeface', $element->getFont()->getName());
$objWriter->endElement();
// Superscript / subscript
// if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
// $objWriter->startElement($prefix.'vertAlign');
// if ($element->getFont()->getSuperScript()) {
// $objWriter->writeAttribute('val', 'superscript');
// } elseif ($element->getFont()->getSubScript()) {
// $objWriter->writeAttribute('val', 'subscript');
// }
// $objWriter->endElement();
// }
//
$objWriter->endElement();
// t
$objWriter->startElement($prefix . 't');
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
$objWriter->writeRawData(\PhpSpreadsheet\Shared\StringHelper::controlCharacterPHP2OOXML($element->getText()));
$objWriter->endElement();

View File

@ -145,7 +145,6 @@ class Worksheet extends WriterPart
{
// sheetPr
$objWriter->startElement('sheetPr');
//$objWriter->writeAttribute('codeName', $pSheet->getTitle());
if ($pSheet->getParent()->hasMacros()) {
//if the workbook have macros, we need to have codeName for the sheet
if ($pSheet->hasCodeName() == false) {
@ -1125,7 +1124,6 @@ class Worksheet extends WriterPart
}
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
if ($this->getParentWriter()->getPreCalculateFormulas()) {
// $calculatedValue = $pCell->getCalculatedValue();
if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
$objWriter->writeElement('v', \PhpSpreadsheet\Shared\StringHelper::formatNumber($calculatedValue));
} else {

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel2007;
/**
* \PhpSpreadsheet\Writer\Excel2007\WriterPart
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer;
/**
* \PhpSpreadsheet\Writer\Excel5
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\BIFFwriter
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -94,7 +92,6 @@ class BIFFwriter
{
$this->_data = '';
$this->_datasize = 0;
// $this->limit = 8224;
}
/**

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\Escher
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -292,7 +290,6 @@ class Escher
// 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()) {

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\Font
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\Parser
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -592,7 +590,6 @@ class Parser
private function convertFunction($token, $num_args)
{
$args = $this->functions[$token][1];
// $volatile = $this->functions[$token][3];
// Fixed number of args eg. TIME($i, $j, $k).
if ($args >= 0) {
@ -650,8 +647,6 @@ class Parser
*/
private function convertRange3d($token)
{
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
// Split the ref at the ! symbol
list($ext_ref, $range) = explode('!', $token);
@ -670,15 +665,7 @@ class Parser
}
// The ptg value depends on the class of the ptg.
// if ($class == 0) {
$ptgArea = pack('C', $this->ptg['ptgArea3d']);
// } elseif ($class == 1) {
// $ptgArea = pack("C", $this->ptg['ptgArea3dV']);
// } elseif ($class == 2) {
// $ptgArea = pack("C", $this->ptg['ptgArea3dA']);
// } else {
// throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class");
// }
return $ptgArea . $ext_ref . $row1 . $row2 . $col1 . $col2;
}
@ -691,23 +678,13 @@ class Parser
*/
private function convertRef2d($cell)
{
// $class = 2; // as far as I know, this is magick.
// Convert the cell reference
$cell_array = $this->cellToPackedRowcol($cell);
list($row, $col) = $cell_array;
// The ptg value depends on the class of the ptg.
// if ($class == 0) {
// $ptgRef = pack("C", $this->ptg['ptgRef']);
// } elseif ($class == 1) {
// $ptgRef = pack("C", $this->ptg['ptgRefV']);
// } elseif ($class == 2) {
$ptgRef = pack('C', $this->ptg['ptgRefA']);
// } else {
// // TODO: use real error codes
// throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class");
// }
return $ptgRef . $row . $col;
}
@ -720,8 +697,6 @@ class Parser
*/
private function convertRef3d($cell)
{
// $class = 2; // as far as I know, this is magick.
// Split the ref at the ! symbol
list($ext_ref, $cell) = explode('!', $cell);
@ -732,15 +707,7 @@ class Parser
list($row, $col) = $this->cellToPackedRowcol($cell);
// The ptg value depends on the class of the ptg.
// if ($class == 0) {
// $ptgRef = pack("C", $this->ptg['ptgRef3d']);
// } elseif ($class == 1) {
// $ptgRef = pack("C", $this->ptg['ptgRef3dV']);
// } elseif ($class == 2) {
$ptgRef = pack('C', $this->ptg['ptgRef3dA']);
// } else {
// throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class");
// }
return $ptgRef . $ext_ref . $row . $col;
}
@ -1034,9 +1001,6 @@ class Parser
}
if ($this->match($token) != '') {
//if ($i < strlen($this->formula) - 1) {
// $this->lookAhead = $this->formula{$i+1};
//}
$this->currentCharacter = $i + 1;
$this->currentToken = $token;
@ -1355,7 +1319,6 @@ class Parser
} 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->currentToken)) {
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
// must be an error?
//$result = $this->currentToken;
$result = $this->createTree($this->currentToken, '', '');
$this->advance();
@ -1363,7 +1326,6 @@ class Parser
} 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->currentToken)) {
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
// must be an error?
//$result = $this->currentToken;
$result = $this->createTree($this->currentToken, '', '');
$this->advance();

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\Workbook
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -210,8 +208,6 @@ class Workbook extends BIFFwriter
$this->spreadsheet = $spreadsheet;
// set BIFFwriter limit for CONTINUE records
// $this->_limit = 8224;
$this->codepage = 0x04B0;
// Add empty sheets and Build color cache
@ -1228,7 +1224,7 @@ class Workbook extends BIFFwriter
$header = pack('vv', $record, $length);
/* using the same country code always for simplicity */
$data = pack('vv', $this->countryCode, $this->countryCode);
//$this->append($header . $data);
return $this->writeData($header . $data);
}

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\Worksheet
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or
@ -209,9 +207,6 @@ class Worksheet extends BIFFwriter
// It needs to call its parent's constructor explicitly
parent::__construct();
// change BIFFwriter limit for CONTINUE records
// $this->_limit = 8224;
$this->_preCalculateFormulas = $preCalculateFormulas;
$this->stringTotal = &$str_total;
$this->stringUnique = &$str_unique;
@ -221,8 +216,6 @@ class Worksheet extends BIFFwriter
$this->phpSheet = $phpSheet;
//$this->ext_sheets = array();
//$this->offset = 0;
$this->xlsStringMaxLength = 255;
$this->columnInfo = [];
$this->selection = [0, 0, 0, 0];
@ -245,7 +238,6 @@ class Worksheet extends BIFFwriter
$maxC = $this->phpSheet->getHighestColumn();
// Determine lowest and highest column and row
// $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR;
$this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR;
$this->firstColumnIndex = \PhpSpreadsheet\Cell::columnIndexFromString($minC);
@ -398,7 +390,6 @@ class Worksheet extends BIFFwriter
$cVal = $cell->getValue();
if ($cVal instanceof \PhpSpreadsheet\RichText) {
// $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
$arrcRun = [];
$str_len = \PhpSpreadsheet\Shared\StringHelper::countCharacters($cVal->getPlainText(), 'UTF-8');
$str_pos = 0;
@ -479,7 +470,6 @@ class Worksheet extends BIFFwriter
$url = str_replace('sheet://', 'internal:', $url);
} elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
// URL
// $url = $url;
} else {
// external (local file)
$url = 'external:' . $url;
@ -2305,7 +2295,7 @@ class Worksheet extends BIFFwriter
public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
{
$bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap));
list($width, $height, $size, $data) = $bitmap_array; //$this->processBitmap($bitmap);
list($width, $height, $size, $data) = $bitmap_array;
// Scale the frame of the image.
$width *= $scale_x;
@ -2606,7 +2596,6 @@ class Worksheet extends BIFFwriter
$compression = unpack('Vcomp', substr($data, 0, 4));
$data = substr($data, 4);
//$compression = 0;
if ($compression['comp'] != 0) {
throw new \PhpSpreadsheet\Writer\Exception("$bitmap: compression not supported in bitmap image.\n");
}

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer\Excel5;
/**
* \PhpSpreadsheet\Writer\Excel5\Xf
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -3,8 +3,6 @@
namespace PhpSpreadsheet\Writer;
/**
* \PhpSpreadsheet\Writer\Exception
*
* Copyright (c) 2006 - 2015 PhpSpreadsheet
*
* This library is free software; you can redistribute it and/or

View File

@ -1035,8 +1035,6 @@ class HTML extends BaseWriter implements IWriter
*/
private function createCSSStyleBorder(\Spreadsheet\Style\Border $pStyle)
{
// Create CSS
// $css = $this->mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
// Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');

View File

@ -43,19 +43,12 @@ class Comment
$comment = $comments[$cell->getCoordinate()];
$objWriter->startElement('office:annotation');
//$objWriter->writeAttribute('draw:style-name', 'gr1');
//$objWriter->writeAttribute('draw:text-style-name', 'P1');
$objWriter->writeAttribute('svg:width', $comment->getWidth());
$objWriter->writeAttribute('svg:height', $comment->getHeight());
$objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
$objWriter->writeAttribute('svg:y', $comment->getMarginTop());
//$objWriter->writeAttribute('draw:caption-point-x', $comment->getMarginLeft());
//$objWriter->writeAttribute('draw:caption-point-y', $comment->getMarginTop());
$objWriter->writeElement('dc:creator', $comment->getAuthor());
// TODO: Not realized in \PhpSpreadsheet\Comment yet.
//$objWriter->writeElement('dc:date', $comment->getDate());
$objWriter->writeElement('text:p', $comment->getText()->getPlainText());
//$objWriter->writeAttribute('draw:text-style-name', 'P1');
$objWriter->endElement();
}
}

View File

@ -123,7 +123,6 @@ class Content extends WriterPart
$sheet_count = $spreadsheet->getSheetCount();
for ($i = 0; $i < $sheet_count; ++$i) {
//$this->getWriterPart('Worksheet')->writeWorksheet());
$objWriter->startElement('table:table');
$objWriter->writeAttribute('table:name', $spreadsheet->getSheet($i)->getTitle());
$objWriter->writeElement('office:forms');