Minor changes, mainly cosmetic
This commit is contained in:
parent
cc17d2fef9
commit
99c6fed1e0
File diff suppressed because it is too large
Load Diff
|
|
@ -14,8 +14,8 @@ $worksheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
['ID', 'First Name', 'Last Name', 'Salary'],
|
['ID', 'First Name', 'Last Name', 'Salary'],
|
||||||
[72, 'Emily', 'Smith', 64901, null, 'ID', 53, 66, 56],
|
[72, 'Emily', 'Smith', 64901],
|
||||||
[66, 'James', 'Anderson', 70855, null, 'Salary'],
|
[66, 'James', 'Anderson', 70855],
|
||||||
[14, 'Mia', 'Clark', 188657],
|
[14, 'Mia', 'Clark', 188657],
|
||||||
[30, 'John', 'Lewis', 97566],
|
[30, 'John', 'Lewis', 97566],
|
||||||
[53, 'Jessica', 'Walker', 58339],
|
[53, 'Jessica', 'Walker', 58339],
|
||||||
|
|
@ -25,11 +25,24 @@ $data = [
|
||||||
|
|
||||||
$worksheet->fromArray($data, null, 'B2');
|
$worksheet->fromArray($data, null, 'B2');
|
||||||
|
|
||||||
$worksheet->getCell('H4')->setValue('=VLOOKUP(H3, B3:E9, 4, FALSE)');
|
$lookupFields = [
|
||||||
$worksheet->getCell('I4')->setValue('=VLOOKUP(I3, B3:E9, 4, FALSE)');
|
['ID', 53, 66, 56],
|
||||||
$worksheet->getCell('J4')->setValue('=VLOOKUP(J3, B3:E9, 4, FALSE)');
|
['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) {
|
for ($column = 'H'; $column !== 'K'; ++$column) {
|
||||||
$cell = $worksheet->getCell("{$column}4");
|
for ($row = 4; $row <= 5; ++$row) {
|
||||||
$helper->log("{$column}4: {$cell->getValue()} => {$cell->getCalculatedValue()}");
|
$cell = $worksheet->getCell("{$column}{$row}");
|
||||||
|
$helper->log("{$column}{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ $dataSeriesValues[2] // triangle border
|
||||||
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
|
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
|
||||||
$dataSeriesValues[2]->setScatterLines(false); // points not connected
|
$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 = new Axis();
|
||||||
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
|
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
|
||||||
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
|
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ $dataSeriesValues[2] // triangle border
|
||||||
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
|
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
|
||||||
$dataSeriesValues[2]->setScatterLines(false); // points not connected
|
$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 = new Axis();
|
||||||
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
|
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
|
||||||
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
|
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ $dataSeriesValues[2] // triangle border
|
||||||
->getMarkerBorderColor()
|
->getMarkerBorderColor()
|
||||||
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
|
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
|
||||||
$dataSeriesValues[2]->setScatterLines(false); // points not connected
|
$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 = new Axis();
|
||||||
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
|
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4756,9 +4756,8 @@ class Calculation
|
||||||
|
|
||||||
break;
|
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 === '%')) {
|
} 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) {
|
if (($arg = $stack->pop()) === null) {
|
||||||
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
|
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
|
||||||
}
|
}
|
||||||
|
|
@ -4865,9 +4864,8 @@ class Calculation
|
||||||
if (isset($storeKey)) {
|
if (isset($storeKey)) {
|
||||||
$branchStore[$storeKey] = $cellValue;
|
$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)) {
|
} 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) {
|
if ($pCellParent) {
|
||||||
$cell->attach($pCellParent);
|
$cell->attach($pCellParent);
|
||||||
}
|
}
|
||||||
|
|
@ -4977,8 +4975,8 @@ class Calculation
|
||||||
if (isset($storeKey)) {
|
if (isset($storeKey)) {
|
||||||
$branchStore[$storeKey] = $token;
|
$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)) {
|
} 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];
|
$definedName = $matches[6];
|
||||||
if ($cell === null || $pCellWorksheet === null) {
|
if ($cell === null || $pCellWorksheet === null) {
|
||||||
return $this->raiseFormulaError("undefined name '$token'");
|
return $this->raiseFormulaError("undefined name '$token'");
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class Random
|
||||||
*/
|
*/
|
||||||
public static function rand()
|
public static function rand()
|
||||||
{
|
{
|
||||||
return (mt_rand(0, 10000000)) / 10000000;
|
return mt_rand(0, 10000000) / 10000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ class Averages extends AggregateBase
|
||||||
$args,
|
$args,
|
||||||
function ($value) {
|
function ($value) {
|
||||||
// Is it a numeric value?
|
// Is it a numeric value?
|
||||||
return (is_numeric($value)) && (!is_string($value));
|
return is_numeric($value) && (!is_string($value));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class ChiSquared
|
||||||
return 1 - self::distributionRightTail($value, $degrees);
|
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));
|
((2 ** ($degrees / 2)) * Gamma::gammaValue($degrees / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ class Xlsx extends BaseReader
|
||||||
$propertyReader->readCustomProperties($this->getFromZipArchive($zip, $relTarget));
|
$propertyReader->readCustomProperties($this->getFromZipArchive($zip, $relTarget));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Ribbon
|
// Ribbon
|
||||||
case Namespaces::EXTENSIBILITY:
|
case Namespaces::EXTENSIBILITY:
|
||||||
$customUI = $relTarget;
|
$customUI = $relTarget;
|
||||||
if ($customUI) {
|
if ($customUI) {
|
||||||
|
|
@ -1695,8 +1695,8 @@ class Xlsx extends BaseReader
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// unparsed
|
|
||||||
case 'application/vnd.ms-excel.controlproperties+xml':
|
case 'application/vnd.ms-excel.controlproperties+xml':
|
||||||
|
// unparsed
|
||||||
$unparsedLoadedData['override_content_types'][(string) $contentType['PartName']] = (string) $contentType['ContentType'];
|
$unparsedLoadedData['override_content_types'][(string) $contentType['PartName']] = (string) $contentType['ContentType'];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -1722,7 +1722,6 @@ class Xlsx extends BaseReader
|
||||||
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $is->t));
|
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $is->t));
|
||||||
} else {
|
} else {
|
||||||
if (is_object($is->r)) {
|
if (is_object($is->r)) {
|
||||||
|
|
||||||
/** @var SimpleXMLElement $run */
|
/** @var SimpleXMLElement $run */
|
||||||
foreach ($is->r as $run) {
|
foreach ($is->r as $run) {
|
||||||
if (!isset($run->rPr)) {
|
if (!isset($run->rPr)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue