Files
oleibman 4500f5a87d Worksheet applyStylesFromArray Retain Active Cell
Fix #4128. PR #4073 introduced applyStylesFromArray method, which allowed setting styles without affecting selectedCells or activeSheet. The first use of this method was in Cell setValueExplicit to set quotePrefix appropriately. The new method did not preserve activeCell. I'm not sure why that should matter, but this seems to have caused a problem for Excel 2016. This seems to be a bug in Excel, one which is fixed in newer releases. However, PhpSpreadsheet can avoid the problem by preserving activeCell as well as selectedCells and activeSheet. This PR makes that change.
2024-08-07 08:12:47 -07:00

24 lines
672 B
PHP

<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;
class Issue4128Test extends TestCase
{
public function testIssue4128(): void
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
self::assertSame('A1', $sheet->getActiveCell());
self::assertSame('A1', $sheet->getSelectedCells());
$sheet->setCellValue('D1', 'MyDate');
self::assertSame('A1', $sheet->getActiveCell());
self::assertSame('A1', $sheet->getSelectedCells());
$spreadsheet->disconnectWorksheets();
}
}