Minor changes, mainly cosmetic

This commit is contained in:
MarkBaker 2022-08-24 08:33:57 +02:00
parent cc17d2fef9
commit 99c6fed1e0
18 changed files with 560 additions and 564 deletions

1014
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,8 @@ $worksheet = $spreadsheet->getActiveSheet();
$data = [
['ID', 'First Name', 'Last Name', 'Salary'],
[72, 'Emily', 'Smith', 64901, null, 'ID', 53, 66, 56],
[66, 'James', 'Anderson', 70855, null, 'Salary'],
[72, 'Emily', 'Smith', 64901],
[66, 'James', 'Anderson', 70855],
[14, 'Mia', 'Clark', 188657],
[30, 'John', 'Lewis', 97566],
[53, 'Jessica', 'Walker', 58339],
@ -25,11 +25,24 @@ $data = [
$worksheet->fromArray($data, null, 'B2');
$worksheet->getCell('H4')->setValue('=VLOOKUP(H3, B3:E9, 4, FALSE)');
$worksheet->getCell('I4')->setValue('=VLOOKUP(I3, B3:E9, 4, FALSE)');
$worksheet->getCell('J4')->setValue('=VLOOKUP(J3, B3:E9, 4, FALSE)');
$lookupFields = [
['ID', 53, 66, 56],
['Name'],
['Salary'],
];
$worksheet->fromArray($lookupFields, null, 'G3');
$worksheet->getCell('H4')->setValue('=VLOOKUP(H3, B3:E9, 2, FALSE) & " " & VLOOKUP(H3, B3:E9, 3, FALSE)');
$worksheet->getCell('I4')->setValue('=VLOOKUP(I3, B3:E9, 2, FALSE) & " " & VLOOKUP(I3, B3:E9, 3, FALSE)');
$worksheet->getCell('J4')->setValue('=VLOOKUP(J3, B3:E9, 2, FALSE) & " " & VLOOKUP(J3, B3:E9, 3, FALSE)');
$worksheet->getCell('H5')->setValue('=VLOOKUP(H3, B3:E9, 4, FALSE)');
$worksheet->getCell('I5')->setValue('=VLOOKUP(I3, B3:E9, 4, FALSE)');
$worksheet->getCell('J5')->setValue('=VLOOKUP(J3, B3:E9, 4, FALSE)');
for ($column = 'H'; $column !== 'K'; ++$column) {
$cell = $worksheet->getCell("{$column}4");
$helper->log("{$column}4: {$cell->getValue()} => {$cell->getCalculatedValue()}");
for ($row = 4; $row <= 5; ++$row) {
$cell = $worksheet->getCell("{$column}{$row}");
$helper->log("{$column}{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}");
}
}

View File

@ -120,7 +120,7 @@ $dataSeriesValues[2] // triangle border
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$dataSeriesValues[2]->setScatterLines(false); // points not connected
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
$xAxis = new Axis();
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);

View File

@ -120,7 +120,7 @@ $dataSeriesValues[2] // triangle border
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$dataSeriesValues[2]->setScatterLines(false); // points not connected
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
$xAxis = new Axis();
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);

View File

@ -121,7 +121,7 @@ $dataSeriesValues[2] // triangle border
->getMarkerBorderColor()
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$dataSeriesValues[2]->setScatterLines(false); // points not connected
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
$xAxis = new Axis();
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);

View File

@ -4756,9 +4756,8 @@ class Calculation
break;
}
// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
} elseif (($token === '~') || ($token === '%')) {
// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
if (($arg = $stack->pop()) === null) {
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
}
@ -4865,9 +4864,8 @@ class Calculation
if (isset($storeKey)) {
$branchStore[$storeKey] = $cellValue;
}
// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $token ?? '', $matches)) {
// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
if ($pCellParent) {
$cell->attach($pCellParent);
}
@ -4977,8 +4975,8 @@ class Calculation
if (isset($storeKey)) {
$branchStore[$storeKey] = $token;
}
// if the token is a named range or formula, evaluate it and push the result onto the stack
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_DEFINEDNAME . '$/miu', $token, $matches)) {
// if the token is a named range or formula, evaluate it and push the result onto the stack
$definedName = $matches[6];
if ($cell === null || $pCellWorksheet === null) {
return $this->raiseFormulaError("undefined name '$token'");

View File

@ -17,7 +17,7 @@ class Random
*/
public static function rand()
{
return (mt_rand(0, 10000000)) / 10000000;
return mt_rand(0, 10000000) / 10000000;
}
/**

View File

@ -203,7 +203,7 @@ class Averages extends AggregateBase
$args,
function ($value) {
// Is it a numeric value?
return (is_numeric($value)) && (!is_string($value));
return is_numeric($value) && (!is_string($value));
}
);
}

View File

@ -101,7 +101,7 @@ class ChiSquared
return 1 - self::distributionRightTail($value, $degrees);
}
return (($value ** (($degrees / 2) - 1) * exp(-$value / 2))) /
return ($value ** (($degrees / 2) - 1) * exp(-$value / 2)) /
((2 ** ($degrees / 2)) * Gamma::gammaValue($degrees / 2));
}

View File

@ -479,7 +479,7 @@ class Xlsx extends BaseReader
$propertyReader->readCustomProperties($this->getFromZipArchive($zip, $relTarget));
break;
//Ribbon
// Ribbon
case Namespaces::EXTENSIBILITY:
$customUI = $relTarget;
if ($customUI) {
@ -1695,8 +1695,8 @@ class Xlsx extends BaseReader
break;
// unparsed
case 'application/vnd.ms-excel.controlproperties+xml':
// unparsed
$unparsedLoadedData['override_content_types'][(string) $contentType['PartName']] = (string) $contentType['ContentType'];
break;
@ -1722,7 +1722,6 @@ class Xlsx extends BaseReader
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $is->t));
} else {
if (is_object($is->r)) {
/** @var SimpleXMLElement $run */
foreach ($is->r as $run) {
if (!isset($run->rPr)) {