正在显示
1 个修改的文件
包含
7 行增加
和
2 行删除
@@ -354,6 +354,10 @@ class OrderController extends AdminBaseController | @@ -354,6 +354,10 @@ class OrderController extends AdminBaseController | ||
354 | $objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20); | 354 | $objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20); |
355 | $objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20); | 355 | $objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20); |
356 | $objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20); | 356 | $objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20); |
357 | + // 设置水平居中 | ||
358 | + $objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER); | ||
359 | + // 设置垂直居中 | ||
360 | + $objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER); | ||
357 | //Add some data | 361 | //Add some data |
358 | $objPHPExcel->setActiveSheetIndex(0) | 362 | $objPHPExcel->setActiveSheetIndex(0) |
359 | ->setCellValue('A1', 'ID') | 363 | ->setCellValue('A1', 'ID') |
@@ -434,7 +438,8 @@ class OrderController extends AdminBaseController | @@ -434,7 +438,8 @@ class OrderController extends AdminBaseController | ||
434 | ->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING); | 438 | ->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING); |
435 | } elseif($vs['type'] == 8) { | 439 | } elseif($vs['type'] == 8) { |
436 | // 导出图片格式,高度自适应 | 440 | // 导出图片格式,高度自适应 |
437 | - if(!empty($vs['user_choose']) && file_exists('./upload/'.$vs['user_choose'])) { | 441 | + $filePath = './upload/'.$vs['user_choose']; |
442 | + if(!empty($vs['user_choose']) && file_exists($filePath)) { | ||
438 | $image = \think\Image::open('./upload/'.$vs['user_choose']); | 443 | $image = \think\Image::open('./upload/'.$vs['user_choose']); |
439 | // 返回图片的宽度 | 444 | // 返回图片的宽度 |
440 | $width = $image->width(); | 445 | $width = $image->width(); |
@@ -445,7 +450,7 @@ class OrderController extends AdminBaseController | @@ -445,7 +450,7 @@ class OrderController extends AdminBaseController | ||
445 | $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default); | 450 | $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default); |
446 | // 图片生成 | 451 | // 图片生成 |
447 | $objDrawing[$i] = new \PHPExcel_Worksheet_Drawing(); | 452 | $objDrawing[$i] = new \PHPExcel_Worksheet_Drawing(); |
448 | - $objDrawing[$i]->setPath('./upload/'.$vs['user_choose']); | 453 | + $objDrawing[$i]->setPath($filePath); |
449 | // 设置宽度 | 454 | // 设置宽度 |
450 | $objDrawing[$i]->setWidth(100); //照片宽度 | 455 | $objDrawing[$i]->setWidth(100); //照片宽度 |
451 | /*设置图片要插入的单元格*/ | 456 | /*设置图片要插入的单元格*/ |
-
请 注册 或 登录 后发表评论