找到相关文件PhpSpreadsheet/Style/NumberFormat.php
使用
$spreadsheet->getActiveSheet()->getStyle('A')->getNumberFormat()->setFormatCode('@');//将A设置成文本 @ $spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat()->setFormatCode('@'); //将A1列设置成文本 @ $spreadsheet->getActiveSheet()->getStyle('A')->getNumberFormat()->setFormatCode('_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)');//设置单元格为会计专用
标签:setFormatCode,单元格,导出,spreadsheet,getNumberFormat,getStyle,PHPExcel,getActiveShee From: https://www.cnblogs.com/zhangyouwu/p/16593270.html