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)
2219
2219
$ highestColumnIndex = Coordinate::columnIndexFromString ($ highestColumn );
2220
2220
$ pColumnIndex = Coordinate::columnIndexFromString ($ column );
2221
2221
2222
- if ($ pColumnIndex > $ highestColumnIndex ) {
2223
- return $ this ;
2224
- }
2225
-
2226
2222
$ holdColumnDimensions = $ this ->removeColumnDimensions ($ pColumnIndex , $ numberOfColumns );
2227
2223
2228
2224
$ column = Coordinate::stringFromColumnIndex ($ pColumnIndex + $ numberOfColumns );
2229
2225
$ objReferenceHelper = ReferenceHelper::getInstance ();
2230
2226
$ objReferenceHelper ->insertNewBefore ($ column . '1 ' , -$ numberOfColumns , 0 , $ this );
2231
2227
2228
+ $ this ->columnDimensions = $ holdColumnDimensions ;
2229
+
2230
+ if ($ pColumnIndex > $ highestColumnIndex ) {
2231
+ return $ this ;
2232
+ }
2233
+
2232
2234
$ maxPossibleColumnsToBeRemoved = $ highestColumnIndex - $ pColumnIndex + 1 ;
2233
2235
2234
2236
for ($ c = 0 , $ n = min ($ maxPossibleColumnsToBeRemoved , $ numberOfColumns ); $ c < $ n ; ++$ c ) {
2235
2237
$ this ->getCellCollection ()->removeColumn ($ highestColumn );
2236
2238
$ highestColumn = Coordinate::stringFromColumnIndex (Coordinate::columnIndexFromString ($ highestColumn ) - 1 );
2237
2239
}
2238
2240
2239
- $ this ->columnDimensions = $ holdColumnDimensions ;
2240
-
2241
2241
$ this ->garbageCollect ();
2242
2242
2243
2243
return $ this ;
You can’t perform that action at this time.
0 commit comments