Skip to content

Commit 823cb2d

Browse files
authored
Merge branch 'master' into atsign
2 parents e5e6bde + ffbcee6 commit 823cb2d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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.0.0
8+
## 2024-08-07 - 2.2.2
99

1010
### Dynamic Arrays
1111

@@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
3333
- RATE Function Floating Point Number of Periods. [PR #4107](https://github.com/PHPOffice/PhpSpreadsheet/pull/4107)
3434
- Parameter Name Change Xlsx Writer Workbook. [Issue #4108](https://github.com/PHPOffice/PhpSpreadsheet/issues/4108) [PR #4111](https://github.com/PHPOffice/PhpSpreadsheet/pull/4111)
3535
- New Algorithm for TRUNC, ROUNDUP, ROUNDDOWN. [Issue #4113](https://github.com/PHPOffice/PhpSpreadsheet/issues/4113) [PR #4115](https://github.com/PHPOffice/PhpSpreadsheet/pull/4115)
36+
- Worksheet applyStylesFromArray Retain Active Cell (Excel 16 was having a problem with some files). [Issue #4128](https://github.com/PHPOffice/PhpSpreadsheet/issues/4128) [PR #4132](https://github.com/PHPOffice/PhpSpreadsheet/pull/4132)
3637

3738
## 2024-07-29 - 2.2.1
3839

src/PhpSpreadsheet/Worksheet/Worksheet.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,7 +3724,9 @@ public function applyStylesFromArray(string $coordinate, array $styleArray): boo
37243724
}
37253725
$activeSheetIndex = $spreadsheet->getActiveSheetIndex();
37263726
$originalSelected = $this->selectedCells;
3727+
$originalActive = $this->activeCell;
37273728
$this->getStyle($coordinate)->applyFromArray($styleArray);
3729+
$this->activeCell = $originalActive;
37283730
$this->selectedCells = $originalSelected;
37293731
if ($activeSheetIndex >= 0) {
37303732
$spreadsheet->setActiveSheetIndex($activeSheetIndex);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
6+
7+
use PhpOffice\PhpSpreadsheet\Spreadsheet;
8+
use PHPUnit\Framework\TestCase;
9+
10+
class Issue4128Test extends TestCase
11+
{
12+
public function testIssue4128(): void
13+
{
14+
$spreadsheet = new Spreadsheet();
15+
$sheet = $spreadsheet->getActiveSheet();
16+
self::assertSame('A1', $sheet->getActiveCell());
17+
self::assertSame('A1', $sheet->getSelectedCells());
18+
$sheet->setCellValue('D1', 'MyDate');
19+
self::assertSame('A1', $sheet->getActiveCell());
20+
self::assertSame('A1', $sheet->getSelectedCells());
21+
$spreadsheet->disconnectWorksheets();
22+
}
23+
}

0 commit comments

Comments
 (0)