Skip to content

Commit 94a5289

Browse files
authored
Update Excel.php
1 parent 61ab86f commit 94a5289

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Utils/Excel.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ public static function handleCalculateSheet(Event $event)
3636
{
3737
$sheet = Excel::getSheet($event);
3838

39+
['row' => $maxRow, 'column' => $maxColName] = $sheet->getHighestRowAndColumn();
40+
3941
// A=65
40-
$maxCol = ord($sheet->getHighestColumn()) - 64;
42+
$maxCol = ord($maxColName) - 64;
4143
$maxColName = chr($maxCol + 65);
42-
$maxRow = $sheet->getHighestRow();
4344

4445
foreach (range(0, $maxRow) as $row) {
4546
foreach (range(0, $maxCol) as $col) {
@@ -140,10 +141,11 @@ public static function handleRequireCellTextColorForRed(Event $event)
140141
{
141142
$sheet = Excel::getSheet($event);
142143

144+
['row' => $maxRow, 'column' => $maxColName] = $sheet->getHighestRowAndColumn();
145+
143146
// A=65
144-
$maxCol = ord($sheet->getHighestColumn()) - 64;
147+
$maxCol = ord($maxColName) - 64;
145148
$maxColName = chr($maxCol + 65);
146-
$maxRow = $sheet->getHighestRow();
147149

148150
foreach (range(0, $maxRow) as $row) {
149151
foreach (range(0, $maxCol) as $col) {

0 commit comments

Comments
 (0)