File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
src/PhpSpreadsheet/Worksheet
tests/PhpSpreadsheetTests/Writer Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -685,6 +685,7 @@ public function calculateColumnWidths(): static
685
685
{
686
686
$ activeSheet = $ this ->getParent ()?->getActiveSheetIndex();
687
687
$ selectedCells = $ this ->selectedCells ;
688
+ $ activeCell = $ this ->activeCell ;
688
689
// initialize $autoSizes array
689
690
$ autoSizes = [];
690
691
foreach ($ this ->getColumnDimensions () as $ colDimension ) {
@@ -786,6 +787,7 @@ public function calculateColumnWidths(): static
786
787
$ this ->getParent ()?->setActiveSheetIndex($ activeSheet );
787
788
}
788
789
$ this ->selectedCells = $ selectedCells ;
790
+ $ this ->activeCell = $ activeCell ;
789
791
790
792
return $ this ;
791
793
}
Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ public function testRetainAutoSize(string $type): void
115
115
$ sheet2 ->setSelectedCells ('C3 ' );
116
116
$ sheet3 ->setSelectedCells ('D4 ' );
117
117
$ spreadsheet ->setActiveSheetIndex (1 );
118
+ $ activeCellSheet1 = $ sheet1 ->getActiveCell ();
119
+ $ activeCellSheet2 = $ sheet2 ->getActiveCell ();
120
+ $ activeCellSheet3 = $ sheet3 ->getActiveCell ();
118
121
119
122
$ this ->fileName = File::temporaryFilename ();
120
123
$ writer = IOFactory::createWriter ($ spreadsheet , $ type );
@@ -124,6 +127,9 @@ public function testRetainAutoSize(string $type): void
124
127
self ::assertSame ('B2 ' , $ spreadsheet ->getSheet (0 )->getSelectedCells ());
125
128
self ::assertSame ('C3 ' , $ spreadsheet ->getSheet (1 )->getSelectedCells ());
126
129
self ::assertSame ('D4 ' , $ spreadsheet ->getSheet (2 )->getSelectedCells ());
130
+ self ::assertSame ($ activeCellSheet1 , $ spreadsheet ->getSheet (0 )->getActiveCell ());
131
+ self ::assertSame ($ activeCellSheet2 , $ spreadsheet ->getSheet (1 )->getActiveCell ());
132
+ self ::assertSame ($ activeCellSheet3 , $ spreadsheet ->getSheet (2 )->getActiveCell ());
127
133
128
134
$ spreadsheet ->disconnectWorksheets ();
129
135
}
You can’t perform that action at this time.
0 commit comments