This commit is contained in:
2025-09-04 07:24:06 +08:00
parent b9f770b21d
commit 334950f43d
1 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
class Excel extends Controller class Excel extends Controller
{ {
@ -118,7 +119,7 @@ class Excel extends Controller
// } // }
// 修改后的代码(强制文本格式) // 修改后的代码(强制文本格式)
use PhpOffice\PhpSpreadsheet\Cell\DataType; // 确保顶部已引入 // use PhpOffice\PhpSpreadsheet\Cell\DataType; // 确保顶部已引入
foreach ($data as $rowIndex => $rowData) { foreach ($data as $rowIndex => $rowData) {
for ($colIndex = 0; $colIndex < $columnCount; $colIndex++) { for ($colIndex = 0; $colIndex < $columnCount; $colIndex++) {