From 6ea41190c97f1dc83a389430e88d1b76379e3699 Mon Sep 17 00:00:00 2001 From: augushong Date: Sun, 17 Apr 2022 21:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=BC=BA=E5=88=B6=E4=B8=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/tools/ExcelTools.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/common/tools/ExcelTools.php b/app/common/tools/ExcelTools.php index f4ef6c1..1b7a623 100644 --- a/app/common/tools/ExcelTools.php +++ b/app/common/tools/ExcelTools.php @@ -2,6 +2,8 @@ namespace app\common\tools; +use PhpOffice\PhpSpreadsheet\Cell\DataType; + class ExcelTools { public static function exportModel($model, $where = [], $fields = [], $image_fields = [], $select_fields = []) @@ -70,7 +72,7 @@ class ExcelTools $cel = $value; } - $sheet->setCellValue($col_key . $write_line, $cel); + $sheet->setCellValueExplicit($col_key . $write_line, $cel,DataType::TYPE_STRING); $write_col++; } }