mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 11:02:48 +08:00
导出的表格按照字段字数设置宽度
This commit is contained in:
@@ -17,6 +17,7 @@ class ExportTools
|
|||||||
foreach ($fields as $field_key => $field_name) {
|
foreach ($fields as $field_key => $field_name) {
|
||||||
$col_key = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($write_col);
|
$col_key = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($write_col);
|
||||||
$sheet->setCellValue($col_key . $write_line, $field_name);
|
$sheet->setCellValue($col_key . $write_line, $field_name);
|
||||||
|
$sheet->getColumnDimension($col_key)->setWidth(mb_strlen($field_name) * 3);
|
||||||
|
|
||||||
$write_col++;
|
$write_col++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user