diff --git a/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php b/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php index de9e2f94..caea7dab 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php @@ -245,7 +245,7 @@ class Wincache extends CacheBase implements ICache */ public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments) { - $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; + $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; if (is_null($this->cachePrefix)) { $baseUnique = $this->getUniqueID(); diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index e4d1b32d..1a9cf14a 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -109,10 +109,10 @@ class Calculation * @var array */ private static $operators = [ - '+' => true, '-' => true, '*' => true, '/' => true, - '^' => true, '&' => true, '%' => false, '~' => false, - '>' => true, '<' => true, '=' => true, '>=' => true, - '<=' => true, '<>' => true, '|' => true, ':' => true, + '+' => true, '-' => true, '*' => true, '/' => true, + '^' => true, '&' => true, '%' => false, '~' => false, + '>' => true, '<' => true, '=' => true, '>=' => true, + '<=' => true, '<>' => true, '|' => true, ':' => true, ]; /** @@ -121,10 +121,10 @@ class Calculation * @var array */ private static $binaryOperators = [ - '+' => true, '-' => true, '*' => true, '/' => true, - '^' => true, '&' => true, '>' => true, '<' => true, - '=' => true, '>=' => true, '<=' => true, '<>' => true, - '|' => true, ':' => true, + '+' => true, '-' => true, '*' => true, '/' => true, + '^' => true, '&' => true, '>' => true, '<' => true, + '=' => true, '>=' => true, '<=' => true, '<>' => true, + '|' => true, ':' => true, ]; /** @@ -189,7 +189,7 @@ class Calculation * * @var string */ - private static $localeLanguage = 'en_us'; // US English (default locale) + private static $localeLanguage = 'en_us'; // US English (default locale) /** * List of available locale settings @@ -198,7 +198,7 @@ class Calculation * @var string[] */ private static $validLocaleLanguages = [ - 'en', // English (default language) + 'en', // English (default language) ]; /** @@ -2279,7 +2279,7 @@ class Calculation // Retrieve the list of locale or language specific function names $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($localeFunctions as $localeFunction) { - list($localeFunction) = explode('##', $localeFunction); // Strip out comments + list($localeFunction) = explode('##', $localeFunction); // Strip out comments if (strpos($localeFunction, '=') !== false) { list($fName, $lfName) = explode('=', $localeFunction); $fName = trim($fName); @@ -2304,7 +2304,7 @@ class Calculation if (file_exists($configFile)) { $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($localeSettings as $localeSetting) { - list($localeSetting) = explode('##', $localeSetting); // Strip out comments + list($localeSetting) = explode('##', $localeSetting); // Strip out comments if (strpos($localeSetting, '=') !== false) { list($settingName, $settingValue) = explode('=', $localeSetting); $settingName = strtoupper(trim($settingName)); @@ -3034,12 +3034,12 @@ class Calculation // These operators always work on two values // Array key is the operator, the value indicates whether this is a left or right associative operator private static $operatorAssociativity = [ - '^' => 0, // Exponentiation - '*' => 0, '/' => 0, // Multiplication and Division - '+' => 0, '-' => 0, // Addition and Subtraction - '&' => 0, // Concatenation - '|' => 0, ':' => 0, // Intersect and Range - '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison + '^' => 0, // Exponentiation + '*' => 0, '/' => 0, // Multiplication and Division + '+' => 0, '-' => 0, // Addition and Subtraction + '&' => 0, // Concatenation + '|' => 0, ':' => 0, // Intersect and Range + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison ]; // Comparison (Boolean) Operators @@ -3050,15 +3050,15 @@ class Calculation // This list includes all valid operators, whether binary (including boolean) or unary (such as %) // Array key is the operator, the value is its precedence private static $operatorPrecedence = [ - ':' => 8, // Range - '|' => 7, // Intersect - '~' => 6, // Negation - '%' => 5, // Percentage - '^' => 4, // Exponentiation - '*' => 3, '/' => 3, // Multiplication and Division - '+' => 2, '-' => 2, // Addition and Subtraction - '&' => 1, // Concatenation - '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison + ':' => 8, // Range + '|' => 7, // Intersect + '~' => 6, // Negation + '%' => 5, // Percentage + '^' => 4, // Exponentiation + '*' => 3, '/' => 3, // Multiplication and Division + '+' => 2, '-' => 2, // Addition and Subtraction + '&' => 1, // Concatenation + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison ]; // Convert infix to postfix notation @@ -3085,9 +3085,9 @@ class Calculation $index = 0; $stack = new Calculation\Token\Stack(); $output = []; - $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a + $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a // - is a negation or + is a positive operator rather than an operation - $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand + $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand // should be null in a function call // The guts of the lexical parser // Loop through the formula extracting each operator and operand in turn @@ -3107,26 +3107,26 @@ class Calculation 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 + $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 + $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 + ++$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 + 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']]) && @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { - $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output } - $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack + $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack ++$index; $expectingOperator = false; } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? @@ -3141,10 +3141,10 @@ 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 + $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) + $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) { @@ -3152,8 +3152,8 @@ class Calculation //} 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 + $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']; @@ -3217,7 +3217,7 @@ class Calculation if ($o2 === null) { return $this->raiseFormulaError('Formula Error: Unexpected ,'); } else { - $output[] = $o2; // pop the argument expression stuff and push onto the output + $output[] = $o2; // pop the argument expression stuff and push onto the output } } // If we've a comma when we're expecting an operand, then what we actually have is a null operand; @@ -3231,8 +3231,8 @@ class Calculation return $this->raiseFormulaError('Formula Error: Unexpected ,'); } $d = $stack->pop(); - $stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count - $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again + $stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count + $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again $expectingOperator = false; $expectingOperand = true; ++$index; @@ -3311,13 +3311,13 @@ class Calculation if ((is_integer($startRowColRef)) && (ctype_digit($val)) && ($startRowColRef <= 1048576) && ($val <= 1048576)) { // Row range - $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 + $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 $output[count($output) - 1]['value'] = $rangeWS1 . 'A' . $startRowColRef; $val = $rangeWS2 . $endRowColRef . $val; } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) && (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) { // Column range - $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 + $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 $output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1'; $val = $rangeWS2 . $val . $endRowColRef; } @@ -3395,9 +3395,9 @@ class Calculation ($o2 = $stack->last()) && isset(self::$operators[$o2['value']]) && @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { - $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output } - $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack + $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack $expectingOperator = false; } } @@ -3405,7 +3405,7 @@ class Calculation while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { - return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced + return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced } $output[] = $op; } diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index b6feca89..d0b9d698 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -424,7 +424,7 @@ class DateTime return (float) \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 + return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 case Functions::RETURNDATE_PHP_OBJECT: $dayAdjust = 0; if ($hour < 0) { @@ -1036,7 +1036,7 @@ class DateTime $startDoW = self::DAYOFWEEK($startDate, 3); if (self::DAYOFWEEK($startDate, 3) >= 5) { - $startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW; + $startDate += ($decrementing) ? -$startDoW + 4 : 7 - $startDoW; ($decrementing) ? $endDays++ : $endDays--; } @@ -1046,7 +1046,7 @@ class DateTime // Adjust the calculated end date if it falls over a weekend $endDoW = self::DAYOFWEEK($endDate, 3); if ($endDoW >= 5) { - $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW; + $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW; } // Test any extra holiday parameters diff --git a/src/PhpSpreadsheet/Calculation/Financial.php b/src/PhpSpreadsheet/Calculation/Financial.php index e294a26c..033695b1 100644 --- a/src/PhpSpreadsheet/Calculation/Financial.php +++ b/src/PhpSpreadsheet/Calculation/Financial.php @@ -180,9 +180,9 @@ class Financial $firstinterest = Functions::flattenSingleValue($firstinterest); $settlement = Functions::flattenSingleValue($settlement); $rate = Functions::flattenSingleValue($rate); - $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); - $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); + $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); + $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); // Validate if ((is_numeric($rate)) && (is_numeric($par))) { @@ -230,8 +230,8 @@ class Financial $issue = Functions::flattenSingleValue($issue); $settlement = Functions::flattenSingleValue($settlement); $rate = Functions::flattenSingleValue($rate); - $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); - $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); + $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); + $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); // Validate if ((is_numeric($rate)) && (is_numeric($par))) { @@ -290,7 +290,7 @@ class Financial $salvage = Functions::flattenSingleValue($salvage); $period = floor(Functions::flattenSingleValue($period)); $rate = Functions::flattenSingleValue($rate); - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); // The depreciation coefficients are: // Life of assets (1/rate) Depreciation coefficient @@ -617,7 +617,7 @@ class Financial $settlement = Functions::flattenSingleValue($settlement); $maturity = Functions::flattenSingleValue($maturity); $frequency = (int) Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); if (is_string($settlement = DateTime::getDateValue($settlement))) { return Functions::VALUE(); @@ -672,7 +672,7 @@ class Financial $settlement = Functions::flattenSingleValue($settlement); $maturity = Functions::flattenSingleValue($maturity); $frequency = (int) Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); if (is_string($settlement = DateTime::getDateValue($settlement))) { return Functions::VALUE(); @@ -743,7 +743,7 @@ class Financial $settlement = Functions::flattenSingleValue($settlement); $maturity = Functions::flattenSingleValue($maturity); $frequency = (int) Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); if (is_string($settlement = DateTime::getDateValue($settlement))) { return Functions::VALUE(); @@ -1619,7 +1619,7 @@ class Financial $yield = (float) Functions::flattenSingleValue($yield); $redemption = (float) Functions::flattenSingleValue($redemption); $frequency = (int) Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); if (is_string($settlement = DateTime::getDateValue($settlement))) { return Functions::VALUE(); @@ -1828,9 +1828,9 @@ class Financial $nper = (int) Functions::flattenSingleValue($nper); $pmt = Functions::flattenSingleValue($pmt); $pv = Functions::flattenSingleValue($pv); - $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv); - $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type); - $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); + $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv); + $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type); + $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); $rate = $guess; if (abs($rate) < FINANCIAL_PRECISION) { diff --git a/src/PhpSpreadsheet/Calculation/Logical.php b/src/PhpSpreadsheet/Calculation/Logical.php index 166dbf11..7fb896ae 100644 --- a/src/PhpSpreadsheet/Calculation/Logical.php +++ b/src/PhpSpreadsheet/Calculation/Logical.php @@ -237,8 +237,8 @@ class Logical */ public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false) { - $condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition); - $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue); + $condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition); + $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue); $returnIfFalse = (is_null($returnIfFalse)) ? false : Functions::flattenSingleValue($returnIfFalse); return ($condition) ? $returnIfTrue : $returnIfFalse; diff --git a/src/PhpSpreadsheet/Calculation/LookupRef.php b/src/PhpSpreadsheet/Calculation/LookupRef.php index 4c9ac7bf..2cc37f32 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -260,7 +260,7 @@ class LookupRef $args = func_get_args(); $pCell = array_pop($args); - $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); + $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); $displayName = (is_null($displayName)) ? '' : Functions::flattenSingleValue($displayName); if ((!is_object($pCell)) || (trim($linkURL) == '')) { diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index e9fe621d..98c31cee 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -913,7 +913,7 @@ class MathTrig public static function ROMAN($aValue, $style = 0) { $aValue = Functions::flattenSingleValue($aValue); - $style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style); + $style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style); if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) { return Functions::VALUE(); } diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index 7bb2cd8c..83bdb77f 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -520,8 +520,8 @@ class Statistical ]; // Define lower and upper region break-points. - $p_low = 0.02425; //Use lower region approx. below this - $p_high = 1 - $p_low; //Use upper region approx. above this + $p_low = 0.02425; //Use lower region approx. below this + $p_high = 1 - $p_low; //Use upper region approx. above this if (0 < $p && $p < $p_low) { // Rational approximation for lower region. diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 109a0c7b..39b3a395 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -35,14 +35,14 @@ class DataSeries const TYPE_PIECHART = 'pieChart'; const TYPE_PIECHART_3D = 'pie3DChart'; const TYPE_DOUGHTNUTCHART = 'doughnutChart'; - const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym + const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym const TYPE_SCATTERCHART = 'scatterChart'; const TYPE_SURFACECHART = 'surfaceChart'; const TYPE_SURFACECHART_3D = 'surface3DChart'; const TYPE_RADARCHART = 'radarChart'; const TYPE_BUBBLECHART = 'bubbleChart'; const TYPE_STOCKCHART = 'stockChart'; - const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym + const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym const GROUPING_CLUSTERED = 'clustered'; const GROUPING_STACKED = 'stacked'; diff --git a/src/PhpSpreadsheet/Chart/Legend.php b/src/PhpSpreadsheet/Chart/Legend.php index 04efee57..999c3de4 100644 --- a/src/PhpSpreadsheet/Chart/Legend.php +++ b/src/PhpSpreadsheet/Chart/Legend.php @@ -29,12 +29,12 @@ namespace PhpSpreadsheet\Chart; class Legend { /** Legend positions */ - const XL_LEGEND_POSITION_BOTTOM = -4107; // Below the chart. - const XL_LEGEND_POSITION_CORNER = 2; // In the upper right-hand corner of the chart border. - const XL_LEGEND_POSITION_CUSTOM = -4161; // A custom position. - const XL_LEGEND_POSITION_LEFT = -4131; // Left of the chart. - const XL_LEGEND_POSITION_RIGHT = -4152; // Right of the chart. - const XL_LEGEND_POSITION_TOP = -4160; // Above the chart. + const XL_LEGEND_POSITION_BOTTOM = -4107; // Below the chart. + const XL_LEGEND_POSITION_CORNER = 2; // In the upper right-hand corner of the chart border. + const XL_LEGEND_POSITION_CUSTOM = -4161; // A custom position. + const XL_LEGEND_POSITION_LEFT = -4131; // Left of the chart. + const XL_LEGEND_POSITION_RIGHT = -4152; // Right of the chart. + const XL_LEGEND_POSITION_TOP = -4160; // Above the chart. const POSITION_RIGHT = 'r'; const POSITION_LEFT = 'l'; diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index 39c09ed1..b5032479 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -33,10 +33,10 @@ class JpGraph private static $height = 480; private static $colourSet = [ - 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', - 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', - 'mediumblue', 'magenta', 'sandybrown', 'cyan', - 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', + 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', + 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', + 'mediumblue', 'magenta', 'sandybrown', 'cyan', + 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', 'goldenrod2', ]; @@ -178,21 +178,21 @@ class JpGraph $legendOverlay = $legend->getOverlay(); switch ($legendPosition) { case 'r': - $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right + $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right $this->graph->legend->SetColumns(1); break; case 'l': - $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center'); // left + $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center'); // left $this->graph->legend->SetColumns(1); break; case 't': - $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top'); // top + $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top'); // top break; case 'b': - $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); // bottom + $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); // bottom break; default: - $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top'); // top-right + $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top'); // top-right $this->graph->legend->SetColumns(1); break; } diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/CSV.php index 7e11073f..595ffe27 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/CSV.php @@ -260,7 +260,7 @@ class CSV extends BaseReader implements IReader // Set our starting row based on whether we're in contiguous mode or not $currentRow = 1; if ($this->contiguous) { - $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow; + $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow() : $this->contiguousRow; } // Loop through each line of the file in turn diff --git a/src/PhpSpreadsheet/Reader/Excel2007.php b/src/PhpSpreadsheet/Reader/Excel2007.php index 84702691..0642ca00 100644 --- a/src/PhpSpreadsheet/Reader/Excel2007.php +++ b/src/PhpSpreadsheet/Reader/Excel2007.php @@ -136,7 +136,7 @@ class Excel2007 extends BaseReader implements IReader 'SimpleXMLElement', \PhpSpreadsheet\Settings::getLibXmlLoaderOptions() ) - ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" if ($xmlWorkbook->sheets) { foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { @@ -541,7 +541,7 @@ class Excel2007 extends BaseReader implements IReader } if (!is_null($macros)) { - $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin + $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin'); //vbaProject.bin always in 'xl' dir and always named vbaProject.bin if ($macrosCode !== false) { $excel->setMacrosCode($macrosCode); $excel->setHasMacros(true); @@ -1313,7 +1313,7 @@ class Excel2007 extends BaseReader implements IReader foreach (\PhpSpreadsheet\Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { $cell = $docSheet->getCell($cellReference); if (isset($linkRel['id'])) { - $hyperlinkUrl = $hyperlinks[ (string) $linkRel['id'] ]; + $hyperlinkUrl = $hyperlinks[(string) $linkRel['id']]; if (isset($hyperlink['location'])) { $hyperlinkUrl .= '#' . (string) $hyperlink['location']; } @@ -1740,10 +1740,10 @@ class Excel2007 extends BaseReader implements IReader } break; case '_xlnm.Print_Area': - $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? + $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? $newRangeSets = []; foreach ($rangeSets as $rangeSet) { - $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? + $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? $rangeSet = isset($range[1]) ? $range[1] : $range[0]; if (strpos($rangeSet, ':') === false) { $rangeSet = $rangeSet . ':' . $rangeSet; diff --git a/src/PhpSpreadsheet/Reader/Excel5.php b/src/PhpSpreadsheet/Reader/Excel5.php index c3eb9735..f6aa8b19 100644 --- a/src/PhpSpreadsheet/Reader/Excel5.php +++ b/src/PhpSpreadsheet/Reader/Excel5.php @@ -1122,7 +1122,7 @@ class Excel5 extends BaseReader implements IReader // $range should look like one of these // Foo!$C$7:$J$66 // Bar!$A$1:$IV$2 - $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? + $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? $sheetName = trim($explodes[0], "'"); if (count($explodes) == 2) { if (strpos($explodes[1], ':') === false) { diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index 246b655f..0de29851 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -104,7 +104,7 @@ class Gnumeric extends BaseReader implements IReader $worksheetNames = []; while ($xml->read()) { if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) { - $xml->read(); // Move onto the value node + $xml->read(); // Move onto the value node $worksheetNames[] = (string) $xml->value; } elseif ($xml->name == 'gnm:Sheets') { // break out of the loop once we've got our sheet names rather than parse the entire file @@ -145,14 +145,14 @@ class Gnumeric extends BaseReader implements IReader while ($xml->read()) { if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) { - $xml->read(); // Move onto the value node + $xml->read(); // Move onto the value node $tmpInfo['worksheetName'] = (string) $xml->value; } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) { - $xml->read(); // Move onto the value node + $xml->read(); // Move onto the value node $tmpInfo['lastColumnIndex'] = (int) $xml->value; $tmpInfo['totalColumns'] = (int) $xml->value + 1; } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) { - $xml->read(); // Move onto the value node + $xml->read(); // Move onto the value node $tmpInfo['totalRows'] = (int) $xml->value + 1; break; } @@ -351,7 +351,7 @@ class Gnumeric extends BaseReader implements IReader if (isset($sheet->PrintInformation->Margins)) { foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) { $marginAttributes = $margin->attributes(); - $marginSize = 72 / 100; // Default + $marginSize = 72 / 100; // Default switch ($marginAttributes['PrefUnit']) { case 'mm': $marginSize = intval($marginAttributes['Points']) / 100; @@ -437,7 +437,7 @@ class Gnumeric extends BaseReader implements IReader break; case '20': // Boolean $type = \PhpSpreadsheet\Cell\DataType::TYPE_BOOL; - $cell = ($cell == 'TRUE') ? true: false; + $cell = ($cell == 'TRUE') ? true : false; break; case '30': // Integer $cell = intval($cell); diff --git a/src/PhpSpreadsheet/Reader/OOCalc.php b/src/PhpSpreadsheet/Reader/OOCalc.php index 4d006b57..3162c225 100644 --- a/src/PhpSpreadsheet/Reader/OOCalc.php +++ b/src/PhpSpreadsheet/Reader/OOCalc.php @@ -626,10 +626,10 @@ class OOCalc extends BaseReader implements IReader foreach ($temp as &$value) { // Only replace in alternate array entries (i.e. non-quoted blocks) if ($tKey = !$tKey) { - $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value); // Cell range reference in another sheet - $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet - $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference - $value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference + $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value); // Cell range reference in another sheet + $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet + $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference + $value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference $value = \PhpSpreadsheet\Calculation::translateSeparator(';', ',', $value, $inBraces); } } diff --git a/src/PhpSpreadsheet/Reader/SYLK.php b/src/PhpSpreadsheet/Reader/SYLK.php index 33574f1e..4c68249f 100644 --- a/src/PhpSpreadsheet/Reader/SYLK.php +++ b/src/PhpSpreadsheet/Reader/SYLK.php @@ -219,8 +219,8 @@ class SYLK extends BaseReader implements IReader } $spreadsheet->setActiveSheetIndex($this->sheetIndex); - $fromFormats = ['\-', '\ ']; - $toFormats = ['-', ' ']; + $fromFormats = ['\-', '\ ']; + $toFormats = ['-', ' ']; // Loop through file $rowData = []; diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index 4e0c6c81..ba46a486 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -169,8 +169,7 @@ class ReferenceHelper { $aBreaks = $pSheet->getBreaks(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aBreaks, ['self', 'cellReverseSort']) : - uksort($aBreaks, ['self', 'cellSort']); + uksort($aBreaks, ['self', 'cellReverseSort']) : uksort($aBreaks, ['self', 'cellSort']); foreach ($aBreaks as $key => $value) { if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { @@ -230,8 +229,7 @@ class ReferenceHelper { $aHyperlinkCollection = $pSheet->getHyperlinkCollection(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aHyperlinkCollection, ['self', 'cellReverseSort']) : - uksort($aHyperlinkCollection, ['self', 'cellSort']); + uksort($aHyperlinkCollection, ['self', 'cellReverseSort']) : uksort($aHyperlinkCollection, ['self', 'cellSort']); foreach ($aHyperlinkCollection as $key => $value) { $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); @@ -256,8 +254,7 @@ class ReferenceHelper { $aDataValidationCollection = $pSheet->getDataValidationCollection(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aDataValidationCollection, ['self', 'cellReverseSort']) : - uksort($aDataValidationCollection, ['self', 'cellSort']); + uksort($aDataValidationCollection, ['self', 'cellReverseSort']) : uksort($aDataValidationCollection, ['self', 'cellSort']); foreach ($aDataValidationCollection as $key => $value) { $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); @@ -303,8 +300,7 @@ class ReferenceHelper { $aProtectedCells = $pSheet->getProtectedCells(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aProtectedCells, ['self', 'cellReverseSort']) : - uksort($aProtectedCells, ['self', 'cellSort']); + uksort($aProtectedCells, ['self', 'cellReverseSort']) : uksort($aProtectedCells, ['self', 'cellSort']); foreach ($aProtectedCells as $key => $value) { $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); if ($key != $newReference) { diff --git a/src/PhpSpreadsheet/Shared/CodePage.php b/src/PhpSpreadsheet/Shared/CodePage.php index 4802a67a..4c7f8fad 100644 --- a/src/PhpSpreadsheet/Shared/CodePage.php +++ b/src/PhpSpreadsheet/Shared/CodePage.php @@ -40,117 +40,117 @@ class CodePage { switch ($codePage) { case 367: - return 'ASCII'; // ASCII + return 'ASCII'; // ASCII case 437: - return 'CP437'; // OEM US + return 'CP437'; // OEM US case 720: - throw new \PhpSpreadsheet\Exception('Code page 720 not supported.'); // OEM Arabic + throw new \PhpSpreadsheet\Exception('Code page 720 not supported.'); // OEM Arabic case 737: - return 'CP737'; // OEM Greek + return 'CP737'; // OEM Greek case 775: - return 'CP775'; // OEM Baltic + return 'CP775'; // OEM Baltic case 850: - return 'CP850'; // OEM Latin I + return 'CP850'; // OEM Latin I case 852: - return 'CP852'; // OEM Latin II (Central European) + return 'CP852'; // OEM Latin II (Central European) case 855: - return 'CP855'; // OEM Cyrillic + return 'CP855'; // OEM Cyrillic case 857: - return 'CP857'; // OEM Turkish + return 'CP857'; // OEM Turkish case 858: - return 'CP858'; // OEM Multilingual Latin I with Euro + return 'CP858'; // OEM Multilingual Latin I with Euro case 860: - return 'CP860'; // OEM Portugese + return 'CP860'; // OEM Portugese case 861: - return 'CP861'; // OEM Icelandic + return 'CP861'; // OEM Icelandic case 862: - return 'CP862'; // OEM Hebrew + return 'CP862'; // OEM Hebrew case 863: - return 'CP863'; // OEM Canadian (French) + return 'CP863'; // OEM Canadian (French) case 864: - return 'CP864'; // OEM Arabic + return 'CP864'; // OEM Arabic case 865: - return 'CP865'; // OEM Nordic + return 'CP865'; // OEM Nordic case 866: - return 'CP866'; // OEM Cyrillic (Russian) + return 'CP866'; // OEM Cyrillic (Russian) case 869: - return 'CP869'; // OEM Greek (Modern) + return 'CP869'; // OEM Greek (Modern) case 874: - return 'CP874'; // ANSI Thai + return 'CP874'; // ANSI Thai case 932: - return 'CP932'; // ANSI Japanese Shift-JIS + return 'CP932'; // ANSI Japanese Shift-JIS case 936: - return 'CP936'; // ANSI Chinese Simplified GBK + return 'CP936'; // ANSI Chinese Simplified GBK case 949: - return 'CP949'; // ANSI Korean (Wansung) + return 'CP949'; // ANSI Korean (Wansung) case 950: - return 'CP950'; // ANSI Chinese Traditional BIG5 + return 'CP950'; // ANSI Chinese Traditional BIG5 case 1200: return 'UTF-16LE'; // UTF-16 (BIFF8) case 1250: - return 'CP1250'; // ANSI Latin II (Central European) + return 'CP1250'; // ANSI Latin II (Central European) case 1251: - return 'CP1251'; // ANSI Cyrillic + return 'CP1251'; // ANSI Cyrillic case 0: // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program case 1252: - return 'CP1252'; // ANSI Latin I (BIFF4-BIFF7) + return 'CP1252'; // ANSI Latin I (BIFF4-BIFF7) case 1253: - return 'CP1253'; // ANSI Greek + return 'CP1253'; // ANSI Greek case 1254: - return 'CP1254'; // ANSI Turkish + return 'CP1254'; // ANSI Turkish case 1255: - return 'CP1255'; // ANSI Hebrew + return 'CP1255'; // ANSI Hebrew case 1256: - return 'CP1256'; // ANSI Arabic + return 'CP1256'; // ANSI Arabic case 1257: - return 'CP1257'; // ANSI Baltic + return 'CP1257'; // ANSI Baltic case 1258: - return 'CP1258'; // ANSI Vietnamese + return 'CP1258'; // ANSI Vietnamese case 1361: - return 'CP1361'; // ANSI Korean (Johab) + return 'CP1361'; // ANSI Korean (Johab) case 10000: - return 'MAC'; // Apple Roman + return 'MAC'; // Apple Roman case 10001: - return 'CP932'; // Macintosh Japanese + return 'CP932'; // Macintosh Japanese case 10002: - return 'CP950'; // Macintosh Chinese Traditional + return 'CP950'; // Macintosh Chinese Traditional case 10003: - return 'CP1361'; // Macintosh Korean + return 'CP1361'; // Macintosh Korean case 10004: return 'MACARABIC'; // Apple Arabic case 10005: return 'MACHEBREW'; // Apple Hebrew case 10006: - return 'MACGREEK'; // Macintosh Greek + return 'MACGREEK'; // Macintosh Greek case 10007: - return 'MACCYRILLIC'; // Macintosh Cyrillic + return 'MACCYRILLIC'; // Macintosh Cyrillic case 10008: - return 'CP936'; // Macintosh - Simplified Chinese (GB 2312) + return 'CP936'; // Macintosh - Simplified Chinese (GB 2312) case 10010: - return 'MACROMANIA'; // Macintosh Romania + return 'MACROMANIA'; // Macintosh Romania case 10017: - return 'MACUKRAINE'; // Macintosh Ukraine + return 'MACUKRAINE'; // Macintosh Ukraine case 10021: - return 'MACTHAI'; // Macintosh Thai + return 'MACTHAI'; // Macintosh Thai case 10029: - return 'MACCENTRALEUROPE'; // Macintosh Central Europe + return 'MACCENTRALEUROPE'; // Macintosh Central Europe case 10079: - return 'MACICELAND'; // Macintosh Icelandic + return 'MACICELAND'; // Macintosh Icelandic case 10081: - return 'MACTURKISH'; // Macintosh Turkish + return 'MACTURKISH'; // Macintosh Turkish case 10082: - return 'MACCROATIAN'; // Macintosh Croatian + return 'MACCROATIAN'; // Macintosh Croatian case 21010: - return 'UTF-16LE'; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE + return 'UTF-16LE'; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE case 32768: - return 'MAC'; // Apple Roman + return 'MAC'; // Apple Roman case 32769: - throw new \PhpSpreadsheet\Exception('Code page 32769 not supported.'); // ANSI Latin I (BIFF2-BIFF3) + throw new \PhpSpreadsheet\Exception('Code page 32769 not supported.'); // ANSI Latin I (BIFF2-BIFF3) case 65000: - return 'UTF-7'; // Unicode (UTF-7) + return 'UTF-7'; // Unicode (UTF-7) case 65001: - return 'UTF-8'; // Unicode (UTF-8) + return 'UTF-8'; // Unicode (UTF-8) } throw new \PhpSpreadsheet\Exception('Unknown codepage: ' . $codePage); } diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index 8757e50c..1998c8ac 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -29,8 +29,8 @@ namespace PhpSpreadsheet\Shared; class Date { /** constants */ - const CALENDAR_WINDOWS_1900 = 1900; // Base date of 1st Jan 1900 = 1.0 - const CALENDAR_MAC_1904 = 1904; // Base date of 2nd Jan 1904 = 1.0 + const CALENDAR_WINDOWS_1900 = 1900; // Base date of 1st Jan 1900 = 1.0 + const CALENDAR_MAC_1904 = 1904; // Base date of 2nd Jan 1904 = 1.0 /* * Names of the months of the year, indexed by shortname diff --git a/src/PhpSpreadsheet/Shared/Excel5.php b/src/PhpSpreadsheet/Shared/Excel5.php index e8635b12..04c8e48c 100644 --- a/src/PhpSpreadsheet/Shared/Excel5.php +++ b/src/PhpSpreadsheet/Shared/Excel5.php @@ -233,8 +233,8 @@ class Excel5 $y1 = $offsetY; // Initialise end cell to the same as the start cell - $col_end = $col_start; // Col containing lower right corner of object - $row_end = $row_start; // Row containing bottom 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 // Zero the specified offset if greater than the cell dimensions if ($x1 >= self::sizeCol($sheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_start))) { diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index d1cb6fe6..5cb43ee2 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -45,8 +45,8 @@ class Font const CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80; const CHARSET_ANSI_KOREAN_HANGUL = 0x81; const CHARSET_ANSI_KOREAN_JOHAB = 0x82; - const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86; // gb2312 - const CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88; // big5 + const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86; // gb2312 + const CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88; // big5 const CHARSET_ANSI_GREEK = 0xA1; const CHARSET_ANSI_TURKISH = 0xA2; const CHARSET_ANSI_VIETNAMESE = 0xA3; diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS.php b/src/PhpSpreadsheet/Shared/OLE/PPS.php index 4fe28c9b..b2091049 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS.php @@ -184,7 +184,7 @@ class PPS . \PhpSpreadsheet\Shared\OLE::localDateToOLE($this->Time2nd) // 116 . pack('V', isset($this->startBlock) ? $this->startBlock : 0) // 120 . pack('V', $this->Size) // 124 - . pack('V', 0); // 128 + . pack('V', 0); // 128 return $ret; } diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php index 4230489e..eddbcacc 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -63,11 +63,11 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS // Initial Setting for saving $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, - (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)) { @@ -130,21 +130,21 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS $raList[$i]->Size = $raList[$i]->getDataLen(); if ($raList[$i]->Size < \PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) { $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 { $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; $iSlCnt = floor($this->_BIG_BLOCK_SIZE / \PhpSpreadsheet\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) + - (($iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0)); + (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); $iCnt = count($raList); $iBdCnt = $this->_BIG_BLOCK_SIZE / \PhpSpreadsheet\Shared\OLE::OLE_PPS_SIZE; - $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); + $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); return [$iSBDcnt, $iBBcnt, $iPPScnt]; } @@ -160,7 +160,7 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS { $iWk = log($i2) / log(2); - return ($iWk > floor($iWk))? floor($iWk) + 1:$iWk; + return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk; } /** @@ -181,16 +181,16 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS $iBdExL = 0; $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; $iAllW = $iAll; - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); - $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt)? 1: 0); + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); + $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); // Calculate BD count if ($iBdCnt > $i1stBdL) { while (1) { ++$iBdExL; ++$iAllW; - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt)? 1: 0); + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) { break; } @@ -278,7 +278,7 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS $raList[$i]->startBlock = $iStBlk; $iStBlk += (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 //if (isset($raList[$i]->_PPS_FILE)) { @@ -310,7 +310,7 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS } if ($raList[$i]->Size < \PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) { $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 $jB = $iSmbCnt - 1; for ($j = 0; $j < $jB; ++$j) { @@ -384,15 +384,15 @@ class Root extends \PhpSpreadsheet\Shared\OLE\PPS $iBdExL = 0; $iAll = $iBsize + $iPpsCnt + $iSbdSize; $iAllW = $iAll; - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); - $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt)? 1: 0); + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); + $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); // Calculate BD count if ($iBdCnt > $i1stBdL) { while (1) { ++$iBdExL; ++$iAllW; - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt)? 1: 0); + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) { break; } diff --git a/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php b/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php index 9c6ab98b..7197907b 100644 --- a/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php +++ b/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php @@ -2592,7 +2592,7 @@ class PclZip // ----- Set the file properties $p_header['size'] = 0; //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked - $p_header['external'] = 0x00000010; // Value for a folder : to be checked + $p_header['external'] = 0x00000010; // Value for a folder : to be checked // ----- Call the header generation if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @@ -4980,7 +4980,7 @@ function PclZipUtilPathReduction($p_dir) if ($v_skip > 0) { --$v_skip; } 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 : ''); } } } diff --git a/src/PhpSpreadsheet/Shared/PasswordHasher.php b/src/PhpSpreadsheet/Shared/PasswordHasher.php index fc75548b..491a6066 100644 --- a/src/PhpSpreadsheet/Shared/PasswordHasher.php +++ b/src/PhpSpreadsheet/Shared/PasswordHasher.php @@ -41,14 +41,14 @@ class PasswordHasher public static function hashPassword($pPassword = '') { $password = 0x0000; - $charPos = 1; // char position + $charPos = 1; // char position // split the plain text password in its component characters $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); foreach ($chars as $char) { - $value = ord($char) << $charPos++; // shifted ASCII value - $rotated_bits = $value >> 15; // rotated bits beyond bit 15 - $value &= 0x7fff; // first 15 bits + $value = ord($char) << $charPos++; // shifted ASCII value + $rotated_bits = $value >> 15; // rotated bits beyond bit 15 + $value &= 0x7fff; // first 15 bits $password ^= ($value | $rotated_bits); } diff --git a/src/PhpSpreadsheet/Style.php b/src/PhpSpreadsheet/Style.php index c651d011..db57e1cf 100644 --- a/src/PhpSpreadsheet/Style.php +++ b/src/PhpSpreadsheet/Style.php @@ -621,7 +621,7 @@ class Style extends Style\Supervisor implements IComparable $this->numberFormat->getHashCode() . $hashConditionals . $this->protection->getHashCode() . - ($this->quotePrefix ? 't' : 'f') . + ($this->quotePrefix ? 't' : 'f') . __CLASS__ ); } diff --git a/src/PhpSpreadsheet/Style/Alignment.php b/src/PhpSpreadsheet/Style/Alignment.php index f632d0e8..be294843 100644 --- a/src/PhpSpreadsheet/Style/Alignment.php +++ b/src/PhpSpreadsheet/Style/Alignment.php @@ -34,14 +34,14 @@ class Alignment extends Supervisor implements \PhpSpreadsheet\IComparable const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'; const HORIZONTAL_JUSTIFY = 'justify'; const HORIZONTAL_FILL = 'fill'; - const HORIZONTAL_DISTRIBUTED = 'distributed'; // Excel2007 only + const HORIZONTAL_DISTRIBUTED = 'distributed'; // Excel2007 only /* Vertical alignment styles */ const VERTICAL_BOTTOM = 'bottom'; const VERTICAL_TOP = 'top'; const VERTICAL_CENTER = 'center'; const VERTICAL_JUSTIFY = 'justify'; - const VERTICAL_DISTRIBUTED = 'distributed'; // Excel2007 only + const VERTICAL_DISTRIBUTED = 'distributed'; // Excel2007 only /* Read order */ const READORDER_CONTEXT = 0; diff --git a/src/PhpSpreadsheet/Style/Color.php b/src/PhpSpreadsheet/Style/Color.php index 7937536b..f042b1b5 100644 --- a/src/PhpSpreadsheet/Style/Color.php +++ b/src/PhpSpreadsheet/Style/Color.php @@ -362,62 +362,62 @@ class Color extends Supervisor implements \PhpSpreadsheet\IComparable // Indexed colors if (is_null(self::$indexedColors)) { self::$indexedColors = [ - 1 => 'FF000000', // System Colour #1 - Black - 2 => 'FFFFFFFF', // System Colour #2 - White - 3 => 'FFFF0000', // System Colour #3 - Red - 4 => 'FF00FF00', // System Colour #4 - Green - 5 => 'FF0000FF', // System Colour #5 - Blue - 6 => 'FFFFFF00', // System Colour #6 - Yellow - 7 => 'FFFF00FF', // System Colour #7- Magenta - 8 => 'FF00FFFF', // System Colour #8- Cyan - 9 => 'FF800000', // Standard Colour #9 - 10 => 'FF008000', // Standard Colour #10 - 11 => 'FF000080', // Standard Colour #11 - 12 => 'FF808000', // Standard Colour #12 - 13 => 'FF800080', // Standard Colour #13 - 14 => 'FF008080', // Standard Colour #14 - 15 => 'FFC0C0C0', // Standard Colour #15 - 16 => 'FF808080', // Standard Colour #16 - 17 => 'FF9999FF', // Chart Fill Colour #17 - 18 => 'FF993366', // Chart Fill Colour #18 - 19 => 'FFFFFFCC', // Chart Fill Colour #19 - 20 => 'FFCCFFFF', // Chart Fill Colour #20 - 21 => 'FF660066', // Chart Fill Colour #21 - 22 => 'FFFF8080', // Chart Fill Colour #22 - 23 => 'FF0066CC', // Chart Fill Colour #23 - 24 => 'FFCCCCFF', // Chart Fill Colour #24 - 25 => 'FF000080', // Chart Line Colour #25 - 26 => 'FFFF00FF', // Chart Line Colour #26 - 27 => 'FFFFFF00', // Chart Line Colour #27 - 28 => 'FF00FFFF', // Chart Line Colour #28 - 29 => 'FF800080', // Chart Line Colour #29 - 30 => 'FF800000', // Chart Line Colour #30 - 31 => 'FF008080', // Chart Line Colour #31 - 32 => 'FF0000FF', // Chart Line Colour #32 - 33 => 'FF00CCFF', // Standard Colour #33 - 34 => 'FFCCFFFF', // Standard Colour #34 - 35 => 'FFCCFFCC', // Standard Colour #35 - 36 => 'FFFFFF99', // Standard Colour #36 - 37 => 'FF99CCFF', // Standard Colour #37 - 38 => 'FFFF99CC', // Standard Colour #38 - 39 => 'FFCC99FF', // Standard Colour #39 - 40 => 'FFFFCC99', // Standard Colour #40 - 41 => 'FF3366FF', // Standard Colour #41 - 42 => 'FF33CCCC', // Standard Colour #42 - 43 => 'FF99CC00', // Standard Colour #43 - 44 => 'FFFFCC00', // Standard Colour #44 - 45 => 'FFFF9900', // Standard Colour #45 - 46 => 'FFFF6600', // Standard Colour #46 - 47 => 'FF666699', // Standard Colour #47 - 48 => 'FF969696', // Standard Colour #48 - 49 => 'FF003366', // Standard Colour #49 - 50 => 'FF339966', // Standard Colour #50 - 51 => 'FF003300', // Standard Colour #51 - 52 => 'FF333300', // Standard Colour #52 - 53 => 'FF993300', // Standard Colour #53 - 54 => 'FF993366', // Standard Colour #54 - 55 => 'FF333399', // Standard Colour #55 - 56 => 'FF333333', // Standard Colour #56 + 1 => 'FF000000', // System Colour #1 - Black + 2 => 'FFFFFFFF', // System Colour #2 - White + 3 => 'FFFF0000', // System Colour #3 - Red + 4 => 'FF00FF00', // System Colour #4 - Green + 5 => 'FF0000FF', // System Colour #5 - Blue + 6 => 'FFFFFF00', // System Colour #6 - Yellow + 7 => 'FFFF00FF', // System Colour #7- Magenta + 8 => 'FF00FFFF', // System Colour #8- Cyan + 9 => 'FF800000', // Standard Colour #9 + 10 => 'FF008000', // Standard Colour #10 + 11 => 'FF000080', // Standard Colour #11 + 12 => 'FF808000', // Standard Colour #12 + 13 => 'FF800080', // Standard Colour #13 + 14 => 'FF008080', // Standard Colour #14 + 15 => 'FFC0C0C0', // Standard Colour #15 + 16 => 'FF808080', // Standard Colour #16 + 17 => 'FF9999FF', // Chart Fill Colour #17 + 18 => 'FF993366', // Chart Fill Colour #18 + 19 => 'FFFFFFCC', // Chart Fill Colour #19 + 20 => 'FFCCFFFF', // Chart Fill Colour #20 + 21 => 'FF660066', // Chart Fill Colour #21 + 22 => 'FFFF8080', // Chart Fill Colour #22 + 23 => 'FF0066CC', // Chart Fill Colour #23 + 24 => 'FFCCCCFF', // Chart Fill Colour #24 + 25 => 'FF000080', // Chart Line Colour #25 + 26 => 'FFFF00FF', // Chart Line Colour #26 + 27 => 'FFFFFF00', // Chart Line Colour #27 + 28 => 'FF00FFFF', // Chart Line Colour #28 + 29 => 'FF800080', // Chart Line Colour #29 + 30 => 'FF800000', // Chart Line Colour #30 + 31 => 'FF008080', // Chart Line Colour #31 + 32 => 'FF0000FF', // Chart Line Colour #32 + 33 => 'FF00CCFF', // Standard Colour #33 + 34 => 'FFCCFFFF', // Standard Colour #34 + 35 => 'FFCCFFCC', // Standard Colour #35 + 36 => 'FFFFFF99', // Standard Colour #36 + 37 => 'FF99CCFF', // Standard Colour #37 + 38 => 'FFFF99CC', // Standard Colour #38 + 39 => 'FFCC99FF', // Standard Colour #39 + 40 => 'FFFFCC99', // Standard Colour #40 + 41 => 'FF3366FF', // Standard Colour #41 + 42 => 'FF33CCCC', // Standard Colour #42 + 43 => 'FF99CC00', // Standard Colour #43 + 44 => 'FFFFCC00', // Standard Colour #44 + 45 => 'FFFF9900', // Standard Colour #45 + 46 => 'FFFF6600', // Standard Colour #46 + 47 => 'FF666699', // Standard Colour #47 + 48 => 'FF969696', // Standard Colour #48 + 49 => 'FF003366', // Standard Colour #49 + 50 => 'FF339966', // Standard Colour #50 + 51 => 'FF003300', // Standard Colour #51 + 52 => 'FF333300', // Standard Colour #52 + 53 => 'FF993300', // Standard Colour #53 + 54 => 'FF993366', // Standard Colour #54 + 55 => 'FF333399', // Standard Colour #55 + 56 => 'FF333333', // Standard Colour #56 ]; } diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index 3588cfc5..1d0fbe23 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -286,7 +286,7 @@ class NumberFormat extends Supervisor implements \PhpSpreadsheet\IComparable self::$builtInFormats[11] = '0.00E+00'; self::$builtInFormats[12] = '# ?/?'; self::$builtInFormats[13] = '# ??/??'; - self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy'; + self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy'; self::$builtInFormats[15] = 'd-mmm-yy'; self::$builtInFormats[16] = 'd-mmm'; self::$builtInFormats[17] = 'mmm-yy'; @@ -294,17 +294,17 @@ class NumberFormat extends Supervisor implements \PhpSpreadsheet\IComparable self::$builtInFormats[19] = 'h:mm:ss AM/PM'; self::$builtInFormats[20] = 'h:mm'; self::$builtInFormats[21] = 'h:mm:ss'; - self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm'; + self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm'; - self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)'; - self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)'; - self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)'; - self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)'; + self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)'; + self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)'; + self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)'; + self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)'; self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'; self::$builtInFormats[45] = 'mm:ss'; self::$builtInFormats[46] = '[h]:mm:ss'; - self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0'; + self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0'; self::$builtInFormats[48] = '##0.0E+0'; self::$builtInFormats[49] = '@'; diff --git a/src/PhpSpreadsheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet.php index c2aff429..9d391ac4 100644 --- a/src/PhpSpreadsheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet.php @@ -2962,7 +2962,7 @@ class Worksheet implements IComparable if ($this->getCodeName() == $pValue) { return $this; } - $pValue = str_replace(' ', '_', $pValue);//Excel does this automatically without flinching, we are doing the same + $pValue = str_replace(' ', '_', $pValue); //Excel does this automatically without flinching, we are doing the same // Syntax check // throw an exception if not valid self::checkSheetCodeName($pValue); @@ -2991,7 +2991,7 @@ class Worksheet implements IComparable } } - $pValue = $pValue . '_' . $i;// ok, we have a valid name + $pValue = $pValue . '_' . $i; // ok, we have a valid name //codeName is'nt used in formula : no need to call for an update //return $this->setTitle($altTitle, $updateFormulaCellReferences); } diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 01886612..06382ed9 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -456,7 +456,7 @@ class AutoFilter * @var array */ private static $fromReplace = ['\*', '\?', '~~', '~.*', '~.?']; - private static $toReplace = ['.*', '.', '~', '\*', '\?']; + private static $toReplace = ['.*', '.', '~', '\*', '\?']; /** * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index 3a79c1c8..06734b16 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -137,8 +137,7 @@ class BaseDrawing implements \PhpSpreadsheet\IComparable $this->rotation = 0; $this->shadow = new Drawing\Shadow(); - // Set image index - ++self::$imageCounter; + // Set image index++self::$imageCounter; $this->imageIndex = self::$imageCounter; } diff --git a/src/PhpSpreadsheet/Writer/CSV.php b/src/PhpSpreadsheet/Writer/CSV.php index c3e4152a..c304d564 100644 --- a/src/PhpSpreadsheet/Writer/CSV.php +++ b/src/PhpSpreadsheet/Writer/CSV.php @@ -116,10 +116,10 @@ class CSV extends BaseWriter implements IWriter } if ($this->excelCompatibility) { - $this->setUseBOM(true); // Enforce UTF-8 BOM Header - $this->setIncludeSeparatorLine(true); // Set separator line - $this->setEnclosure('"'); // Set enclosure to " - $this->setDelimiter(';'); // Set delimiter to a semi-colon + $this->setUseBOM(true); // Enforce UTF-8 BOM Header + $this->setIncludeSeparatorLine(true); // Set separator line + $this->setEnclosure('"'); // Set enclosure to " + $this->setDelimiter(';'); // Set delimiter to a semi-colon $this->setLineEnding("\r\n"); } if ($this->useBOM) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007.php b/src/PhpSpreadsheet/Writer/Excel2007.php index be64d163..1008cf09 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007.php +++ b/src/PhpSpreadsheet/Writer/Excel2007.php @@ -139,8 +139,8 @@ class Excel2007 extends BaseWriter implements IWriter $this->writerParts[$writer] = new $class($this); } - $hashTablesArray = ['stylesConditionalHashTable', 'fillHashTable', 'fontHashTable', - 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable', + $hashTablesArray = ['stylesConditionalHashTable', 'fillHashTable', 'fontHashTable', + 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable', 'styleHashTable', ]; @@ -237,7 +237,7 @@ class Excel2007 extends BaseWriter implements IWriter $macrosCode = $this->spreadSheet->getMacrosCode(); if (!is_null($macrosCode)) { // we have the code ? - $objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin + $objZip->addFromString('xl/vbaProject.bin', $macrosCode); //allways in 'xl', allways named vbaProject.bin if ($this->spreadSheet->hasMacrosCertificate()) { //signed macros ? // Yes : add the certificate file and the related rels file @@ -252,7 +252,7 @@ class Excel2007 extends BaseWriter implements IWriter $objZip->addFromString($tmpRibbonTarget, $this->spreadSheet->getRibbonXMLData('data')); if ($this->spreadSheet->hasRibbonBinObjects()) { $tmpRootPath = dirname($tmpRibbonTarget) . '/'; - $ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data');//the files to write + $ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data'); //the files to write foreach ($ribbonBinObjects as $aPath => $aContent) { $objZip->addFromString($tmpRootPath . $aPath, $aContent); } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php index 08463c1c..9b34cdc6 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php @@ -157,7 +157,7 @@ class ContentTypes extends WriterPart // we need to write "Extension" but not already write for media content $tabRibbonTypes = array_diff($spreadsheet->getRibbonBinObjects('types'), array_keys($aMediaContentTypes)); foreach ($tabRibbonTypes as $aRibbonType) { - $mimeType = 'image/.' . $aRibbonType;//we wrote $mimeType like customUI Editor + $mimeType = 'image/.' . $aRibbonType; //we wrote $mimeType like customUI Editor $this->writeDefaultContentType($objWriter, $aRibbonType, $mimeType); } } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Rels.php b/src/PhpSpreadsheet/Writer/Excel2007/Rels.php index 67214d01..03f6b573 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Rels.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Rels.php @@ -166,7 +166,7 @@ class Rels extends WriterPart 'http://schemas.microsoft.com/office/2006/relationships/vbaProject', 'vbaProject.bin' ); - ++$i;//increment i if needed for an another relation + ++$i; //increment i if needed for an another relation } $objWriter->endElement(); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php b/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php index c4651ba5..1c7549b0 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php @@ -40,7 +40,7 @@ class StringTable extends WriterPart // Create string lookup table $aStringTable = []; $cellCollection = null; - $aFlippedStringTable = null; // For faster lookup + $aFlippedStringTable = null; // For faster lookup // Is an existing table given? if (($pExistingTable !== null) && is_array($pExistingTable)) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Style.php b/src/PhpSpreadsheet/Writer/Excel2007/Style.php index 868138fc..9db42e6f 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Style.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Style.php @@ -621,7 +621,7 @@ class Style extends WriterPart /** @var \PhpSpreadsheet\Style $style */ foreach ($aStyles as $style) { if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) { - $aFills[ $style->getFill()->getHashCode() ] = $style->getFill(); + $aFills[$style->getFill()->getHashCode()] = $style->getFill(); } } @@ -644,7 +644,7 @@ class Style extends WriterPart /** @var \PhpSpreadsheet\Style $style */ foreach ($aStyles as $style) { if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) { - $aFonts[ $style->getFont()->getHashCode() ] = $style->getFont(); + $aFonts[$style->getFont()->getHashCode()] = $style->getFont(); } } @@ -667,7 +667,7 @@ class Style extends WriterPart /** @var \PhpSpreadsheet\Style $style */ foreach ($aStyles as $style) { if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) { - $aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders(); + $aBorders[$style->getBorders()->getHashCode()] = $style->getBorders(); } } @@ -690,7 +690,7 @@ class Style extends WriterPart /** @var \PhpSpreadsheet\Style $style */ foreach ($aStyles as $style) { if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) { - $aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat(); + $aNumFmts[$style->getNumberFormat()->getHashCode()] = $style->getNumberFormat(); } } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php b/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php index ea886c21..b4ee976b 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php @@ -566,10 +566,10 @@ class Worksheet extends WriterPart $objWriter->writeAttribute('operator', $dv->getOperator()); } - $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0')); - $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0')); - $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0')); - $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0')); + $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0')); + $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0')); + $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0')); + $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0')); if ($dv->getErrorTitle() !== '') { $objWriter->writeAttribute('errorTitle', $dv->getErrorTitle()); @@ -707,7 +707,7 @@ class Worksheet extends WriterPart // printOptions $objWriter->startElement('printOptions'); - $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false')); + $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true' : 'false')); $objWriter->writeAttribute('gridLinesSet', 'true'); if ($pSheet->getPageSetup()->getHorizontalCentered()) { @@ -800,7 +800,7 @@ class Worksheet extends WriterPart // Top 10 Filter Rule $objWriter->writeAttribute('val', $rule->getValue()); $objWriter->writeAttribute('percent', (($rule->getOperator() === \PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0')); - $objWriter->writeAttribute('top', (($rule->getGrouping() === \PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0')); + $objWriter->writeAttribute('top', (($rule->getGrouping() === \PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1' : '0')); } else { // Filter, DateGroupItem or CustomFilter $objWriter->startElement($rule->getRuleType()); @@ -1079,8 +1079,7 @@ class Worksheet extends WriterPart break; case 'f': // Formula $calculatedValue = ($this->getParentWriter()->getPreCalculateFormulas()) ? - $pCell->getCalculatedValue() : - $cellValue; + $pCell->getCalculatedValue() : $cellValue; if (is_string($calculatedValue)) { $objWriter->writeAttribute('t', 'str'); } diff --git a/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php index a5230aa2..c04204d9 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php @@ -110,9 +110,9 @@ class BIFFwriter $teststr = pack('d', 1.2345); $number = pack('C8', 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F); if ($number == $teststr) { - $byte_order = 0; // Little Endian + $byte_order = 0; // Little Endian } elseif ($number == strrev($teststr)) { - $byte_order = 1; // Big Endian + $byte_order = 1; // Big Endian } else { // Give up. I'll fix this in a later version. throw new \PhpSpreadsheet\Writer\Exception('Required floating point format not supported on this platform.'); @@ -162,16 +162,16 @@ class BIFFwriter */ protected function storeBof($type) { - $record = 0x0809; // Record identifier (BIFF5-BIFF8) + $record = 0x0809; // Record identifier (BIFF5-BIFF8) $length = 0x0010; // by inspection of real files, MS Office Excel 2007 writes the following $unknown = pack('VV', 0x000100D1, 0x00000406); - $build = 0x0DBB; // Excel 97 - $year = 0x07CC; // Excel 97 + $build = 0x0DBB; // Excel 97 + $year = 0x07CC; // Excel 97 - $version = 0x0600; // BIFF8 + $version = 0x0600; // BIFF8 $header = pack('vv', $record, $length); $data = pack('vvvv', $version, $type, $build, $year); @@ -183,8 +183,8 @@ class BIFFwriter */ protected function storeEof() { - $record = 0x000A; // Record identifier - $length = 0x0000; // Number of bytes to follow + $record = 0x000A; // Record identifier + $length = 0x0000; // Number of bytes to follow $header = pack('vv', $record, $length); $this->append($header); @@ -195,8 +195,8 @@ class BIFFwriter */ public function writeEof() { - $record = 0x000A; // Record identifier - $length = 0x0000; // Number of bytes to follow + $record = 0x000A; // Record identifier + $length = 0x0000; // Number of bytes to follow $header = pack('vv', $record, $length); return $this->writeData($header); @@ -216,13 +216,13 @@ class BIFFwriter private function addContinue($data) { $limit = $this->limit; - $record = 0x003C; // Record identifier + $record = 0x003C; // Record identifier // The first 2080/8224 bytes remain intact. However, we have to change // the length field of the record. $tmp = substr($data, 0, 2) . pack('v', $limit) . substr($data, 4, $limit); - $header = pack('vv', $record, $limit); // Headers for continue records + $header = pack('vv', $record, $limit); // Headers for continue records // Retrieve chunks of 2080/8224 bytes +4 for the header. $data_length = strlen($data); diff --git a/src/PhpSpreadsheet/Writer/Excel5/Parser.php b/src/PhpSpreadsheet/Writer/Excel5/Parser.php index e89da216..133484b0 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Parser.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Parser.php @@ -114,11 +114,11 @@ class Parser public function __construct() { $this->currentCharacter = 0; - $this->currentToken = ''; // The token we are working on. - $this->formula = ''; // The formula to parse. - $this->lookAhead = ''; // The character ahead of the current char. - $this->parseTree = ''; // The parse tree to be generated. - $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's + $this->currentToken = ''; // The token we are working on. + $this->formula = ''; // The formula to parse. + $this->lookAhead = ''; // The character ahead of the current char. + $this->parseTree = ''; // The parse tree to be generated. + $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's $this->externalSheets = []; $this->references = []; } @@ -242,256 +242,256 @@ class Parser // $this->functions = [ // function ptg args class vol - 'COUNT' => [0, -1, 0, 0], - 'IF' => [1, -1, 1, 0], - 'ISNA' => [2, 1, 1, 0], - 'ISERROR' => [3, 1, 1, 0], - 'SUM' => [4, -1, 0, 0], - 'AVERAGE' => [5, -1, 0, 0], - 'MIN' => [6, -1, 0, 0], - 'MAX' => [7, -1, 0, 0], - 'ROW' => [8, -1, 0, 0], - 'COLUMN' => [9, -1, 0, 0], - 'NA' => [10, 0, 0, 0], - 'NPV' => [11, -1, 1, 0], - 'STDEV' => [12, -1, 0, 0], - 'DOLLAR' => [13, -1, 1, 0], - 'FIXED' => [14, -1, 1, 0], - 'SIN' => [15, 1, 1, 0], - 'COS' => [16, 1, 1, 0], - 'TAN' => [17, 1, 1, 0], - 'ATAN' => [18, 1, 1, 0], - 'PI' => [19, 0, 1, 0], - 'SQRT' => [20, 1, 1, 0], - 'EXP' => [21, 1, 1, 0], - 'LN' => [22, 1, 1, 0], - 'LOG10' => [23, 1, 1, 0], - 'ABS' => [24, 1, 1, 0], - 'INT' => [25, 1, 1, 0], - 'SIGN' => [26, 1, 1, 0], - 'ROUND' => [27, 2, 1, 0], - 'LOOKUP' => [28, -1, 0, 0], - 'INDEX' => [29, -1, 0, 1], - 'REPT' => [30, 2, 1, 0], - 'MID' => [31, 3, 1, 0], - 'LEN' => [32, 1, 1, 0], - 'VALUE' => [33, 1, 1, 0], - 'TRUE' => [34, 0, 1, 0], - 'FALSE' => [35, 0, 1, 0], - 'AND' => [36, -1, 0, 0], - 'OR' => [37, -1, 0, 0], - 'NOT' => [38, 1, 1, 0], - 'MOD' => [39, 2, 1, 0], - 'DCOUNT' => [40, 3, 0, 0], - 'DSUM' => [41, 3, 0, 0], - 'DAVERAGE' => [42, 3, 0, 0], - 'DMIN' => [43, 3, 0, 0], - 'DMAX' => [44, 3, 0, 0], - 'DSTDEV' => [45, 3, 0, 0], - 'VAR' => [46, -1, 0, 0], - 'DVAR' => [47, 3, 0, 0], - 'TEXT' => [48, 2, 1, 0], - 'LINEST' => [49, -1, 0, 0], - 'TREND' => [50, -1, 0, 0], - 'LOGEST' => [51, -1, 0, 0], - 'GROWTH' => [52, -1, 0, 0], - 'PV' => [56, -1, 1, 0], - 'FV' => [57, -1, 1, 0], - 'NPER' => [58, -1, 1, 0], - 'PMT' => [59, -1, 1, 0], - 'RATE' => [60, -1, 1, 0], - 'MIRR' => [61, 3, 0, 0], - 'IRR' => [62, -1, 0, 0], - 'RAND' => [63, 0, 1, 1], - 'MATCH' => [64, -1, 0, 0], - 'DATE' => [65, 3, 1, 0], - 'TIME' => [66, 3, 1, 0], - 'DAY' => [67, 1, 1, 0], - 'MONTH' => [68, 1, 1, 0], - 'YEAR' => [69, 1, 1, 0], - 'WEEKDAY' => [70, -1, 1, 0], - 'HOUR' => [71, 1, 1, 0], - 'MINUTE' => [72, 1, 1, 0], - 'SECOND' => [73, 1, 1, 0], - 'NOW' => [74, 0, 1, 1], - 'AREAS' => [75, 1, 0, 1], - 'ROWS' => [76, 1, 0, 1], - 'COLUMNS' => [77, 1, 0, 1], - 'OFFSET' => [78, -1, 0, 1], - 'SEARCH' => [82, -1, 1, 0], - 'TRANSPOSE' => [83, 1, 1, 0], - 'TYPE' => [86, 1, 1, 0], - 'ATAN2' => [97, 2, 1, 0], - 'ASIN' => [98, 1, 1, 0], - 'ACOS' => [99, 1, 1, 0], - 'CHOOSE' => [100, -1, 1, 0], - 'HLOOKUP' => [101, -1, 0, 0], - 'VLOOKUP' => [102, -1, 0, 0], - 'ISREF' => [105, 1, 0, 0], - 'LOG' => [109, -1, 1, 0], - 'CHAR' => [111, 1, 1, 0], - 'LOWER' => [112, 1, 1, 0], - 'UPPER' => [113, 1, 1, 0], - 'PROPER' => [114, 1, 1, 0], - 'LEFT' => [115, -1, 1, 0], - 'RIGHT' => [116, -1, 1, 0], - 'EXACT' => [117, 2, 1, 0], - 'TRIM' => [118, 1, 1, 0], - 'REPLACE' => [119, 4, 1, 0], - 'SUBSTITUTE' => [120, -1, 1, 0], - 'CODE' => [121, 1, 1, 0], - 'FIND' => [124, -1, 1, 0], - 'CELL' => [125, -1, 0, 1], - 'ISERR' => [126, 1, 1, 0], - 'ISTEXT' => [127, 1, 1, 0], - 'ISNUMBER' => [128, 1, 1, 0], - 'ISBLANK' => [129, 1, 1, 0], - 'T' => [130, 1, 0, 0], - 'N' => [131, 1, 0, 0], - 'DATEVALUE' => [140, 1, 1, 0], - 'TIMEVALUE' => [141, 1, 1, 0], - 'SLN' => [142, 3, 1, 0], - 'SYD' => [143, 4, 1, 0], - 'DDB' => [144, -1, 1, 0], - 'INDIRECT' => [148, -1, 1, 1], - 'CALL' => [150, -1, 1, 0], - 'CLEAN' => [162, 1, 1, 0], - 'MDETERM' => [163, 1, 2, 0], - 'MINVERSE' => [164, 1, 2, 0], - 'MMULT' => [165, 2, 2, 0], - 'IPMT' => [167, -1, 1, 0], - 'PPMT' => [168, -1, 1, 0], - 'COUNTA' => [169, -1, 0, 0], - 'PRODUCT' => [183, -1, 0, 0], - 'FACT' => [184, 1, 1, 0], - 'DPRODUCT' => [189, 3, 0, 0], - 'ISNONTEXT' => [190, 1, 1, 0], - 'STDEVP' => [193, -1, 0, 0], - 'VARP' => [194, -1, 0, 0], - 'DSTDEVP' => [195, 3, 0, 0], - 'DVARP' => [196, 3, 0, 0], - 'TRUNC' => [197, -1, 1, 0], - 'ISLOGICAL' => [198, 1, 1, 0], - 'DCOUNTA' => [199, 3, 0, 0], - 'USDOLLAR' => [204, -1, 1, 0], - 'FINDB' => [205, -1, 1, 0], - 'SEARCHB' => [206, -1, 1, 0], - 'REPLACEB' => [207, 4, 1, 0], - 'LEFTB' => [208, -1, 1, 0], - 'RIGHTB' => [209, -1, 1, 0], - 'MIDB' => [210, 3, 1, 0], - 'LENB' => [211, 1, 1, 0], - 'ROUNDUP' => [212, 2, 1, 0], - 'ROUNDDOWN' => [213, 2, 1, 0], - 'ASC' => [214, 1, 1, 0], - 'DBCS' => [215, 1, 1, 0], - 'RANK' => [216, -1, 0, 0], - 'ADDRESS' => [219, -1, 1, 0], - 'DAYS360' => [220, -1, 1, 0], - 'TODAY' => [221, 0, 1, 1], - 'VDB' => [222, -1, 1, 0], - 'MEDIAN' => [227, -1, 0, 0], - 'SUMPRODUCT' => [228, -1, 2, 0], - 'SINH' => [229, 1, 1, 0], - 'COSH' => [230, 1, 1, 0], - 'TANH' => [231, 1, 1, 0], - 'ASINH' => [232, 1, 1, 0], - 'ACOSH' => [233, 1, 1, 0], - 'ATANH' => [234, 1, 1, 0], - 'DGET' => [235, 3, 0, 0], - 'INFO' => [244, 1, 1, 1], - 'DB' => [247, -1, 1, 0], - 'FREQUENCY' => [252, 2, 0, 0], - 'ERROR.TYPE' => [261, 1, 1, 0], - 'REGISTER.ID' => [267, -1, 1, 0], - 'AVEDEV' => [269, -1, 0, 0], - 'BETADIST' => [270, -1, 1, 0], - 'GAMMALN' => [271, 1, 1, 0], - 'BETAINV' => [272, -1, 1, 0], - 'BINOMDIST' => [273, 4, 1, 0], - 'CHIDIST' => [274, 2, 1, 0], - 'CHIINV' => [275, 2, 1, 0], - 'COMBIN' => [276, 2, 1, 0], - 'CONFIDENCE' => [277, 3, 1, 0], - 'CRITBINOM' => [278, 3, 1, 0], - 'EVEN' => [279, 1, 1, 0], - 'EXPONDIST' => [280, 3, 1, 0], - 'FDIST' => [281, 3, 1, 0], - 'FINV' => [282, 3, 1, 0], - 'FISHER' => [283, 1, 1, 0], - 'FISHERINV' => [284, 1, 1, 0], - 'FLOOR' => [285, 2, 1, 0], - 'GAMMADIST' => [286, 4, 1, 0], - 'GAMMAINV' => [287, 3, 1, 0], - 'CEILING' => [288, 2, 1, 0], - 'HYPGEOMDIST' => [289, 4, 1, 0], - 'LOGNORMDIST' => [290, 3, 1, 0], - 'LOGINV' => [291, 3, 1, 0], - 'NEGBINOMDIST' => [292, 3, 1, 0], - 'NORMDIST' => [293, 4, 1, 0], - 'NORMSDIST' => [294, 1, 1, 0], - 'NORMINV' => [295, 3, 1, 0], - 'NORMSINV' => [296, 1, 1, 0], - 'STANDARDIZE' => [297, 3, 1, 0], - 'ODD' => [298, 1, 1, 0], - 'PERMUT' => [299, 2, 1, 0], - 'POISSON' => [300, 3, 1, 0], - 'TDIST' => [301, 3, 1, 0], - 'WEIBULL' => [302, 4, 1, 0], - 'SUMXMY2' => [303, 2, 2, 0], - 'SUMX2MY2' => [304, 2, 2, 0], - 'SUMX2PY2' => [305, 2, 2, 0], - 'CHITEST' => [306, 2, 2, 0], - 'CORREL' => [307, 2, 2, 0], - 'COVAR' => [308, 2, 2, 0], - 'FORECAST' => [309, 3, 2, 0], - 'FTEST' => [310, 2, 2, 0], - 'INTERCEPT' => [311, 2, 2, 0], - 'PEARSON' => [312, 2, 2, 0], - 'RSQ' => [313, 2, 2, 0], - 'STEYX' => [314, 2, 2, 0], - 'SLOPE' => [315, 2, 2, 0], - 'TTEST' => [316, 4, 2, 0], - 'PROB' => [317, -1, 2, 0], - 'DEVSQ' => [318, -1, 0, 0], - 'GEOMEAN' => [319, -1, 0, 0], - 'HARMEAN' => [320, -1, 0, 0], - 'SUMSQ' => [321, -1, 0, 0], - 'KURT' => [322, -1, 0, 0], - 'SKEW' => [323, -1, 0, 0], - 'ZTEST' => [324, -1, 0, 0], - 'LARGE' => [325, 2, 0, 0], - 'SMALL' => [326, 2, 0, 0], - 'QUARTILE' => [327, 2, 0, 0], - 'PERCENTILE' => [328, 2, 0, 0], - 'PERCENTRANK' => [329, -1, 0, 0], - 'MODE' => [330, -1, 2, 0], - 'TRIMMEAN' => [331, 2, 0, 0], - 'TINV' => [332, 2, 1, 0], - 'CONCATENATE' => [336, -1, 1, 0], - 'POWER' => [337, 2, 1, 0], - 'RADIANS' => [342, 1, 1, 0], - 'DEGREES' => [343, 1, 1, 0], - 'SUBTOTAL' => [344, -1, 0, 0], - 'SUMIF' => [345, -1, 0, 0], - 'COUNTIF' => [346, 2, 0, 0], - 'COUNTBLANK' => [347, 1, 0, 0], - 'ISPMT' => [350, 4, 1, 0], - 'DATEDIF' => [351, 3, 1, 0], - 'DATESTRING' => [352, 1, 1, 0], - 'NUMBERSTRING' => [353, 2, 1, 0], - 'ROMAN' => [354, -1, 1, 0], - 'GETPIVOTDATA' => [358, -1, 0, 0], - 'HYPERLINK' => [359, -1, 1, 0], - 'PHONETIC' => [360, 1, 0, 0], - 'AVERAGEA' => [361, -1, 0, 0], - 'MAXA' => [362, -1, 0, 0], - 'MINA' => [363, -1, 0, 0], - 'STDEVPA' => [364, -1, 0, 0], - 'VARPA' => [365, -1, 0, 0], - 'STDEVA' => [366, -1, 0, 0], - 'VARA' => [367, -1, 0, 0], - 'BAHTTEXT' => [368, 1, 0, 0], + 'COUNT' => [0, -1, 0, 0], + 'IF' => [1, -1, 1, 0], + 'ISNA' => [2, 1, 1, 0], + 'ISERROR' => [3, 1, 1, 0], + 'SUM' => [4, -1, 0, 0], + 'AVERAGE' => [5, -1, 0, 0], + 'MIN' => [6, -1, 0, 0], + 'MAX' => [7, -1, 0, 0], + 'ROW' => [8, -1, 0, 0], + 'COLUMN' => [9, -1, 0, 0], + 'NA' => [10, 0, 0, 0], + 'NPV' => [11, -1, 1, 0], + 'STDEV' => [12, -1, 0, 0], + 'DOLLAR' => [13, -1, 1, 0], + 'FIXED' => [14, -1, 1, 0], + 'SIN' => [15, 1, 1, 0], + 'COS' => [16, 1, 1, 0], + 'TAN' => [17, 1, 1, 0], + 'ATAN' => [18, 1, 1, 0], + 'PI' => [19, 0, 1, 0], + 'SQRT' => [20, 1, 1, 0], + 'EXP' => [21, 1, 1, 0], + 'LN' => [22, 1, 1, 0], + 'LOG10' => [23, 1, 1, 0], + 'ABS' => [24, 1, 1, 0], + 'INT' => [25, 1, 1, 0], + 'SIGN' => [26, 1, 1, 0], + 'ROUND' => [27, 2, 1, 0], + 'LOOKUP' => [28, -1, 0, 0], + 'INDEX' => [29, -1, 0, 1], + 'REPT' => [30, 2, 1, 0], + 'MID' => [31, 3, 1, 0], + 'LEN' => [32, 1, 1, 0], + 'VALUE' => [33, 1, 1, 0], + 'TRUE' => [34, 0, 1, 0], + 'FALSE' => [35, 0, 1, 0], + 'AND' => [36, -1, 0, 0], + 'OR' => [37, -1, 0, 0], + 'NOT' => [38, 1, 1, 0], + 'MOD' => [39, 2, 1, 0], + 'DCOUNT' => [40, 3, 0, 0], + 'DSUM' => [41, 3, 0, 0], + 'DAVERAGE' => [42, 3, 0, 0], + 'DMIN' => [43, 3, 0, 0], + 'DMAX' => [44, 3, 0, 0], + 'DSTDEV' => [45, 3, 0, 0], + 'VAR' => [46, -1, 0, 0], + 'DVAR' => [47, 3, 0, 0], + 'TEXT' => [48, 2, 1, 0], + 'LINEST' => [49, -1, 0, 0], + 'TREND' => [50, -1, 0, 0], + 'LOGEST' => [51, -1, 0, 0], + 'GROWTH' => [52, -1, 0, 0], + 'PV' => [56, -1, 1, 0], + 'FV' => [57, -1, 1, 0], + 'NPER' => [58, -1, 1, 0], + 'PMT' => [59, -1, 1, 0], + 'RATE' => [60, -1, 1, 0], + 'MIRR' => [61, 3, 0, 0], + 'IRR' => [62, -1, 0, 0], + 'RAND' => [63, 0, 1, 1], + 'MATCH' => [64, -1, 0, 0], + 'DATE' => [65, 3, 1, 0], + 'TIME' => [66, 3, 1, 0], + 'DAY' => [67, 1, 1, 0], + 'MONTH' => [68, 1, 1, 0], + 'YEAR' => [69, 1, 1, 0], + 'WEEKDAY' => [70, -1, 1, 0], + 'HOUR' => [71, 1, 1, 0], + 'MINUTE' => [72, 1, 1, 0], + 'SECOND' => [73, 1, 1, 0], + 'NOW' => [74, 0, 1, 1], + 'AREAS' => [75, 1, 0, 1], + 'ROWS' => [76, 1, 0, 1], + 'COLUMNS' => [77, 1, 0, 1], + 'OFFSET' => [78, -1, 0, 1], + 'SEARCH' => [82, -1, 1, 0], + 'TRANSPOSE' => [83, 1, 1, 0], + 'TYPE' => [86, 1, 1, 0], + 'ATAN2' => [97, 2, 1, 0], + 'ASIN' => [98, 1, 1, 0], + 'ACOS' => [99, 1, 1, 0], + 'CHOOSE' => [100, -1, 1, 0], + 'HLOOKUP' => [101, -1, 0, 0], + 'VLOOKUP' => [102, -1, 0, 0], + 'ISREF' => [105, 1, 0, 0], + 'LOG' => [109, -1, 1, 0], + 'CHAR' => [111, 1, 1, 0], + 'LOWER' => [112, 1, 1, 0], + 'UPPER' => [113, 1, 1, 0], + 'PROPER' => [114, 1, 1, 0], + 'LEFT' => [115, -1, 1, 0], + 'RIGHT' => [116, -1, 1, 0], + 'EXACT' => [117, 2, 1, 0], + 'TRIM' => [118, 1, 1, 0], + 'REPLACE' => [119, 4, 1, 0], + 'SUBSTITUTE' => [120, -1, 1, 0], + 'CODE' => [121, 1, 1, 0], + 'FIND' => [124, -1, 1, 0], + 'CELL' => [125, -1, 0, 1], + 'ISERR' => [126, 1, 1, 0], + 'ISTEXT' => [127, 1, 1, 0], + 'ISNUMBER' => [128, 1, 1, 0], + 'ISBLANK' => [129, 1, 1, 0], + 'T' => [130, 1, 0, 0], + 'N' => [131, 1, 0, 0], + 'DATEVALUE' => [140, 1, 1, 0], + 'TIMEVALUE' => [141, 1, 1, 0], + 'SLN' => [142, 3, 1, 0], + 'SYD' => [143, 4, 1, 0], + 'DDB' => [144, -1, 1, 0], + 'INDIRECT' => [148, -1, 1, 1], + 'CALL' => [150, -1, 1, 0], + 'CLEAN' => [162, 1, 1, 0], + 'MDETERM' => [163, 1, 2, 0], + 'MINVERSE' => [164, 1, 2, 0], + 'MMULT' => [165, 2, 2, 0], + 'IPMT' => [167, -1, 1, 0], + 'PPMT' => [168, -1, 1, 0], + 'COUNTA' => [169, -1, 0, 0], + 'PRODUCT' => [183, -1, 0, 0], + 'FACT' => [184, 1, 1, 0], + 'DPRODUCT' => [189, 3, 0, 0], + 'ISNONTEXT' => [190, 1, 1, 0], + 'STDEVP' => [193, -1, 0, 0], + 'VARP' => [194, -1, 0, 0], + 'DSTDEVP' => [195, 3, 0, 0], + 'DVARP' => [196, 3, 0, 0], + 'TRUNC' => [197, -1, 1, 0], + 'ISLOGICAL' => [198, 1, 1, 0], + 'DCOUNTA' => [199, 3, 0, 0], + 'USDOLLAR' => [204, -1, 1, 0], + 'FINDB' => [205, -1, 1, 0], + 'SEARCHB' => [206, -1, 1, 0], + 'REPLACEB' => [207, 4, 1, 0], + 'LEFTB' => [208, -1, 1, 0], + 'RIGHTB' => [209, -1, 1, 0], + 'MIDB' => [210, 3, 1, 0], + 'LENB' => [211, 1, 1, 0], + 'ROUNDUP' => [212, 2, 1, 0], + 'ROUNDDOWN' => [213, 2, 1, 0], + 'ASC' => [214, 1, 1, 0], + 'DBCS' => [215, 1, 1, 0], + 'RANK' => [216, -1, 0, 0], + 'ADDRESS' => [219, -1, 1, 0], + 'DAYS360' => [220, -1, 1, 0], + 'TODAY' => [221, 0, 1, 1], + 'VDB' => [222, -1, 1, 0], + 'MEDIAN' => [227, -1, 0, 0], + 'SUMPRODUCT' => [228, -1, 2, 0], + 'SINH' => [229, 1, 1, 0], + 'COSH' => [230, 1, 1, 0], + 'TANH' => [231, 1, 1, 0], + 'ASINH' => [232, 1, 1, 0], + 'ACOSH' => [233, 1, 1, 0], + 'ATANH' => [234, 1, 1, 0], + 'DGET' => [235, 3, 0, 0], + 'INFO' => [244, 1, 1, 1], + 'DB' => [247, -1, 1, 0], + 'FREQUENCY' => [252, 2, 0, 0], + 'ERROR.TYPE' => [261, 1, 1, 0], + 'REGISTER.ID' => [267, -1, 1, 0], + 'AVEDEV' => [269, -1, 0, 0], + 'BETADIST' => [270, -1, 1, 0], + 'GAMMALN' => [271, 1, 1, 0], + 'BETAINV' => [272, -1, 1, 0], + 'BINOMDIST' => [273, 4, 1, 0], + 'CHIDIST' => [274, 2, 1, 0], + 'CHIINV' => [275, 2, 1, 0], + 'COMBIN' => [276, 2, 1, 0], + 'CONFIDENCE' => [277, 3, 1, 0], + 'CRITBINOM' => [278, 3, 1, 0], + 'EVEN' => [279, 1, 1, 0], + 'EXPONDIST' => [280, 3, 1, 0], + 'FDIST' => [281, 3, 1, 0], + 'FINV' => [282, 3, 1, 0], + 'FISHER' => [283, 1, 1, 0], + 'FISHERINV' => [284, 1, 1, 0], + 'FLOOR' => [285, 2, 1, 0], + 'GAMMADIST' => [286, 4, 1, 0], + 'GAMMAINV' => [287, 3, 1, 0], + 'CEILING' => [288, 2, 1, 0], + 'HYPGEOMDIST' => [289, 4, 1, 0], + 'LOGNORMDIST' => [290, 3, 1, 0], + 'LOGINV' => [291, 3, 1, 0], + 'NEGBINOMDIST' => [292, 3, 1, 0], + 'NORMDIST' => [293, 4, 1, 0], + 'NORMSDIST' => [294, 1, 1, 0], + 'NORMINV' => [295, 3, 1, 0], + 'NORMSINV' => [296, 1, 1, 0], + 'STANDARDIZE' => [297, 3, 1, 0], + 'ODD' => [298, 1, 1, 0], + 'PERMUT' => [299, 2, 1, 0], + 'POISSON' => [300, 3, 1, 0], + 'TDIST' => [301, 3, 1, 0], + 'WEIBULL' => [302, 4, 1, 0], + 'SUMXMY2' => [303, 2, 2, 0], + 'SUMX2MY2' => [304, 2, 2, 0], + 'SUMX2PY2' => [305, 2, 2, 0], + 'CHITEST' => [306, 2, 2, 0], + 'CORREL' => [307, 2, 2, 0], + 'COVAR' => [308, 2, 2, 0], + 'FORECAST' => [309, 3, 2, 0], + 'FTEST' => [310, 2, 2, 0], + 'INTERCEPT' => [311, 2, 2, 0], + 'PEARSON' => [312, 2, 2, 0], + 'RSQ' => [313, 2, 2, 0], + 'STEYX' => [314, 2, 2, 0], + 'SLOPE' => [315, 2, 2, 0], + 'TTEST' => [316, 4, 2, 0], + 'PROB' => [317, -1, 2, 0], + 'DEVSQ' => [318, -1, 0, 0], + 'GEOMEAN' => [319, -1, 0, 0], + 'HARMEAN' => [320, -1, 0, 0], + 'SUMSQ' => [321, -1, 0, 0], + 'KURT' => [322, -1, 0, 0], + 'SKEW' => [323, -1, 0, 0], + 'ZTEST' => [324, -1, 0, 0], + 'LARGE' => [325, 2, 0, 0], + 'SMALL' => [326, 2, 0, 0], + 'QUARTILE' => [327, 2, 0, 0], + 'PERCENTILE' => [328, 2, 0, 0], + 'PERCENTRANK' => [329, -1, 0, 0], + 'MODE' => [330, -1, 2, 0], + 'TRIMMEAN' => [331, 2, 0, 0], + 'TINV' => [332, 2, 1, 0], + 'CONCATENATE' => [336, -1, 1, 0], + 'POWER' => [337, 2, 1, 0], + 'RADIANS' => [342, 1, 1, 0], + 'DEGREES' => [343, 1, 1, 0], + 'SUBTOTAL' => [344, -1, 0, 0], + 'SUMIF' => [345, -1, 0, 0], + 'COUNTIF' => [346, 2, 0, 0], + 'COUNTBLANK' => [347, 1, 0, 0], + 'ISPMT' => [350, 4, 1, 0], + 'DATEDIF' => [351, 3, 1, 0], + 'DATESTRING' => [352, 1, 1, 0], + 'NUMBERSTRING' => [353, 2, 1, 0], + 'ROMAN' => [354, -1, 1, 0], + 'GETPIVOTDATA' => [358, -1, 0, 0], + 'HYPERLINK' => [359, -1, 1, 0], + 'PHONETIC' => [360, 1, 0, 0], + 'AVERAGEA' => [361, -1, 0, 0], + 'MAXA' => [362, -1, 0, 0], + 'MINA' => [363, -1, 0, 0], + 'STDEVPA' => [364, -1, 0, 0], + 'VARPA' => [365, -1, 0, 0], + 'STDEVA' => [366, -1, 0, 0], + 'VARA' => [367, -1, 0, 0], + 'BAHTTEXT' => [368, 1, 0, 0], ]; } @@ -1318,12 +1318,12 @@ class Parser private function fact() { if ($this->currentToken == '(') { - $this->advance(); // eat the "(" + $this->advance(); // eat the "(" $result = $this->parenthesizedExpression(); if ($this->currentToken != ')') { throw new \PhpSpreadsheet\Writer\Exception("')' token expected."); } - $this->advance(); // eat the ")" + $this->advance(); // eat the ")" return $result; } // if it's a reference @@ -1372,7 +1372,7 @@ class Parser // If it's a number or a percent if ($this->lookAhead == '%') { $result = $this->createTree('ptgPercent', $this->currentToken, ''); - $this->advance(); // Skip the percentage operator once we've pre-built that tree + $this->advance(); // Skip the percentage operator once we've pre-built that tree } else { $result = $this->createTree($this->currentToken, '', ''); } @@ -1400,12 +1400,12 @@ class Parser $function = strtoupper($this->currentToken); $result = ''; // initialize result $this->advance(); - $this->advance(); // eat the "(" + $this->advance(); // eat the "(" while ($this->currentToken != ')') { /**/ if ($num_args > 0) { if ($this->currentToken == ',' || $this->currentToken == ';') { - $this->advance(); // eat the "," or ";" + $this->advance(); // eat the "," or ";" } else { throw new \PhpSpreadsheet\Writer\Exception("Syntax error: comma expected in function $function, arg #{$num_args}"); } @@ -1427,7 +1427,7 @@ class Parser } $result = $this->createTree($function, $result, $num_args); - $this->advance(); // eat the ")" + $this->advance(); // eat the ")" return $result; } diff --git a/src/PhpSpreadsheet/Writer/Excel5/Workbook.php b/src/PhpSpreadsheet/Writer/Excel5/Workbook.php index 5e7b2631..c4b10382 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Workbook.php @@ -219,11 +219,11 @@ class Workbook extends BIFFwriter for ($i = 0; $i < $countSheets; ++$i) { $phpSheet = $spreadsheet->getSheet($i); - $this->parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser + $this->parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser $supbook_index = 0x00; $ref = pack('vvv', $supbook_index, $i, $i); - $this->parser->references[] = $ref; // Register reference with parser + $this->parser->references[] = $ref; // Register reference with parser // Sheet tab colors? if ($phpSheet->isTabColorSet()) { @@ -467,7 +467,7 @@ class Workbook extends BIFFwriter */ private function calcSheetOffsets() { - $boundsheet_length = 10; // fixed length for a BOUNDSHEET record + $boundsheet_length = 10; // fixed length for a BOUNDSHEET record // size of Workbook globals part 1 + 3 $offset = $this->_datasize; @@ -831,7 +831,7 @@ class Workbook extends BIFFwriter $record = 0x0018; // option flags - $options = ($isHidden ? 0x21 : 0x00); + $options = ($isHidden ? 0x21 : 0x00); $extra = pack( 'Cvvvvv', @@ -861,9 +861,9 @@ class Workbook extends BIFFwriter */ private function writeCodepage() { - $record = 0x0042; // Record identifier - $length = 0x0002; // Number of bytes to follow - $cv = $this->codepage; // The code page + $record = 0x0042; // Record identifier + $length = 0x0002; // Number of bytes to follow + $cv = $this->codepage; // The code page $header = pack('vv', $record, $length); $data = pack('v', $cv); @@ -876,24 +876,24 @@ class Workbook extends BIFFwriter */ private function writeWindow1() { - $record = 0x003D; // Record identifier - $length = 0x0012; // Number of bytes to follow + $record = 0x003D; // Record identifier + $length = 0x0012; // Number of bytes to follow - $xWn = 0x0000; // Horizontal position of window - $yWn = 0x0000; // Vertical position of window - $dxWn = 0x25BC; // Width of window - $dyWn = 0x1572; // Height of window + $xWn = 0x0000; // Horizontal position of window + $yWn = 0x0000; // Vertical position of window + $dxWn = 0x25BC; // Width of window + $dyWn = 0x1572; // Height of window - $grbit = 0x0038; // Option flags + $grbit = 0x0038; // Option flags // not supported by PhpSpreadsheet, so there is only one selected sheet, the active - $ctabsel = 1; // Number of workbook tabs selected + $ctabsel = 1; // Number of workbook tabs selected - $wTabRatio = 0x0258; // Tab to scrollbar ratio + $wTabRatio = 0x0258; // Tab to scrollbar ratio // not supported by PhpSpreadsheet, set to 0 - $itabFirst = 0; // 1st displayed worksheet - $itabCur = $this->spreadsheet->getActiveSheetIndex(); // Active worksheet + $itabFirst = 0; // 1st displayed worksheet + $itabCur = $this->spreadsheet->getActiveSheetIndex(); // Active worksheet $header = pack('vv', $record, $length); $data = pack('vvvvvvvvv', $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio); @@ -909,7 +909,7 @@ class Workbook extends BIFFwriter private function writeBoundSheet($sheet, $offset) { $sheetname = $sheet->getTitle(); - $record = 0x0085; // Record identifier + $record = 0x0085; // Record identifier // sheet state switch ($sheet->getSheetState()) { @@ -930,7 +930,7 @@ class Workbook extends BIFFwriter // sheet type $st = 0x00; - $grbit = 0x0000; // Visibility and sheet type + $grbit = 0x0000; // Visibility and sheet type $data = pack('VCC', $offset, $ss, $st); $data .= \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeShort($sheetname); @@ -945,8 +945,8 @@ class Workbook extends BIFFwriter */ private function writeSupbookInternal() { - $record = 0x01AE; // Record identifier - $length = 0x0004; // Bytes to follow + $record = 0x01AE; // Record identifier + $length = 0x0004; // Bytes to follow $header = pack('vv', $record, $length); $data = pack('vv', $this->spreadsheet->getSheetCount(), 0x0401); @@ -961,10 +961,10 @@ class Workbook extends BIFFwriter private function writeExternalsheetBiff8() { $totalReferences = count($this->parser->references); - $record = 0x0017; // Record identifier - $length = 2 + 6 * $totalReferences; // Number of bytes to follow + $record = 0x0017; // Record identifier + $length = 2 + 6 * $totalReferences; // 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); $data = pack('v', $totalReferences); for ($i = 0; $i < $totalReferences; ++$i) { @@ -979,12 +979,12 @@ class Workbook extends BIFFwriter */ private function writeStyle() { - $record = 0x0293; // Record identifier - $length = 0x0004; // Bytes to follow + $record = 0x0293; // Record identifier + $length = 0x0004; // Bytes to follow - $ixfe = 0x8000; // Index to cell style XF - $BuiltIn = 0x00; // Built-in style - $iLevel = 0xff; // Outline style level + $ixfe = 0x8000; // Index to cell style XF + $BuiltIn = 0x00; // Built-in style + $iLevel = 0xff; // Outline style level $header = pack('vv', $record, $length); $data = pack('vCC', $ixfe, $BuiltIn, $iLevel); @@ -999,10 +999,10 @@ class Workbook extends BIFFwriter */ private function writeNumberFormat($format, $ifmt) { - $record = 0x041E; // Record identifier + $record = 0x041E; // Record identifier $numberFormatString = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($format); - $length = 2 + strlen($numberFormatString); // Number of bytes to follow + $length = 2 + strlen($numberFormatString); // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('v', $ifmt) . $numberFormatString; @@ -1014,12 +1014,12 @@ class Workbook extends BIFFwriter */ private function writeDateMode() { - $record = 0x0022; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0022; // Record identifier + $length = 0x0002; // Bytes to follow $f1904 = (\PhpSpreadsheet\Shared\Date::getExcelCalendar() == \PhpSpreadsheet\Shared\Date::CALENDAR_MAC_1904) ? 1 - : 0; // Flag for 1904 date system + : 0; // Flag for 1904 date system $header = pack('vv', $record, $length); $data = pack('v', $f1904); @@ -1040,8 +1040,8 @@ class Workbook extends BIFFwriter */ private function writeExternalCount($cxals) { - $record = 0x0016; // Record identifier - $length = 0x0002; // Number of bytes to follow + $record = 0x0016; // Record identifier + $length = 0x0002; // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('v', $cxals); @@ -1059,11 +1059,11 @@ class Workbook extends BIFFwriter */ private function writeExternalSheet($sheetname) { - $record = 0x0017; // Record identifier - $length = 0x02 + strlen($sheetname); // Number of bytes to follow + $record = 0x0017; // Record identifier + $length = 0x02 + strlen($sheetname); // Number of bytes to follow - $cch = strlen($sheetname); // Length of sheet name - $rgch = 0x03; // Filename encoding + $cch = strlen($sheetname); // Length of sheet name + $rgch = 0x03; // Filename encoding $header = pack('vv', $record, $length); $data = pack('CC', $cch, $rgch); @@ -1083,20 +1083,20 @@ class Workbook extends BIFFwriter */ private function writeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax) { - $record = 0x0018; // Record identifier - $length = 0x0024; // Number of bytes to follow + $record = 0x0018; // Record identifier + $length = 0x0024; // Number of bytes to follow - $grbit = 0x0020; // Option flags - $chKey = 0x00; // Keyboard shortcut - $cch = 0x01; // Length of text name - $cce = 0x0015; // Length of text definition - $ixals = $index + 1; // Sheet index - $itab = $ixals; // Equal to ixals - $cchCustMenu = 0x00; // Length of cust menu text - $cchDescription = 0x00; // Length of description text - $cchHelptopic = 0x00; // Length of help topic text - $cchStatustext = 0x00; // Length of status bar text - $rgch = $type; // Built-in name type + $grbit = 0x0020; // Option flags + $chKey = 0x00; // Keyboard shortcut + $cch = 0x01; // Length of text name + $cce = 0x0015; // Length of text definition + $ixals = $index + 1; // Sheet index + $itab = $ixals; // Equal to ixals + $cchCustMenu = 0x00; // Length of cust menu text + $cchDescription = 0x00; // Length of description text + $cchHelptopic = 0x00; // Length of help topic text + $cchStatustext = 0x00; // Length of status bar text + $rgch = $type; // Built-in name type $unknown03 = 0x3b; $unknown04 = 0xffff - $index; @@ -1147,19 +1147,19 @@ class Workbook extends BIFFwriter */ private function writeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax) { - $record = 0x0018; // Record identifier - $length = 0x003d; // Number of bytes to follow - $grbit = 0x0020; // Option flags - $chKey = 0x00; // Keyboard shortcut - $cch = 0x01; // Length of text name - $cce = 0x002e; // Length of text definition - $ixals = $index + 1; // Sheet index - $itab = $ixals; // Equal to ixals - $cchCustMenu = 0x00; // Length of cust menu text - $cchDescription = 0x00; // Length of description text - $cchHelptopic = 0x00; // Length of help topic text - $cchStatustext = 0x00; // Length of status bar text - $rgch = $type; // Built-in name type + $record = 0x0018; // Record identifier + $length = 0x003d; // Number of bytes to follow + $grbit = 0x0020; // Option flags + $chKey = 0x00; // Keyboard shortcut + $cch = 0x01; // Length of text name + $cce = 0x002e; // Length of text definition + $ixals = $index + 1; // Sheet index + $itab = $ixals; // Equal to ixals + $cchCustMenu = 0x00; // Length of cust menu text + $cchDescription = 0x00; // Length of description text + $cchHelptopic = 0x00; // Length of help topic text + $cchStatustext = 0x00; // Length of status bar text + $rgch = $type; // Built-in name type $unknown01 = 0x29; $unknown02 = 0x002b; @@ -1222,8 +1222,8 @@ class Workbook extends BIFFwriter */ private function writeCountry() { - $record = 0x008C; // Record identifier - $length = 4; // Number of bytes to follow + $record = 0x008C; // Record identifier + $length = 4; // Number of bytes to follow $header = pack('vv', $record, $length); /* using the same country code always for simplicity */ @@ -1239,8 +1239,8 @@ class Workbook extends BIFFwriter */ private function writeRecalcId() { - $record = 0x01C1; // Record identifier - $length = 8; // Number of bytes to follow + $record = 0x01C1; // Record identifier + $length = 8; // Number of bytes to follow $header = pack('vv', $record, $length); @@ -1257,10 +1257,10 @@ class Workbook extends BIFFwriter { $aref = $this->palette; - $record = 0x0092; // Record identifier - $length = 2 + 4 * count($aref); // Number of bytes to follow - $ccv = count($aref); // Number of RGB values to follow - $data = ''; // The RGB data + $record = 0x0092; // Record identifier + $length = 2 + 4 * count($aref); // Number of bytes to follow + $ccv = count($aref); // Number of RGB values to follow + $data = ''; // The RGB data // Pack the RGB data foreach ($aref as $color) { diff --git a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php b/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php index 645aba5b..b4a48724 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php @@ -542,7 +542,7 @@ class Worksheet extends BIFFwriter } $firstCellCoordinates = \PhpSpreadsheet\Cell::coordinateFromString($firstCell); // e.g. array(0, 1) - $lastCellCoordinates = \PhpSpreadsheet\Cell::coordinateFromString($lastCell); // e.g. array(1, 6) + $lastCellCoordinates = \PhpSpreadsheet\Cell::coordinateFromString($lastCell); // e.g. array(1, 6) return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, \PhpSpreadsheet\Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, \PhpSpreadsheet\Cell::columnIndexFromString($lastCellCoordinates[0]) - 1); } @@ -616,8 +616,8 @@ class Worksheet extends BIFFwriter */ private function writeNumber($row, $col, $num, $xfIndex) { - $record = 0x0203; // Record identifier - $length = 0x000E; // Number of bytes to follow + $record = 0x0203; // Record identifier + $length = 0x000E; // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('vvv', $row, $col, $xfIndex); @@ -655,8 +655,8 @@ class Worksheet extends BIFFwriter */ private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) { - $record = 0x00FD; // Record identifier - $length = 0x000A; // Bytes to follow + $record = 0x00FD; // Record identifier + $length = 0x000A; // Bytes to follow $str = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun); /* check if string is already present */ @@ -687,8 +687,8 @@ class Worksheet extends BIFFwriter private function writeLabel($row, $col, $str, $xfIndex) { $strlen = strlen($str); - $record = 0x0204; // Record identifier - $length = 0x0008 + $strlen; // Bytes to follow + $record = 0x0204; // Record identifier + $length = 0x0008 + $strlen; // Bytes to follow $str_error = 0; @@ -722,8 +722,8 @@ class Worksheet extends BIFFwriter */ private function writeLabelSst($row, $col, $str, $xfIndex) { - $record = 0x00FD; // Record identifier - $length = 0x000A; // Bytes to follow + $record = 0x00FD; // Record identifier + $length = 0x000A; // Bytes to follow $str = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($str); @@ -749,8 +749,8 @@ class Worksheet extends BIFFwriter private function writeNote($row, $col, $note) { $note_length = strlen($note); - $record = 0x001C; // Record identifier - $max_length = 2048; // Maximun length for a NOTE record + $record = 0x001C; // Record identifier + $max_length = 2048; // Maximun length for a NOTE record // Length for this record is no more than 2048 + 6 $length = 0x0006 + min($note_length, 2048); @@ -787,8 +787,8 @@ class Worksheet extends BIFFwriter */ public function writeBlank($row, $col, $xfIndex) { - $record = 0x0201; // Record identifier - $length = 0x0006; // Number of bytes to follow + $record = 0x0201; // Record identifier + $length = 0x0006; // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('vvv', $row, $col, $xfIndex); @@ -836,7 +836,7 @@ class Worksheet extends BIFFwriter */ private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue) { - $record = 0x0006; // Record identifier + $record = 0x0006; // Record identifier // Initialize possible additional value for STRING record that should be written after the FORMULA record? $stringValue = null; @@ -871,8 +871,8 @@ class Worksheet extends BIFFwriter $num = pack('d', 0x00); } - $grbit = 0x03; // Option flags - $unknown = 0x0000; // Must be zero + $grbit = 0x03; // Option flags + $unknown = 0x0000; // Must be zero // Strip the '=' or '@' sign at the beginning of the formula string if ($formula{0} == '=') { @@ -889,8 +889,8 @@ class Worksheet extends BIFFwriter $error = $this->parser->parse($formula); $formula = $this->parser->toReversePolish(); - $formlen = strlen($formula); // Length of the binary string - $length = 0x16 + $formlen; // Length of the record data + $formlen = strlen($formula); // Length of the binary string + $length = 0x16 + $formlen; // Length of the record data $header = pack('vv', $record, $length); @@ -917,7 +917,7 @@ class Worksheet extends BIFFwriter */ private function writeStringRecord($stringValue) { - $record = 0x0207; // Record identifier + $record = 0x0207; // Record identifier $data = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($stringValue); $length = strlen($data); @@ -994,8 +994,8 @@ class Worksheet extends BIFFwriter */ public function writeUrlWeb($row1, $col1, $row2, $col2, $url) { - $record = 0x01B8; // Record identifier - $length = 0x00000; // Bytes to follow + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow // Pack the undocumented parts of the hyperlink stream $unknown1 = pack('H*', 'D0C9EA79F9BACE118C8200AA004BA90B02000000'); @@ -1039,8 +1039,8 @@ class Worksheet extends BIFFwriter */ public function writeUrlInternal($row1, $col1, $row2, $col2, $url) { - $record = 0x01B8; // Record identifier - $length = 0x00000; // Bytes to follow + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow // Strip URL type $url = preg_replace('/^internal:/', '', $url); @@ -1098,8 +1098,8 @@ class Worksheet extends BIFFwriter return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); } - $record = 0x01B8; // Record identifier - $length = 0x00000; // Bytes to follow + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow // Strip URL type and change Unix dir separator to Dos style (if needed) // @@ -1158,7 +1158,7 @@ class Worksheet extends BIFFwriter $dir_short_len . $dir_short . $unknown3 . - $stream_len;/*. + $stream_len; /*. $dir_long_len . $unknown4 . $dir_long . @@ -1187,14 +1187,14 @@ class Worksheet extends BIFFwriter */ private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0) { - $record = 0x0208; // Record identifier - $length = 0x0010; // Number of bytes to follow + $record = 0x0208; // Record identifier + $length = 0x0010; // Number of bytes to follow - $colMic = 0x0000; // First defined column - $colMac = 0x0000; // Last defined column - $irwMac = 0x0000; // Used by Excel to optimise loading - $reserved = 0x0000; // Reserved - $grbit = 0x0000; // Option flags + $colMic = 0x0000; // First defined column + $colMac = 0x0000; // Last defined column + $irwMac = 0x0000; // Used by Excel to optimise loading + $reserved = 0x0000; // Reserved + $grbit = 0x0000; // Option flags $ixfe = $xfIndex; if ($height < 0) { @@ -1203,9 +1203,9 @@ class Worksheet extends BIFFwriter // Use writeRow($row, null, $XF) to set XF format without setting height if ($height != null) { - $miyRw = $height * 20; // row height + $miyRw = $height * 20; // row height } else { - $miyRw = 0xff; // default row height is 256 + $miyRw = 0xff; // default row height is 256 } // Set the options flags. fUnsynced is used to show that the font and row @@ -1250,26 +1250,26 @@ class Worksheet extends BIFFwriter */ private function writeWindow2() { - $record = 0x023E; // Record identifier + $record = 0x023E; // Record identifier $length = 0x0012; - $grbit = 0x00B6; // Option flags - $rwTop = 0x0000; // Top row visible in window - $colLeft = 0x0000; // Leftmost column visible in window + $grbit = 0x00B6; // Option flags + $rwTop = 0x0000; // Top row visible in window + $colLeft = 0x0000; // Leftmost column visible in window // The options flags that comprise $grbit - $fDspFmla = 0; // 0 - bit + $fDspFmla = 0; // 0 - bit $fDspGrid = $this->phpSheet->getShowGridlines() ? 1 : 0; // 1 $fDspRwCol = $this->phpSheet->getShowRowColHeaders() ? 1 : 0; // 2 - $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3 - $fDspZeros = 1; // 4 - $fDefaultHdr = 1; // 5 + $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3 + $fDspZeros = 1; // 4 + $fDefaultHdr = 1; // 5 $fArabic = $this->phpSheet->getRightToLeft() ? 1 : 0; // 6 - $fDspGuts = $this->outlineOn; // 7 - $fFrozenNoSplit = 0; // 0 - bit + $fDspGuts = $this->outlineOn; // 7 + $fFrozenNoSplit = 0; // 0 - bit // no support in PhpSpreadsheet for selected sheet, therefore sheet is only selected if it is the active sheet $fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0; - $fPaged = 1; // 2 + $fPaged = 1; // 2 $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === \PhpSpreadsheet\Worksheet\SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; $grbit = $fDspFmla; @@ -1312,8 +1312,8 @@ class Worksheet extends BIFFwriter // convert to twips $defaultRowHeight = (int) 20 * $defaultRowHeight; - $record = 0x0225; // Record identifier - $length = 0x0004; // Number of bytes to follow + $record = 0x0225; // Record identifier + $length = 0x0004; // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('vv', 1, $defaultRowHeight); @@ -1327,8 +1327,8 @@ class Worksheet extends BIFFwriter { $defaultColWidth = 8; - $record = 0x0055; // Record identifier - $length = 0x0002; // Number of bytes to follow + $record = 0x0055; // Record identifier + $length = 0x0002; // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('v', $defaultColWidth); @@ -1377,13 +1377,13 @@ class Worksheet extends BIFFwriter } else { $level = 0; } - $record = 0x007D; // Record identifier - $length = 0x000C; // Number of bytes to follow + $record = 0x007D; // Record identifier + $length = 0x000C; // Number of bytes to follow - $coldx *= 256; // Convert to units of 1/256 of a char + $coldx *= 256; // Convert to units of 1/256 of a char $ixfe = $xfIndex; - $reserved = 0x0000; // Reserved + $reserved = 0x0000; // Reserved $level = max(0, min($level, 7)); $grbit |= $level << 8; @@ -1424,20 +1424,20 @@ class Worksheet extends BIFFwriter $rwFirst = min($rwFirst, 65535); $rwLast = min($rwLast, 65535); - $record = 0x001D; // Record identifier - $length = 0x000F; // Number of bytes to follow + $record = 0x001D; // Record identifier + $length = 0x000F; // Number of bytes to follow - $pnn = $this->activePane; // Pane position - $rwAct = $rwFirst; // Active row - $colAct = $colFirst; // Active column - $irefAct = 0; // Active cell ref - $cref = 1; // Number of refs + $pnn = $this->activePane; // Pane position + $rwAct = $rwFirst; // Active row + $colAct = $colFirst; // Active column + $irefAct = 0; // Active cell ref + $cref = 1; // Number of refs if (!isset($rwLast)) { - $rwLast = $rwFirst; // Last row in reference + $rwLast = $rwFirst; // Last row in reference } if (!isset($colLast)) { - $colLast = $colFirst; // Last col in reference + $colLast = $colFirst; // Last col in reference } // Swap last row/col for first row/col as necessary @@ -1621,7 +1621,7 @@ class Worksheet extends BIFFwriter $length = strlen($recordData); - $record = 0x0868; // Record identifier + $record = 0x0868; // Record identifier $header = pack('vv', $record, $length); $this->append($header . $recordData); } @@ -1641,8 +1641,8 @@ class Worksheet extends BIFFwriter */ private function writeExterncount($count) { - $record = 0x0016; // Record identifier - $length = 0x0002; // Number of bytes to follow + $record = 0x0016; // Record identifier + $length = 0x0002; // Number of bytes to follow $header = pack('vv', $record, $length); $data = pack('v', $count); @@ -1659,20 +1659,20 @@ class Worksheet extends BIFFwriter */ private function writeExternsheet($sheetname) { - $record = 0x0017; // Record identifier + $record = 0x0017; // Record identifier // References to the current sheet are encoded differently to references to // external sheets. // if ($this->phpSheet->getTitle() == $sheetname) { $sheetname = ''; - $length = 0x02; // The following 2 bytes - $cch = 1; // The following byte - $rgch = 0x02; // Self reference + $length = 0x02; // The following 2 bytes + $cch = 1; // The following byte + $rgch = 0x02; // Self reference } else { $length = 0x02 + strlen($sheetname); $cch = strlen($sheetname); - $rgch = 0x03; // Reference to a sheet in the current workbook + $rgch = 0x03; // Reference to a sheet in the current workbook } $header = pack('vv', $record, $length); @@ -1707,8 +1707,8 @@ class Worksheet extends BIFFwriter } else { $pnnAct = null; } - $record = 0x0041; // Record identifier - $length = 0x000A; // Number of bytes to follow + $record = 0x0041; // Record identifier + $length = 0x000A; // Number of bytes to follow // Code specific to frozen or thawed panes. if ($this->phpSheet->getFreezePane()) { @@ -1767,38 +1767,38 @@ class Worksheet extends BIFFwriter */ private function writeSetup() { - $record = 0x00A1; // Record identifier - $length = 0x0022; // Number of bytes to follow + $record = 0x00A1; // Record identifier + $length = 0x0022; // Number of bytes to follow - $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size + $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size $iScale = $this->phpSheet->getPageSetup()->getScale() ? - $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor + $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor - $iPageStart = 0x01; // Starting page number - $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide - $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high - $grbit = 0x00; // Option flags - $iRes = 0x0258; // Print resolution - $iVRes = 0x0258; // Vertical print resolution + $iPageStart = 0x01; // Starting page number + $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide + $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high + $grbit = 0x00; // Option flags + $iRes = 0x0258; // Print resolution + $iVRes = 0x0258; // Vertical print resolution - $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin + $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin - $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin - $iCopies = 0x01; // Number of copies + $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin + $iCopies = 0x01; // Number of copies - $fLeftToRight = 0x0; // Print over then down + $fLeftToRight = 0x0; // Print over then down // Page orientation $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 0x0 : 0x1; - $fNoPls = 0x0; // Setup not read from printer - $fNoColor = 0x0; // Print black and white - $fDraft = 0x0; // Print draft quality - $fNotes = 0x0; // Print notes - $fNoOrient = 0x0; // Orientation not set - $fUsePage = 0x0; // Use custom starting page + $fNoPls = 0x0; // Setup not read from printer + $fNoColor = 0x0; // Print black and white + $fDraft = 0x0; // Print draft quality + $fNotes = 0x0; // Print notes + $fNoOrient = 0x0; // Orientation not set + $fUsePage = 0x0; // Use custom starting page $grbit = $fLeftToRight; $grbit |= $fLandscape << 1; @@ -1828,7 +1828,7 @@ class Worksheet extends BIFFwriter */ private function writeHeader() { - $record = 0x0014; // Record identifier + $record = 0x0014; // Record identifier /* removing for now // need to fix character count (multibyte!) @@ -1852,7 +1852,7 @@ class Worksheet extends BIFFwriter */ private function writeFooter() { - $record = 0x0015; // Record identifier + $record = 0x0015; // Record identifier /* removing for now // need to fix character count (multibyte!) @@ -1876,10 +1876,10 @@ class Worksheet extends BIFFwriter */ private function writeHcenter() { - $record = 0x0083; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0083; // Record identifier + $length = 0x0002; // Bytes to follow - $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering + $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering $header = pack('vv', $record, $length); $data = pack('v', $fHCenter); @@ -1892,10 +1892,10 @@ class Worksheet extends BIFFwriter */ private function writeVcenter() { - $record = 0x0084; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0084; // Record identifier + $length = 0x0002; // Bytes to follow - $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering + $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering $header = pack('vv', $record, $length); $data = pack('v', $fVCenter); @@ -1907,10 +1907,10 @@ class Worksheet extends BIFFwriter */ private function writeMarginLeft() { - $record = 0x0026; // Record identifier - $length = 0x0008; // Bytes to follow + $record = 0x0026; // Record identifier + $length = 0x0008; // Bytes to follow - $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches + $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches $header = pack('vv', $record, $length); $data = pack('d', $margin); @@ -1926,10 +1926,10 @@ class Worksheet extends BIFFwriter */ private function writeMarginRight() { - $record = 0x0027; // Record identifier - $length = 0x0008; // Bytes to follow + $record = 0x0027; // Record identifier + $length = 0x0008; // Bytes to follow - $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches + $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches $header = pack('vv', $record, $length); $data = pack('d', $margin); @@ -1945,10 +1945,10 @@ class Worksheet extends BIFFwriter */ private function writeMarginTop() { - $record = 0x0028; // Record identifier - $length = 0x0008; // Bytes to follow + $record = 0x0028; // Record identifier + $length = 0x0008; // Bytes to follow - $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches + $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches $header = pack('vv', $record, $length); $data = pack('d', $margin); @@ -1964,10 +1964,10 @@ class Worksheet extends BIFFwriter */ private function writeMarginBottom() { - $record = 0x0029; // Record identifier - $length = 0x0008; // Bytes to follow + $record = 0x0029; // Record identifier + $length = 0x0008; // Bytes to follow - $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches + $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches $header = pack('vv', $record, $length); $data = pack('d', $margin); @@ -1983,10 +1983,10 @@ class Worksheet extends BIFFwriter */ private function writePrintHeaders() { - $record = 0x002a; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x002a; // Record identifier + $length = 0x0002; // Bytes to follow - $fPrintRwCol = $this->_print_headers; // Boolean flag + $fPrintRwCol = $this->_print_headers; // Boolean flag $header = pack('vv', $record, $length); $data = pack('v', $fPrintRwCol); @@ -1999,10 +1999,10 @@ class Worksheet extends BIFFwriter */ private function writePrintGridlines() { - $record = 0x002b; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x002b; // Record identifier + $length = 0x0002; // Bytes to follow - $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag + $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag $header = pack('vv', $record, $length); $data = pack('v', $fPrintGrid); @@ -2015,10 +2015,10 @@ class Worksheet extends BIFFwriter */ private function writeGridset() { - $record = 0x0082; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0082; // Record identifier + $length = 0x0002; // Bytes to follow - $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag + $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag $header = pack('vv', $record, $length); $data = pack('v', $fGridSet); @@ -2030,8 +2030,8 @@ class Worksheet extends BIFFwriter */ private function writeAutoFilterInfo() { - $record = 0x009D; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x009D; // Record identifier + $length = 0x0002; // Bytes to follow $rangeBounds = \PhpSpreadsheet\Cell::rangeBoundaries($this->phpSheet->getAutoFilter()->getRange()); $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0]; @@ -2050,11 +2050,11 @@ class Worksheet extends BIFFwriter */ private function writeGuts() { - $record = 0x0080; // Record identifier - $length = 0x0008; // Bytes to follow + $record = 0x0080; // Record identifier + $length = 0x0008; // Bytes to follow - $dxRwGut = 0x0000; // Size of row gutter - $dxColGut = 0x0000; // Size of col gutter + $dxRwGut = 0x0000; // Size of row gutter + $dxColGut = 0x0000; // Size of col gutter // determine maximum row outline level $maxRowOutlineLevel = 0; @@ -2094,15 +2094,15 @@ class Worksheet extends BIFFwriter */ private function writeWsbool() { - $record = 0x0081; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0081; // Record identifier + $length = 0x0002; // Bytes to follow $grbit = 0x0000; // The only option that is of interest is the flag for fit to page. So we // set all the options in one go. // // Set the option flags - $grbit |= 0x0001; // Auto page breaks visible + $grbit |= 0x0001; // Auto page breaks visible if ($this->outlineStyle) { $grbit |= 0x0020; // Auto outline styles } @@ -2162,9 +2162,9 @@ class Worksheet extends BIFFwriter array_shift($hbreaks); } - $record = 0x001b; // Record identifier - $cbrk = count($hbreaks); // Number of page breaks - $length = 2 + 6 * $cbrk; // Bytes to follow + $record = 0x001b; // Record identifier + $cbrk = count($hbreaks); // Number of page breaks + $length = 2 + 6 * $cbrk; // Bytes to follow $header = pack('vv', $record, $length); $data = pack('v', $cbrk); @@ -2189,9 +2189,9 @@ class Worksheet extends BIFFwriter array_shift($vbreaks); } - $record = 0x001a; // Record identifier - $cbrk = count($vbreaks); // Number of page breaks - $length = 2 + 6 * $cbrk; // Bytes to follow + $record = 0x001a; // Record identifier + $cbrk = count($vbreaks); // Number of page breaks + $length = 2 + 6 * $cbrk; // Bytes to follow $header = pack('vv', $record, $length); $data = pack('v', $cbrk); @@ -2215,10 +2215,10 @@ class Worksheet extends BIFFwriter return; } - $record = 0x0012; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0012; // Record identifier + $length = 0x0002; // Bytes to follow - $fLock = 1; // Worksheet is protected + $fLock = 1; // Worksheet is protected $header = pack('vv', $record, $length); $data = pack('v', $fLock); @@ -2284,10 +2284,10 @@ class Worksheet extends BIFFwriter return; } - $record = 0x0013; // Record identifier - $length = 0x0002; // Bytes to follow + $record = 0x0013; // Record identifier + $length = 0x0002; // Bytes to follow - $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password + $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password $header = pack('vv', $record, $length); $data = pack('v', $wPassword); @@ -2382,8 +2382,8 @@ class Worksheet extends BIFFwriter public function positionImage($col_start, $row_start, $x1, $y1, $width, $height) { // Initialise end cell to the same as the start cell - $col_end = $col_start; // Col containing lower right corner of object - $row_end = $row_start; // Row containing bottom 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 // Zero the specified offset if greater than the cell dimensions if ($x1 >= \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_start))) { @@ -2448,33 +2448,33 @@ class Worksheet extends BIFFwriter */ private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB) { - $record = 0x005d; // Record identifier - $length = 0x003c; // Bytes to follow + $record = 0x005d; // Record identifier + $length = 0x003c; // Bytes to follow - $cObj = 0x0001; // Count of objects in file (set to 1) - $OT = 0x0008; // Object type. 8 = Picture - $id = 0x0001; // Object ID - $grbit = 0x0614; // Option flags + $cObj = 0x0001; // Count of objects in file (set to 1) + $OT = 0x0008; // Object type. 8 = Picture + $id = 0x0001; // Object ID + $grbit = 0x0614; // Option flags - $cbMacro = 0x0000; // Length of FMLA structure - $Reserved1 = 0x0000; // Reserved - $Reserved2 = 0x0000; // Reserved + $cbMacro = 0x0000; // Length of FMLA structure + $Reserved1 = 0x0000; // Reserved + $Reserved2 = 0x0000; // Reserved - $icvBack = 0x09; // Background colour - $icvFore = 0x09; // Foreground colour - $fls = 0x00; // Fill pattern - $fAuto = 0x00; // Automatic fill - $icv = 0x08; // Line colour - $lns = 0xff; // Line style - $lnw = 0x01; // Line weight - $fAutoB = 0x00; // Automatic border - $frs = 0x0000; // Frame style - $cf = 0x0009; // Image format, 9 = bitmap - $Reserved3 = 0x0000; // Reserved - $cbPictFmla = 0x0000; // Length of FMLA structure - $Reserved4 = 0x0000; // Reserved - $grbit2 = 0x0001; // Option flags - $Reserved5 = 0x0000; // Reserved + $icvBack = 0x09; // Background colour + $icvFore = 0x09; // Foreground colour + $fls = 0x00; // Fill pattern + $fAuto = 0x00; // Automatic fill + $icv = 0x08; // Line colour + $lns = 0xff; // Line style + $lnw = 0x01; // Line weight + $fAutoB = 0x00; // Automatic border + $frs = 0x0000; // Frame style + $cf = 0x0009; // Image format, 9 = bitmap + $Reserved3 = 0x0000; // Reserved + $cbPictFmla = 0x0000; // Length of FMLA structure + $Reserved4 = 0x0000; // Reserved + $grbit2 = 0x0001; // Option flags + $Reserved5 = 0x0000; // Reserved $header = pack('vv', $record, $length); $data = pack('V', $cObj); @@ -2636,8 +2636,8 @@ class Worksheet extends BIFFwriter return; } - $record = 0x00A0; // Record identifier - $length = 0x0004; // Bytes to follow + $record = 0x00A0; // Record identifier + $length = 0x0004; // Bytes to follow $header = pack('vv', $record, $length); $data = pack('vv', $this->phpSheet->getSheetView()->getZoomScale(), 100); @@ -2682,7 +2682,7 @@ class Worksheet extends BIFFwriter $nm = count($spOffsets) - 1; // number of shapes excluding first shape for ($i = 1; $i <= $nm; ++$i) { // MSODRAWING record - $record = 0x00EC; // Record identifier + $record = 0x00EC; // Record identifier // chunk of Escher stream for one shape $dataChunk = substr($data, $spOffsets[$i - 1], $spOffsets[$i] - $spOffsets[$i - 1]); @@ -2760,20 +2760,20 @@ class Worksheet extends BIFFwriter // Write data validations? if (!empty($dataValidationCollection)) { // DATAVALIDATIONS record - $record = 0x01B2; // Record identifier - $length = 0x0012; // Bytes to follow + $record = 0x01B2; // Record identifier + $length = 0x0012; // Bytes to follow - $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records - $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position - $verPos = 0x00000000; // Vertical position of prompt box, if fixed position - $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible + $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records + $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position + $verPos = 0x00000000; // Vertical position of prompt box, if fixed position + $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible $header = pack('vv', $record, $length); $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection)); $this->append($header . $data); // DATAVALIDATION records - $record = 0x01BE; // Record identifier + $record = 0x01BE; // Record identifier foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) { // initialize record data @@ -2973,8 +2973,8 @@ class Worksheet extends BIFFwriter */ private function writePageLayoutView() { - $record = 0x088B; // Record identifier - $length = 0x0010; // Bytes to follow + $record = 0x088B; // Record identifier + $length = 0x0010; // Bytes to follow $rt = 0x088B; // 2 $grbitFrt = 0x0000; // 2 @@ -3005,7 +3005,7 @@ class Worksheet extends BIFFwriter */ private function writeCFRule(\PhpSpreadsheet\Style\Conditional $conditional) { - $record = 0x01B1; // Record identifier + $record = 0x01B1; // Record identifier // $type : Type of the CF // $operatorType : Comparison operator @@ -3125,43 +3125,43 @@ class Worksheet extends BIFFwriter } // Alignment $flags = 0; - $flags |= (1 == $bAlignHz ? 0x00000001 : 0); - $flags |= (1 == $bAlignVt ? 0x00000002 : 0); - $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); - $flags |= (1 == $bTxRotation ? 0x00000008 : 0); + $flags |= (1 == $bAlignHz ? 0x00000001 : 0); + $flags |= (1 == $bAlignVt ? 0x00000002 : 0); + $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); + $flags |= (1 == $bTxRotation ? 0x00000008 : 0); // Justify last line flag - $flags |= (1 == 1 ? 0x00000010 : 0); - $flags |= (1 == $bIndent ? 0x00000020 : 0); - $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); + $flags |= (1 == 1 ? 0x00000010 : 0); + $flags |= (1 == $bIndent ? 0x00000020 : 0); + $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); // Default - $flags |= (1 == 1 ? 0x00000080 : 0); + $flags |= (1 == 1 ? 0x00000080 : 0); // Protection - $flags |= (1 == $bProtLocked ? 0x00000100 : 0); - $flags |= (1 == $bProtHidden ? 0x00000200 : 0); + $flags |= (1 == $bProtLocked ? 0x00000100 : 0); + $flags |= (1 == $bProtHidden ? 0x00000200 : 0); // Border - $flags |= (1 == $bBorderLeft ? 0x00000400 : 0); - $flags |= (1 == $bBorderRight ? 0x00000800 : 0); - $flags |= (1 == $bBorderTop ? 0x00001000 : 0); + $flags |= (1 == $bBorderLeft ? 0x00000400 : 0); + $flags |= (1 == $bBorderRight ? 0x00000800 : 0); + $flags |= (1 == $bBorderTop ? 0x00001000 : 0); $flags |= (1 == $bBorderBottom ? 0x00002000 : 0); - $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border - $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border + $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border + $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border // Pattern - $flags |= (1 == $bFillStyle ? 0x00010000 : 0); - $flags |= (1 == $bFillColor ? 0x00020000 : 0); - $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); - $flags |= (1 == 1 ? 0x00380000 : 0); + $flags |= (1 == $bFillStyle ? 0x00010000 : 0); + $flags |= (1 == $bFillColor ? 0x00020000 : 0); + $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); + $flags |= (1 == 1 ? 0x00380000 : 0); // Font - $flags |= (1 == $bFormatFont ? 0x04000000 : 0); + $flags |= (1 == $bFormatFont ? 0x04000000 : 0); // Alignment: - $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); + $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); // Border $flags |= (1 == $bFormatBorder ? 0x10000000 : 0); // Pattern - $flags |= (1 == $bFormatFill ? 0x20000000 : 0); + $flags |= (1 == $bFormatFill ? 0x20000000 : 0); // Protection - $flags |= (1 == $bFormatProt ? 0x40000000 : 0); + $flags |= (1 == $bFormatProt ? 0x40000000 : 0); // Text direction - $flags |= (1 == 0 ? 0x80000000 : 0); + $flags |= (1 == 0 ? 0x80000000 : 0); // Data Blocks if ($bFormatFont == 1) { @@ -3406,11 +3406,11 @@ class Worksheet extends BIFFwriter // Options flags for modified font attributes $optionsFlags = 0; $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0); - $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); - $optionsFlags |= (1 == 1 ? 0x00000008 : 0); - $optionsFlags |= (1 == 1 ? 0x00000010 : 0); - $optionsFlags |= (1 == 0 ? 0x00000020 : 0); - $optionsFlags |= (1 == 1 ? 0x00000080 : 0); + $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); + $optionsFlags |= (1 == 1 ? 0x00000008 : 0); + $optionsFlags |= (1 == 1 ? 0x00000010 : 0); + $optionsFlags |= (1 == 0 ? 0x00000020 : 0); + $optionsFlags |= (1 == 1 ? 0x00000080 : 0); $dataBlockFont .= pack('V', $optionsFlags); // Escapement type $dataBlockFont .= pack('V', $fontEscapement); @@ -3781,10 +3781,10 @@ class Worksheet extends BIFFwriter break; case \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR: $blockFillPatternStyle = 0x00; - break; // does not exist in BIFF8 + break; // does not exist in BIFF8 case \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_PATH: $blockFillPatternStyle = 0x00; - break; // does not exist in BIFF8 + break; // does not exist in BIFF8 default: $blockFillPatternStyle = 0x00; break; @@ -4181,8 +4181,8 @@ class Worksheet extends BIFFwriter */ private function writeCFHeader() { - $record = 0x01B0; // Record identifier - $length = 0x0016; // Bytes to follow + $record = 0x01B0; // Record identifier + $length = 0x0016; // Bytes to follow $numColumnMin = null; $numColumnMax = null; diff --git a/src/PhpSpreadsheet/Writer/Excel5/Xf.php b/src/PhpSpreadsheet/Writer/Excel5/Xf.php index ada7e397..07e2c9e3 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Xf.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Xf.php @@ -167,16 +167,16 @@ class Xf } // Flags to indicate if attributes have been set. - $atr_num = ($this->numberFormatIndex != 0)?1:0; - $atr_fnt = ($this->fontIndex != 0)?1:0; + $atr_num = ($this->numberFormatIndex != 0) ? 1 : 0; + $atr_fnt = ($this->fontIndex != 0) ? 1 : 0; $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; $atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || - self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; + self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle())) ? 1 : 0; $atr_pat = (($this->foregroundColor != 0x40) || ($this->backgroundColor != 0x41) || - self::mapFillType($this->_style->getFill()->getFillType()))?1:0; + self::mapFillType($this->_style->getFill()->getFillType())) ? 1 : 0; $atr_prot = self::mapLocked($this->_style->getProtection()->getLocked()) | self::mapHidden($this->_style->getProtection()->getHidden()); @@ -197,13 +197,13 @@ class Xf $this->_diag_color = 0; } - $record = 0x00E0; // Record identifier - $length = 0x0014; // Number of bytes to follow + $record = 0x00E0; // Record identifier + $length = 0x0014; // Number of bytes to follow - $ifnt = $this->fontIndex; // Index to FONT record - $ifmt = $this->numberFormatIndex; // Index to FORMAT record + $ifnt = $this->fontIndex; // Index to FONT record + $ifmt = $this->numberFormatIndex; // Index to FORMAT record - $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment + $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4; $align |= $this->textJustLast << 7; @@ -215,10 +215,10 @@ class Xf $used_attrib |= $atr_pat << 6; $used_attrib |= $atr_prot << 7; - $icv = $this->foregroundColor; // fg and bg pattern colors + $icv = $this->foregroundColor; // fg and bg pattern colors $icv |= $this->backgroundColor << 7; - $border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color + $border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; @@ -233,7 +233,7 @@ class Xf $border1 |= $diag_tl_to_rb << 30; $border1 |= $diag_tr_to_lb << 31; - $border2 = $this->topBorderColor; // Border color + $border2 = $this->topBorderColor; // Border color $border2 |= $this->bottomBorderColor << 7; $border2 |= $this->_diag_color << 14; $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; @@ -413,8 +413,8 @@ class Xf \PhpSpreadsheet\Style\Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, \PhpSpreadsheet\Style\Fill::FILL_PATTERN_GRAY125 => 0x11, \PhpSpreadsheet\Style\Fill::FILL_PATTERN_GRAY0625 => 0x12, - \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 - \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 + \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 + \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 ]; /** diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/HTML.php index 9e62f580..57cfb58b 100644 --- a/src/PhpSpreadsheet/Writer/HTML.php +++ b/src/PhpSpreadsheet/Writer/HTML.php @@ -666,10 +666,10 @@ class HTML extends BaseWriter implements IWriter if ($drawing->getCoordinates() != $coordinates) { continue; } - ob_start(); // Let's start output buffering. - imagepng($drawing->getImageResource()); // This will normally output the image, but because of ob_start(), it won't. - $contents = ob_get_contents(); // Instead, output above is saved to $contents - ob_end_clean(); // End the output buffer. + ob_start(); // Let's start output buffering. + imagepng($drawing->getImageResource()); // This will normally output the image, but because of ob_start(), it won't. + $contents = ob_get_contents(); // Instead, output above is saved to $contents + ob_end_clean(); // End the output buffer. $dataUri = 'data:image/jpeg;base64,' . base64_encode($contents); @@ -1580,7 +1580,7 @@ class HTML extends BaseWriter implements IWriter if (!in_array($baseCell, $adjustedBaseCells)) { // subtract rowspan by 1 - --$this->isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan']; + --$this->isBaseCell[$sheetIndex][$baseCell[0]][$baseCell[1]]['rowspan']; $adjustedBaseCells[] = $baseCell; } } diff --git a/src/PhpSpreadsheet/Writer/PDF/Core.php b/src/PhpSpreadsheet/Writer/PDF/Core.php index 98c34a07..e983f595 100644 --- a/src/PhpSpreadsheet/Writer/PDF/Core.php +++ b/src/PhpSpreadsheet/Writer/PDF/Core.php @@ -67,72 +67,72 @@ abstract class Core extends \PhpSpreadsheet\Writer\HTML * @var array */ protected static $paperSizes = [ - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER => 'LETTER', // (8.5 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID => [792.00, 1224.00], // (11 in. by 17 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEDGER => [1224.00, 792.00], // (17 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STATEMENT => [396.00, 612.00], // (5.5 in. by 8.5 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_QUARTO => [609.45, 779.53], // (215 mm by 275 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_1 => [720.00, 1008.00], // (10 in. by 14 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_2 => [792.00, 1224.00], // (11 in. by 17 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO9_ENVELOPE => [279.00, 639.00], // (3.875 in. by 8.875 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO10_ENVELOPE => [297.00, 684.00], // (4.125 in. by 9.5 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO11_ENVELOPE => [324.00, 747.00], // (4.5 in. by 10.375 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO12_ENVELOPE => [342.00, 792.00], // (4.75 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO14_ENVELOPE => [360.00, 828.00], // (5 in. by 11.5 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C => [1224.00, 1584.00], // (17 in. by 22 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_D => [1584.00, 2448.00], // (22 in. by 34 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_E => [2448.00, 3168.00], // (34 in. by 44 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_DL_ENVELOPE => [311.81, 623.62], // (110 mm by 220 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C65_ENVELOPE => [323.15, 649.13], // (114 mm by 229 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B6_ENVELOPE => [498.90, 354.33], // (176 mm by 125 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ITALY_ENVELOPE => [311.81, 651.97], // (110 mm by 230 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_MONARCH_ENVELOPE => [279.00, 540.00], // (3.875 in. by 7.5 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_6_3_4_ENVELOPE => [261.00, 468.00], // (3.625 in. by 6.5 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => [1071.00, 792.00], // (14.875 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => [612.00, 864.00], // (8.5 in. by 12 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => [566.93, 419.53], // (200 mm by 148 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_1 => [648.00, 792.00], // (9 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_2 => [720.00, 792.00], // (10 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_3 => [1080.00, 792.00], // (15 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_INVITE_ENVELOPE => [623.62, 623.62], // (220 mm by 220 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => [667.80, 1080.00], // (9.275 in. by 15 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => [841.68, 1296.00], // (11.69 in. by 18 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_EXTRA_PAPER => [668.98, 912.76], // (236 mm by 322 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => [595.80, 792.00], // (8.275 in. by 11 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => [643.46, 1009.13], // (227 mm by 356 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => [864.57, 1380.47], // (305 mm by 487 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => [612.00, 913.68], // (8.5 in. by 12.69 in.) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_PLUS_PAPER => [595.28, 935.43], // (210 mm by 330 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => [515.91, 728.50], // (182 mm by 257 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_EXTRA_PAPER => [493.23, 666.14], // (174 mm by 235 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => [569.76, 782.36], // (201 mm by 276 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) - \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER => 'LETTER', // (8.5 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID => [792.00, 1224.00], // (11 in. by 17 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEDGER => [1224.00, 792.00], // (17 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STATEMENT => [396.00, 612.00], // (5.5 in. by 8.5 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_QUARTO => [609.45, 779.53], // (215 mm by 275 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_1 => [720.00, 1008.00], // (10 in. by 14 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_2 => [792.00, 1224.00], // (11 in. by 17 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO9_ENVELOPE => [279.00, 639.00], // (3.875 in. by 8.875 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO10_ENVELOPE => [297.00, 684.00], // (4.125 in. by 9.5 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO11_ENVELOPE => [324.00, 747.00], // (4.5 in. by 10.375 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO12_ENVELOPE => [342.00, 792.00], // (4.75 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO14_ENVELOPE => [360.00, 828.00], // (5 in. by 11.5 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C => [1224.00, 1584.00], // (17 in. by 22 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_D => [1584.00, 2448.00], // (22 in. by 34 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_E => [2448.00, 3168.00], // (34 in. by 44 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_DL_ENVELOPE => [311.81, 623.62], // (110 mm by 220 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C65_ENVELOPE => [323.15, 649.13], // (114 mm by 229 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B6_ENVELOPE => [498.90, 354.33], // (176 mm by 125 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ITALY_ENVELOPE => [311.81, 651.97], // (110 mm by 230 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_MONARCH_ENVELOPE => [279.00, 540.00], // (3.875 in. by 7.5 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_6_3_4_ENVELOPE => [261.00, 468.00], // (3.625 in. by 6.5 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => [1071.00, 792.00], // (14.875 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => [612.00, 864.00], // (8.5 in. by 12 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => [566.93, 419.53], // (200 mm by 148 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_1 => [648.00, 792.00], // (9 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_2 => [720.00, 792.00], // (10 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_3 => [1080.00, 792.00], // (15 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_INVITE_ENVELOPE => [623.62, 623.62], // (220 mm by 220 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => [667.80, 1080.00], // (9.275 in. by 15 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => [841.68, 1296.00], // (11.69 in. by 18 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_EXTRA_PAPER => [668.98, 912.76], // (236 mm by 322 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => [595.80, 792.00], // (8.275 in. by 11 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => [643.46, 1009.13], // (227 mm by 356 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => [864.57, 1380.47], // (305 mm by 487 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => [612.00, 913.68], // (8.5 in. by 12.69 in.) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_PLUS_PAPER => [595.28, 935.43], // (210 mm by 330 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => [515.91, 728.50], // (182 mm by 257 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_EXTRA_PAPER => [493.23, 666.14], // (174 mm by 235 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => [569.76, 782.36], // (201 mm by 276 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) + \PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) ]; /** diff --git a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php index 302e97f4..23c03b76 100644 --- a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php @@ -55,7 +55,7 @@ class DomPDF extends Core implements \PhpSpreadsheet\Writer\IWriter $fileHandle = parent::prepareForSave($pFilename); // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { diff --git a/src/PhpSpreadsheet/Writer/PDF/MPDF.php b/src/PhpSpreadsheet/Writer/PDF/MPDF.php index a3c503c6..a7fbd337 100644 --- a/src/PhpSpreadsheet/Writer/PDF/MPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/MPDF.php @@ -55,7 +55,7 @@ class MPDF extends Core implements \PhpSpreadsheet\Writer\IWriter $fileHandle = parent::prepareForSave($pFilename); // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { diff --git a/src/PhpSpreadsheet/Writer/PDF/TcPDF.php b/src/PhpSpreadsheet/Writer/PDF/TcPDF.php index d88d9077..84cf48f0 100644 --- a/src/PhpSpreadsheet/Writer/PDF/TcPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/TcPDF.php @@ -56,7 +56,7 @@ class TcPDF extends Core implements \PhpSpreadsheet\Writer\IWriter $fileHandle = parent::prepareForSave($pFilename); // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { diff --git a/tests/data/Shared/Date/DateTimeToExcel.php b/tests/data/Shared/Date/DateTimeToExcel.php index 3135f68c..0ed2f682 100644 --- a/tests/data/Shared/Date/DateTimeToExcel.php +++ b/tests/data/Shared/Date/DateTimeToExcel.php @@ -2,19 +2,19 @@ // DateTime object Result Comments return [ - [new DateTime('1900-01-01'), 1.0], // Excel 1900 base calendar date - [new DateTime('1900-02-28'), 59.0], // This and next test show gap for the mythical - [new DateTime('1900-03-01'), 61.0], // MS Excel 1900 Leap Year - [new DateTime('1901-12-14'), 714.0], // Unix Timestamp 32-bit Earliest Date - [new DateTime('1903-12-31'), 1461.0], - [new DateTime('1904-01-01'), 1462.0], // Excel 1904 Calendar Base Date - [new DateTime('1904-01-02'), 1463.0], - [new DateTime('1960-12-19'), 22269.0], - [new DateTime('1970-01-01'), 25569.0], // Unix Timestamp Base Date - [new DateTime('1982-12-07'), 30292.0], - [new DateTime('2008-06-12'), 39611.0], - [new DateTime('2038-01-19'), 50424.0], // Unix Timestamp 32-bit Latest Date - [new DateTime('1903-05-18 13:37:46'), 1234.56789], - [new DateTime('1933-10-18 16:17:37'), 12345.6789], - [new DateTime('2099-12-31'), 73050.0], + [new DateTime('1900-01-01'), 1.0], // Excel 1900 base calendar date + [new DateTime('1900-02-28'), 59.0], // This and next test show gap for the mythical + [new DateTime('1900-03-01'), 61.0], // MS Excel 1900 Leap Year + [new DateTime('1901-12-14'), 714.0], // Unix Timestamp 32-bit Earliest Date + [new DateTime('1903-12-31'), 1461.0], + [new DateTime('1904-01-01'), 1462.0], // Excel 1904 Calendar Base Date + [new DateTime('1904-01-02'), 1463.0], + [new DateTime('1960-12-19'), 22269.0], + [new DateTime('1970-01-01'), 25569.0], // Unix Timestamp Base Date + [new DateTime('1982-12-07'), 30292.0], + [new DateTime('2008-06-12'), 39611.0], + [new DateTime('2038-01-19'), 50424.0], // Unix Timestamp 32-bit Latest Date + [new DateTime('1903-05-18 13:37:46'), 1234.56789], + [new DateTime('1933-10-18 16:17:37'), 12345.6789], + [new DateTime('2099-12-31'), 73050.0], ]; diff --git a/tests/data/Shared/Date/ExcelToTimestamp1900.php b/tests/data/Shared/Date/ExcelToTimestamp1900.php index febeb12d..b7f85f35 100644 --- a/tests/data/Shared/Date/ExcelToTimestamp1900.php +++ b/tests/data/Shared/Date/ExcelToTimestamp1900.php @@ -2,18 +2,18 @@ // Excel DateTimeStamp Result Comments return [ - [714, -2147472000], // PHP 32-bit Earliest Date 14-Dec-1901 - [1461, -2082931200], // 31-Dec-1903 - [1462, -2082844800], // Excel 1904 Calendar Base Date 01-Jan-1904 - [1463, -2082758400], // 02-Jan-1904 - [22269, -285120000], // 19-Dec-1960 - [25569, 0], // PHP Base Date 01-Jan-1970 - [30292, 408067200], // 07-Dec-1982 - [39611, 1213228800], // 12-Jun-2008 - [50424, 2147472000], // PHP 32-bit Latest Date 19-Jan-2038 - [1234.56789, -2102494934], // 18-May-1903 13:37:46 - [12345.6789, -1142494943], // 18-Oct-1933 16:17:37 - [0.5, 43200], // 12:00:00 - [0.75, 64800], // 18:00.00 - [0.12345, 10666], // 02:57:46 + [714, -2147472000], // PHP 32-bit Earliest Date 14-Dec-1901 + [1461, -2082931200], // 31-Dec-1903 + [1462, -2082844800], // Excel 1904 Calendar Base Date 01-Jan-1904 + [1463, -2082758400], // 02-Jan-1904 + [22269, -285120000], // 19-Dec-1960 + [25569, 0], // PHP Base Date 01-Jan-1970 + [30292, 408067200], // 07-Dec-1982 + [39611, 1213228800], // 12-Jun-2008 + [50424, 2147472000], // PHP 32-bit Latest Date 19-Jan-2038 + [1234.56789, -2102494934], // 18-May-1903 13:37:46 + [12345.6789, -1142494943], // 18-Oct-1933 16:17:37 + [0.5, 43200], // 12:00:00 + [0.75, 64800], // 18:00.00 + [0.12345, 10666], // 02:57:46 ]; diff --git a/tests/data/Shared/Date/ExcelToTimestamp1900Timezone.php b/tests/data/Shared/Date/ExcelToTimestamp1900Timezone.php index a170ecba..1bafd5a7 100644 --- a/tests/data/Shared/Date/ExcelToTimestamp1900Timezone.php +++ b/tests/data/Shared/Date/ExcelToTimestamp1900Timezone.php @@ -2,26 +2,26 @@ // Excel DateTimeStamp Timezone Result Comments return [ - [22269, 'America/New_York', -285102000], // 19-Dec-1960 00:00:00 EST => 19-Dec-1960 05:00:00 UTC - [25569, 'America/New_York', 18000], // 01-Jan-1970 00:00:00 EST => 01-Jan-1970 05:00:00 UTC PHP Base Date - [30292, 'America/New_York', 408085200], // 07-Dec-1982 00:00:00 EST => 07-Dec-1982 05:00:00 UTC - [39611, 'America/New_York', 1213243200], // 12-Jun-2008 00:00:00 EDT => 12-Jun-2008 04:00:00 UTC - [50424, 'America/New_York', 2147490000], // 19-Jan-2038 00:00:00 EST => 19-Jan-2038 05:00:00 UTC PHP 32-bit Latest Date - [22345.56789, 'America/New_York', -278486534], // 05-Mar-1961 13:37:46 EST => 05-Mar-1961 18:37:46 UTC - [22345.6789, 'America/New_York', -278476943], // 05-Mar-1961 16:17:37 EST => 05-Mar-1961 21:17:37 UTC - [0.5, 'America/New_York', 61200], // 12:00:00 EST => 17:00:00 UTC - [0.75, 'America/New_York', 82800], // 18:00.00 EST => 23:00:00 UTC - [0.12345, 'America/New_York', 28666], // 02:57:46 EST => 07:57:46 UTC - [41215, 'America/New_York', 1351828800], // 02-Nov-2012 00:00:00 EDT => 02-Nov-2012 04:00:00 UTC - [22269, 'Pacific/Auckland', -285163200], // 19-Dec-1960 00:00:00 NZST => 18-Dec-1960 12:00:00 UTC - [25569, 'Pacific/Auckland', -43200], // 01-Jan-1970 00:00:00 NZST => 31-Dec-1969 12:00:00 UTC PHP Base Date - [30292, 'Pacific/Auckland', 408020400], // 07-Dec-1982 00:00:00 NZDT => 06-Dec-1982 11:00:00 UTC - [39611, 'Pacific/Auckland', 1213185600], // 12-Jun-2008 00:00:00 NZST => 11-Jun-2008 12:00:00 UTC - [50423.5, 'Pacific/Auckland', 2147382000], // 18-Jan-2038 12:00:00 NZDT => 17-Jan-2038 23:00:00 UTC PHP 32-bit Latest Date - [22345.56789, 'Pacific/Auckland', -278547734], // 05-Mar-1961 13:37:46 NZST => 05-Mar-1961 01:37:46 UTC - [22345.6789, 'Pacific/Auckland', -278538143], // 05-Mar-1961 16:17:37 NZST => 05-Mar-1961 04:17:37 UTC - [0.5, 'Pacific/Auckland', 0], // 12:00:00 NZST => 00:00:00 UTC - [0.75, 'Pacific/Auckland', 21600], // 18:00.00 NZST => 06:00:00 UTC - [0.12345, 'Pacific/Auckland', -32534], // 02:57:46 NZST => 14:57:46 UTC - [41215, 'Pacific/Auckland', 1351767600], // 02-Nov-2012 00:00:00 NZDT => 01-Nov-2012 11:00:00 UTC + [22269, 'America/New_York', -285102000], // 19-Dec-1960 00:00:00 EST => 19-Dec-1960 05:00:00 UTC + [25569, 'America/New_York', 18000], // 01-Jan-1970 00:00:00 EST => 01-Jan-1970 05:00:00 UTC PHP Base Date + [30292, 'America/New_York', 408085200], // 07-Dec-1982 00:00:00 EST => 07-Dec-1982 05:00:00 UTC + [39611, 'America/New_York', 1213243200], // 12-Jun-2008 00:00:00 EDT => 12-Jun-2008 04:00:00 UTC + [50424, 'America/New_York', 2147490000], // 19-Jan-2038 00:00:00 EST => 19-Jan-2038 05:00:00 UTC PHP 32-bit Latest Date + [22345.56789, 'America/New_York', -278486534], // 05-Mar-1961 13:37:46 EST => 05-Mar-1961 18:37:46 UTC + [22345.6789, 'America/New_York', -278476943], // 05-Mar-1961 16:17:37 EST => 05-Mar-1961 21:17:37 UTC + [0.5, 'America/New_York', 61200], // 12:00:00 EST => 17:00:00 UTC + [0.75, 'America/New_York', 82800], // 18:00.00 EST => 23:00:00 UTC + [0.12345, 'America/New_York', 28666], // 02:57:46 EST => 07:57:46 UTC + [41215, 'America/New_York', 1351828800], // 02-Nov-2012 00:00:00 EDT => 02-Nov-2012 04:00:00 UTC + [22269, 'Pacific/Auckland', -285163200], // 19-Dec-1960 00:00:00 NZST => 18-Dec-1960 12:00:00 UTC + [25569, 'Pacific/Auckland', -43200], // 01-Jan-1970 00:00:00 NZST => 31-Dec-1969 12:00:00 UTC PHP Base Date + [30292, 'Pacific/Auckland', 408020400], // 07-Dec-1982 00:00:00 NZDT => 06-Dec-1982 11:00:00 UTC + [39611, 'Pacific/Auckland', 1213185600], // 12-Jun-2008 00:00:00 NZST => 11-Jun-2008 12:00:00 UTC + [50423.5, 'Pacific/Auckland', 2147382000], // 18-Jan-2038 12:00:00 NZDT => 17-Jan-2038 23:00:00 UTC PHP 32-bit Latest Date + [22345.56789, 'Pacific/Auckland', -278547734], // 05-Mar-1961 13:37:46 NZST => 05-Mar-1961 01:37:46 UTC + [22345.6789, 'Pacific/Auckland', -278538143], // 05-Mar-1961 16:17:37 NZST => 05-Mar-1961 04:17:37 UTC + [0.5, 'Pacific/Auckland', 0], // 12:00:00 NZST => 00:00:00 UTC + [0.75, 'Pacific/Auckland', 21600], // 18:00.00 NZST => 06:00:00 UTC + [0.12345, 'Pacific/Auckland', -32534], // 02:57:46 NZST => 14:57:46 UTC + [41215, 'Pacific/Auckland', 1351767600], // 02-Nov-2012 00:00:00 NZDT => 01-Nov-2012 11:00:00 UTC ]; diff --git a/tests/data/Shared/Date/ExcelToTimestamp1904.php b/tests/data/Shared/Date/ExcelToTimestamp1904.php index c7967ba2..30ef1ae9 100644 --- a/tests/data/Shared/Date/ExcelToTimestamp1904.php +++ b/tests/data/Shared/Date/ExcelToTimestamp1904.php @@ -2,13 +2,13 @@ // Excel DateTimeStamp Result Comments return [ - [1462, -1956528000], - [1463, -1956441600], - [22269, -158803200], - [25569, 126316800], - [30292, 534384000], - [39611, 1339545600], - [0.25, 21600], // 06:00:00 - [0.3333333333333333333, 28800], // 08:00.00 - [0.54321, 46933], // 02:57:46 + [1462, -1956528000], + [1463, -1956441600], + [22269, -158803200], + [25569, 126316800], + [30292, 534384000], + [39611, 1339545600], + [0.25, 21600], // 06:00:00 + [0.3333333333333333333, 28800], // 08:00.00 + [0.54321, 46933], // 02:57:46 ]; diff --git a/tests/data/Shared/Date/FormatCodes.php b/tests/data/Shared/Date/FormatCodes.php index 69252ec1..f6108228 100644 --- a/tests/data/Shared/Date/FormatCodes.php +++ b/tests/data/Shared/Date/FormatCodes.php @@ -2,40 +2,40 @@ // Excel Format Code Result return [ - ['General', false], - ['@', false], - ['0', false], - ['0.00', false], - ['#,##0.00', false], - ['#,##0.00_-', false], - ['0%', false], - ['0.00%', false], - ['yyyy-mm-dd', true], - ['yy-mm-dd', true], - ['dd/mm/yy', true], - ['d/m/y', true], - ['d-m-y', true], - ['d-m', true], - ['m-y', true], - ['mm-dd-yy', true], - ['d-mmm-yy', true], - ['d-mmm', true], - ['mmm-yy', true], - ['m/d/yy h:mm', true], - ['d/m/y h:mm', true], - ['h:mm AM/PM', true], - ['h:mm:ss AM/PM', true], - ['h:mm', true], - ['h:mm:ss', true], - ['mm:ss', true], - ['h:mm:ss', true], - ['i:s.S', true], - ['h:mm:ss;@', true], - ['yy/mm/dd;@', true], - ['"$" #,##0.00_-', false], - ['$#,##0_-', false], - ['[$EUR ]#,##0.00_-', false], - ['_[$EUR ]#,##0.00_-', false], - ['[Green]#,##0.00;[Red]#,##0.00_-', false], - ['#,##0.00 "dollars"', false], + ['General', false], + ['@', false], + ['0', false], + ['0.00', false], + ['#,##0.00', false], + ['#,##0.00_-', false], + ['0%', false], + ['0.00%', false], + ['yyyy-mm-dd', true], + ['yy-mm-dd', true], + ['dd/mm/yy', true], + ['d/m/y', true], + ['d-m-y', true], + ['d-m', true], + ['m-y', true], + ['mm-dd-yy', true], + ['d-mmm-yy', true], + ['d-mmm', true], + ['mmm-yy', true], + ['m/d/yy h:mm', true], + ['d/m/y h:mm', true], + ['h:mm AM/PM', true], + ['h:mm:ss AM/PM', true], + ['h:mm', true], + ['h:mm:ss', true], + ['mm:ss', true], + ['h:mm:ss', true], + ['i:s.S', true], + ['h:mm:ss;@', true], + ['yy/mm/dd;@', true], + ['"$" #,##0.00_-', false], + ['$#,##0_-', false], + ['[$EUR ]#,##0.00_-', false], + ['_[$EUR ]#,##0.00_-', false], + ['[Green]#,##0.00;[Red]#,##0.00_-', false], + ['#,##0.00 "dollars"', false], ]; diff --git a/tests/data/Shared/Date/FormattedPHPToExcel1900.php b/tests/data/Shared/Date/FormattedPHPToExcel1900.php index 6eafc3cc..94d3529a 100644 --- a/tests/data/Shared/Date/FormattedPHPToExcel1900.php +++ b/tests/data/Shared/Date/FormattedPHPToExcel1900.php @@ -2,15 +2,15 @@ // Year Month Day Hours Minutes Seconds Result Comments return [ - [1901, 12, 14, 714], // PHP 32-bit Earliest Date 14-Dec-1901 - [1903, 12, 31, 1461], // 31-Dec-1903 - [1904, 1, 1, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 - [1904, 1, 2, 1463], // 02-Jan-1904 - [1960, 12, 19, 22269], // 19-Dec-1960 - [1970, 1, 1, 25569], // PHP Base Date 01-Jan-1970 - [1982, 12, 7, 30292], // 07-Dec-1982 - [2008, 6, 12, 39611], // 12-Jun-2008 - [2038, 1, 19, 50424], // PHP 32-bit Latest Date 19-Jan-2038 - [1903, 5, 18, 13, 37, 46, 1234.56789], // 18-May-1903 13:37:46 - [1933, 10, 18, 16, 17, 37, 12345.6789], // 18-Oct-1933 16:17:37 + [1901, 12, 14, 714], // PHP 32-bit Earliest Date 14-Dec-1901 + [1903, 12, 31, 1461], // 31-Dec-1903 + [1904, 1, 1, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 + [1904, 1, 2, 1463], // 02-Jan-1904 + [1960, 12, 19, 22269], // 19-Dec-1960 + [1970, 1, 1, 25569], // PHP Base Date 01-Jan-1970 + [1982, 12, 7, 30292], // 07-Dec-1982 + [2008, 6, 12, 39611], // 12-Jun-2008 + [2038, 1, 19, 50424], // PHP 32-bit Latest Date 19-Jan-2038 + [1903, 5, 18, 13, 37, 46, 1234.56789], // 18-May-1903 13:37:46 + [1933, 10, 18, 16, 17, 37, 12345.6789], // 18-Oct-1933 16:17:37 ]; diff --git a/tests/data/Shared/Date/TimestampToExcel1900.php b/tests/data/Shared/Date/TimestampToExcel1900.php index 22acbb6f..fe55ef66 100644 --- a/tests/data/Shared/Date/TimestampToExcel1900.php +++ b/tests/data/Shared/Date/TimestampToExcel1900.php @@ -2,15 +2,15 @@ // Unix TimeStamp Result Comments return [ - [-2147472000, 714], // PHP 32-bit Earliest Date 14-Dec-1901 - [-2082931200, 1461], // 31-Dec-1903 - [-2082844800, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 - [-2082758400, 1463], // 02-Jan-1904 - [-285120000, 22269], // 19-Dec-1960 - [0, 25569], // PHP Base Date 01-Jan-1970 - [408067200, 30292], // 07-Dec-1982 - [1213228800, 39611], // 12-Jun-2008 - [2147472000, 50424], // PHP 32-bit Latest Date 19-Jan-2038 - [-2102494934, 1234.56789], // 18-May-1903 13:37:46 - [-1142494943, 12345.6789], // 18-Oct-1933 16:17:37 + [-2147472000, 714], // PHP 32-bit Earliest Date 14-Dec-1901 + [-2082931200, 1461], // 31-Dec-1903 + [-2082844800, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 + [-2082758400, 1463], // 02-Jan-1904 + [-285120000, 22269], // 19-Dec-1960 + [0, 25569], // PHP Base Date 01-Jan-1970 + [408067200, 30292], // 07-Dec-1982 + [1213228800, 39611], // 12-Jun-2008 + [2147472000, 50424], // PHP 32-bit Latest Date 19-Jan-2038 + [-2102494934, 1234.56789], // 18-May-1903 13:37:46 + [-1142494943, 12345.6789], // 18-Oct-1933 16:17:37 ]; diff --git a/tests/data/Shared/Date/TimestampToExcel1904.php b/tests/data/Shared/Date/TimestampToExcel1904.php index 93f5b700..95027cca 100644 --- a/tests/data/Shared/Date/TimestampToExcel1904.php +++ b/tests/data/Shared/Date/TimestampToExcel1904.php @@ -2,10 +2,10 @@ // Excel DateTimeStamp Result return [ - [-1956528000, 1462], - [-1956441600, 1463], - [-158803200, 22269], - [126316800, 25569], - [534384000, 30292], - [1339545600, 39611], + [-1956528000, 1462], + [-1956441600, 1463], + [-158803200, 22269], + [126316800, 25569], + [534384000, 30292], + [1339545600, 39611], ];