File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/PhpSpreadsheet/Worksheet Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2219,25 +2219,25 @@ public function removeColumn($column, $numberOfColumns = 1)
22192219 $ highestColumnIndex = Coordinate::columnIndexFromString ($ highestColumn );
22202220 $ pColumnIndex = Coordinate::columnIndexFromString ($ column );
22212221
2222- if ($ pColumnIndex > $ highestColumnIndex ) {
2223- return $ this ;
2224- }
2225-
22262222 $ holdColumnDimensions = $ this ->removeColumnDimensions ($ pColumnIndex , $ numberOfColumns );
22272223
22282224 $ column = Coordinate::stringFromColumnIndex ($ pColumnIndex + $ numberOfColumns );
22292225 $ objReferenceHelper = ReferenceHelper::getInstance ();
22302226 $ objReferenceHelper ->insertNewBefore ($ column . '1 ' , -$ numberOfColumns , 0 , $ this );
22312227
2228+ $ this ->columnDimensions = $ holdColumnDimensions ;
2229+
2230+ if ($ pColumnIndex > $ highestColumnIndex ) {
2231+ return $ this ;
2232+ }
2233+
22322234 $ maxPossibleColumnsToBeRemoved = $ highestColumnIndex - $ pColumnIndex + 1 ;
22332235
22342236 for ($ c = 0 , $ n = min ($ maxPossibleColumnsToBeRemoved , $ numberOfColumns ); $ c < $ n ; ++$ c ) {
22352237 $ this ->getCellCollection ()->removeColumn ($ highestColumn );
22362238 $ highestColumn = Coordinate::stringFromColumnIndex (Coordinate::columnIndexFromString ($ highestColumn ) - 1 );
22372239 }
22382240
2239- $ this ->columnDimensions = $ holdColumnDimensions ;
2240-
22412241 $ this ->garbageCollect ();
22422242
22432243 return $ this ;
You can’t perform that action at this time.
0 commit comments