Skip to content

Commit f8bf508

Browse files
authored
Merge branch 'master' into issue4311b
2 parents 3d98d34 + eacaa25 commit f8bf508

23 files changed

+289
-41
lines changed

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com)
66
and this project adheres to [Semantic Versioning](https://semver.org).
77

8-
## TBD - 3.8.0
8+
## TBD - 3.9.0
99

1010
### Added
1111

12-
- CHOOSECOLS, CHOOSEROWS, DROP, TAKE, and EXPAND. [PR #4286](https://github.com/PHPOffice/PhpSpreadsheet/pull/4286)
12+
- Nothing yet.
1313

1414
### Changed
1515

@@ -25,7 +25,20 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2525

2626
### Fixed
2727

28+
- Nothing yet.
29+
30+
## 2025-01-11 - 3.8.0
31+
32+
### Added
33+
34+
- CHOOSECOLS, CHOOSEROWS, DROP, TAKE, and EXPAND. [PR #4286](https://github.com/PHPOffice/PhpSpreadsheet/pull/4286)
35+
36+
### Fixed
37+
38+
- Security patch for Html navigation.
2839
- Xlsx Reader Shared Formula with Boolean Result. Partial solution for [Issue #4280](https://github.com/PHPOffice/PhpSpreadsheet/issues/4280) [PR #4281](https://github.com/PHPOffice/PhpSpreadsheet/pull/4281)
40+
- Retitling cloned Worksheets. [Issue #641](https://github.com/PHPOffice/PhpSpreadsheet/issues/641) [PR #4302](https://github.com/PHPOffice/PhpSpreadsheet/pull/4302)
41+
- Extremely limited support for GROUPBY function. Partial response to [Issue #4282](https://github.com/PHPOffice/PhpSpreadsheet/issues/4282) [PR #4283](https://github.com/PHPOffice/PhpSpreadsheet/pull/4283)
2942

3043
## 2024-12-26 - 3.7.0
3144

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 PhpSpreadsheet Authors
3+
Copyright (c) 2019-2025 PhpSpreadsheet Authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/references/function-list-by-category.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ EXPAND | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Choos
249249
FILTER | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Filter::filter
250250
FORMULATEXT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Formula::text
251251
GETPIVOTDATA | **Not yet Implemented**
252+
GROUPBY | **Not yet Implemented**
252253
HLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\HLookup::lookup
253254
HYPERLINK | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Hyperlink::set
254255
INDEX | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Matrix::index

docs/references/function-list-by-name.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ GCD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpread
239239
GEOMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages\Mean::geometric
240240
GESTEP | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Compare::GESTEP
241241
GETPIVOTDATA | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented**
242+
GROUPBY | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented**
242243
GROWTH | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::GROWTH
243244

244245
## H

docs/topics/recipes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ getStyle('A1:M500'), rather than styling the cells individually in a
925925
loop. This is much faster compared to looping through cells and styling
926926
them individually.
927927

928+
**Tip** If you are styling entire row(s) or column(s), e.g. getStyle('A:A'), it is recommended to use applyFromArray as described below rather than setting the styles individually as described above.
929+
928930
There is also an alternative manner to set styles. The following code
929931
sets a cell's style to font bold, alignment right, top border thin and a
930932
gradient fill:

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,11 @@ public static function getExcelConstants(string $key): bool|null
12561256
'functionCall' => [Functions::class, 'DUMMY'],
12571257
'argumentCount' => '2+',
12581258
],
1259+
'GROUPBY' => [
1260+
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
1261+
'functionCall' => [Functions::class, 'DUMMY'],
1262+
'argumentCount' => '3-7',
1263+
],
12591264
'GROWTH' => [
12601265
'category' => Category::CATEGORY_STATISTICAL,
12611266
'functionCall' => [Statistical\Trends::class, 'GROWTH'],
@@ -4601,7 +4606,7 @@ private static function dataTestReference(array &$operandData): mixed
46014606
private static int $matchIndex10 = 10;
46024607

46034608
/**
4604-
* @return array<int, mixed>|false
4609+
* @return array<int, mixed>|false|string
46054610
*/
46064611
private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell $cell = null)
46074612
{
@@ -5182,6 +5187,9 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
51825187
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_DEFINEDNAME . '$/miu', $token, $matches)) {
51835188
// if the token is a named range or formula, evaluate it and push the result onto the stack
51845189
$definedName = $matches[6];
5190+
if (str_starts_with($definedName, '_xleta')) {
5191+
return Functions::NOT_YET_IMPLEMENTED;
5192+
}
51855193
if ($cell === null || $pCellWorksheet === null) {
51865194
return $this->raiseFormulaError("undefined name '$token'");
51875195
}
@@ -5214,6 +5222,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
52145222
}
52155223

52165224
$result = $this->evaluateDefinedName($cell, $namedRange, $pCellWorksheet, $stack, $specifiedWorksheet !== '');
5225+
52175226
if (isset($storeKey)) {
52185227
$branchStore[$storeKey] = $result;
52195228
}

src/PhpSpreadsheet/Spreadsheet.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ public function getActiveSheet(): Worksheet
514514
public function createSheet(?int $sheetIndex = null): Worksheet
515515
{
516516
$newSheet = new Worksheet($this);
517-
$this->addSheet($newSheet, $sheetIndex);
517+
$this->addSheet($newSheet, $sheetIndex, true);
518518

519519
return $newSheet;
520520
}
@@ -535,8 +535,20 @@ public function sheetNameExists(string $worksheetName): bool
535535
* @param Worksheet $worksheet The worksheet to add
536536
* @param null|int $sheetIndex Index where sheet should go (0,1,..., or null for last)
537537
*/
538-
public function addSheet(Worksheet $worksheet, ?int $sheetIndex = null): Worksheet
538+
public function addSheet(Worksheet $worksheet, ?int $sheetIndex = null, bool $retitleIfNeeded = false): Worksheet
539539
{
540+
if ($retitleIfNeeded) {
541+
$title = $worksheet->getTitle();
542+
if ($this->sheetNameExists($title)) {
543+
$i = 1;
544+
$newTitle = "$title $i";
545+
while ($this->sheetNameExists($newTitle)) {
546+
++$i;
547+
$newTitle = "$title $i";
548+
}
549+
$worksheet->setTitle($newTitle);
550+
}
551+
}
540552
if ($this->sheetNameExists($worksheet->getTitle())) {
541553
throw new Exception(
542554
"Workbook already contains a worksheet named '{$worksheet->getTitle()}'. Rename this worksheet first."

src/PhpSpreadsheet/Worksheet/AutoFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function setEvaluated(bool $value): void
5050
/**
5151
* Create a new AutoFilter.
5252
*
53-
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
53+
* @param AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
5454
* A simple string containing a Cell range like 'A1:E10' is permitted
5555
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
5656
* or an AddressRange object.

src/PhpSpreadsheet/Worksheet/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Table implements Stringable
6464
/**
6565
* Create a new Table.
6666
*
67-
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
67+
* @param AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
6868
* A simple string containing a Cell range like 'A1:E10' is permitted
6969
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
7070
* or an AddressRange object.
@@ -268,7 +268,7 @@ public function getRange(): string
268268
/**
269269
* Set Table Cell Range.
270270
*
271-
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
271+
* @param AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
272272
* A simple string containing a Cell range like 'A1:E10' is permitted
273273
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
274274
* or an AddressRange object.

0 commit comments

Comments
 (0)