...
|
...
|
@@ -312,6 +312,7 @@ class OrderController extends AdminBaseController |
|
|
//导出Excel
|
|
|
$objPHPExcel = new \PHPExcel();
|
|
|
|
|
|
// 设置单元格宽度
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
|
...
|
...
|
@@ -400,6 +401,7 @@ class OrderController extends AdminBaseController |
|
|
|
|
|
$i = 2;
|
|
|
|
|
|
// 循环到导出数据
|
|
|
foreach ($array as $v) {
|
|
|
$status = '未支付';
|
|
|
if($v['status'] == 1) {
|
...
|
...
|
@@ -427,9 +429,11 @@ class OrderController extends AdminBaseController |
|
|
];
|
|
|
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
|
|
|
if($vs['type'] == 3) {
|
|
|
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
|
|
|
$objPHPExcel->setActiveSheetIndex(0)
|
|
|
->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
|
|
|
} elseif($vs['type'] == 8) {
|
|
|
// 导出图片格式,高度自适应
|
|
|
if(!empty($vs['user_choose']) && file_exists('./upload/'.$vs['user_choose'])) {
|
|
|
$image = \think\Image::open('./upload/'.$vs['user_choose']);
|
|
|
// 返回图片的宽度
|
...
|
...
|
@@ -437,13 +441,12 @@ class OrderController extends AdminBaseController |
|
|
// 返回图片的高度
|
|
|
$height = $image->height();
|
|
|
$default = $height/($width/100);
|
|
|
//设置默认行高
|
|
|
//设置默认行高(通过图片缩放比例计算高度)
|
|
|
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default);
|
|
|
// 图片生成
|
|
|
$objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();
|
|
|
$objDrawing[$i]->setPath('./upload/'.$vs['user_choose']);
|
|
|
// 设置宽度高度
|
|
|
$objDrawing[$i]->setHeight(100);//照片高度
|
|
|
// 设置宽度
|
|
|
$objDrawing[$i]->setWidth(100); //照片宽度
|
|
|
/*设置图片要插入的单元格*/
|
|
|
$objDrawing[$i]->setCoordinates($vs['cell'].$i);
|
...
|
...
|
|