Skip to content

Commit 8d7500b

Browse files
authored
Merge branch 'master' into issue4312
2 parents 41ca105 + ed66270 commit 8d7500b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1557
-244
lines changed

CHANGELOG.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ 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+
- Methods to get style for row or column. [PR #4317](https://github.com/PHPOffice/PhpSpreadsheet/pull/4317)
13+
- Method for duplicating worksheet in spreadsheet. [PR #4315](https://github.com/PHPOffice/PhpSpreadsheet/pull/4315)
1314

1415
### Changed
1516

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

2627
### Fixed
2728

29+
- Ods Reader Sheet Names with Period. [Issue #4311](https://github.com/PHPOffice/PhpSpreadsheet/issues/4311) [PR #4313](https://github.com/PHPOffice/PhpSpreadsheet/pull/4313)
30+
- Mpdf and Tcpdf Hidden Columns and Merged Cells. [Issue #4319](https://github.com/PHPOffice/PhpSpreadsheet/issues/4319) [PR #4320](https://github.com/PHPOffice/PhpSpreadsheet/pull/4320)
31+
- Html Writer Allow mailto. [Issue #4316](https://github.com/PHPOffice/PhpSpreadsheet/issues/4316) [PR #4322](https://github.com/PHPOffice/PhpSpreadsheet/pull/4322)
32+
- Use composer/pcre rather than preg_* in Writer. [PR #4323](https://github.com/PHPOffice/PhpSpreadsheet/pull/4323)
33+
34+
## 2025-01-11 - 3.8.0
35+
36+
### Added
37+
38+
- CHOOSECOLS, CHOOSEROWS, DROP, TAKE, and EXPAND. [PR #4286](https://github.com/PHPOffice/PhpSpreadsheet/pull/4286)
39+
40+
### Fixed
41+
42+
- Security patch for Html navigation.
2843
- 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)
44+
- Retitling cloned Worksheets. [Issue #641](https://github.com/PHPOffice/PhpSpreadsheet/issues/641) [PR #4302](https://github.com/PHPOffice/PhpSpreadsheet/pull/4302)
45+
- 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)
2946

3047
## 2024-12-26 - 3.7.0
3148

LICENSE

+1-1
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.json

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"ext-xmlwriter": "*",
8080
"ext-zip": "*",
8181
"ext-zlib": "*",
82+
"composer/pcre": "^3.3",
8283
"maennchen/zipstream-php": "^2.1 || ^3.0",
8384
"markbaker/complex": "^3.0",
8485
"markbaker/matrix": "^3.0",

composer.lock

+86-86
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

+1
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

+1
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

+3
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ 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+
Also, starting with release 3.9.0, you should use getRowStyle or getColumnStyle to get the style for an entire row or column.
930+
928931
There is also an alternative manner to set styles. The following code
929932
sets a cell's style to font bold, alignment right, top border thin and a
930933
gradient fill:

docs/topics/worksheets.md

+23-4
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,38 @@ insert the clone into the workbook.
9595

9696
```php
9797
$clonedWorksheet = clone $spreadsheet->getSheetByName('Worksheet 1');
98-
$clonedWorksheet->setTitle('Copy of Worksheet 1');
98+
$clonedWorksheet->setTitle('Copy of Worksheet 1'); // must be unique
9999
$spreadsheet->addSheet($clonedWorksheet);
100100
```
101+
Starting with PhpSpreadsheet 3.9.0, this can be done more simply (copied sheet's title will be set to something unique):
102+
```php
103+
$copiedWorksheet = $spreadsheet->duplicateWorksheetByTitle('sheetname');
104+
```
101105

102106
You can also copy worksheets from one workbook to another, though this
103107
is more complex as PhpSpreadsheet also has to replicate the styling
104108
between the two workbooks. The `addExternalSheet()` method is provided for
105109
this purpose.
106110

107-
$clonedWorksheet = clone $spreadsheet1->getSheetByName('Worksheet 1');
108-
$spreadsheet->addExternalSheet($clonedWorksheet);
111+
```php
112+
$clonedWorksheet = clone $spreadsheet1->getSheetByName('Worksheet 1');
113+
$clonedWorksheet->setTitle('Copy of Worksheet 1'); // must be unique
114+
$spreadsheet1->addSheet($clonedWorksheet);
115+
$spreadsheet->addExternalSheet($clonedWorksheet);
116+
```
117+
Starting with PhpSpreadsheet 3.8.0, this can be simplified:
118+
```php
119+
$clonedWorksheet = clone $spreadsheet1->getSheetByName('Worksheet 1');
120+
$spreadsheet1->addSheet($clonedWorksheet, null, true);
121+
$spreadsheet->addExternalSheet($clonedWorksheet);
122+
```
123+
Starting with PhpSpreadsheet 3.9.0, this can be simplified even further:
124+
```php
125+
$clonedWorksheet = $spreadsheet1->duplicateWorksheetByTitle('sheetname');
126+
$spreadsheet->addExternalSheet($clonedWorksheet);
127+
```
109128

110-
In both cases, it is the developer's responsibility to ensure that
129+
In the cases commented "must be unique", it is the developer's responsibility to ensure that
111130
worksheet names are not duplicated. PhpSpreadsheet will throw an
112131
exception if you attempt to copy worksheets that will result in a
113132
duplicate name.

phpstan.neon.dist

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ includes:
22
- phpstan-baseline.neon
33
- vendor/phpstan/phpstan-phpunit/extension.neon
44
- vendor/phpstan/phpstan-phpunit/rules.neon
5+
- vendor/composer/pcre/extension.neon
56

67
parameters:
78
level: 8

samples/Pdf/21b_Pdf.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
34
use PhpOffice\PhpSpreadsheet\IOFactory;
45
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
56
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf;
@@ -21,7 +22,7 @@ function replaceBody(string $html): string
2122
</body>
2223
EOF;
2324

24-
return preg_replace($bodystring, $bodyrepl, $html) ?? '';
25+
return preg_replace($bodystring, $bodyrepl, $html) ?? throw new SpreadsheetException('preg failed');
2526
}
2627

2728
require __DIR__ . '/../Header.php';

samples/Pdf/21c_Pdf.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
34
use PhpOffice\PhpSpreadsheet\IOFactory;
45
use PhpOffice\PhpSpreadsheet\Spreadsheet;
56
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
@@ -16,7 +17,7 @@ function addHeadersFootersMpdf2000(string $html): string
1617
odd-footer-name: html_myFooter2;
1718
1819
EOF;
19-
$html = preg_replace('/@page page0 {/', $pagerepl, $html) ?? '';
20+
$html = preg_replace('/@page page0 {/', $pagerepl, $html) ?? throw new SpreadsheetException('preg 1 failed');
2021
$bodystring = '/<body>/';
2122
$simulatedBodyStart = Mpdf::SIMULATED_BODY_START;
2223
$bodyrepl = <<<EOF
@@ -40,7 +41,7 @@ function addHeadersFootersMpdf2000(string $html): string
4041
4142
EOF;
4243

43-
return preg_replace($bodystring, $bodyrepl, $html) ?? '';
44+
return preg_replace($bodystring, $bodyrepl, $html) ?? throw new SpreadsheetException('preg 2 failed');
4445
}
4546

4647
$spreadsheet = new Spreadsheet();

samples/Reading_workbook_data/Custom_properties.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
break;
4040
case 'd': // date
41-
$propertyValue = is_numeric($propertyValue) ? date('l, d<\s\u\p>S</\s\u\p> F Y g:i A', (int) $propertyValue) : '*****INVALID*****';
41+
$propertyValue = is_numeric($propertyValue) ? date('l, j<\s\u\p>S</\s\u\p> F Y g:i A', (int) $propertyValue) : '*****INVALID*****';
4242
$propertyType = 'date';
4343

4444
break;

0 commit comments

Comments
 (0)