当前位置: 首页>>代码示例>>PHP>>正文


PHP Excel::create方法代码示例

本文整理汇总了PHP中Excel::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Excel::create方法的具体用法?PHP Excel::create怎么用?PHP Excel::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Excel的用法示例。


在下文中一共展示了Excel::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: makeSheet

 public function makeSheet()
 {
     $input = Input::get('name');
     $arr = [];
     for ($i = 0; $i < 10; $i++) {
         $arr[$i] = [];
         for ($j = 0; $j < 10; $j++) {
             if ($i == $j) {
                 $arr[$i][$j] = "lol";
             } else {
                 $arr[$i][$j] = "hi";
             }
         }
     }
     \Excel::create($input, function ($excel) {
         global $input;
         $excel->setTitle("hello " . $input);
         $excel->sheet('Sheeeeet!', function ($sheet) {
             $sheet->cell('A1', function ($cell) {
                 $cell->setValue('hurr,');
             });
             $sheet->cell('A2', function ($cell) {
                 $cell->setValue('durr.');
             });
         });
     })->download('xls');
     // Won't work lol
     return View::make("excel", ["message" => "Did stuff " . $input . "!"]);
 }
开发者ID:joppiesaus,项目名称:laravelhurrdurr,代码行数:29,代码来源:ExcelController.php

示例2: indexToExcel

 public function indexToExcel($fecha_inicio, $fecha_fin)
 {
     $egresos = Egreso::whereBetween('fecha', [$fecha_inicio, $fecha_fin])->whereCuentaBancariaId(1)->withTrashed()->with('benef', 'proyectos.fondos', 'cuentaBancaria', 'user', 'ocs', 'solicitudes')->orderBy('fecha', 'DESC')->get();
     foreach ($egresos as $egreso) {
         !empty($egreso->cheque) ? $cheque_poliza = $egreso->cheque : ($cheque_poliza = $egreso->poliza);
         $proyectos = '';
         $fondos = '';
         if ($egreso->cuenta_id == 1 || $egreso->cuenta_id == 2) {
             foreach ($egreso->proyectos as $proyecto) {
                 $proyectos .= $proyecto->proyecto;
                 $fondos .= $proyecto->fondos[0]->fondo;
             }
         } else {
             $proyectos = '---';
             $fondos = '---';
         }
         $id_afin = '';
         if (count($egreso->solicitudes) > 0) {
             foreach ($egreso->solicitudes as $solicitud) {
                 $id_afin = $solicitud->no_afin;
             }
         }
         $arr_egresos[] = ['Cta. Bancaria' => $egreso->cuentaBancaria->cuenta_bancaria, 'Cheque/Póliza' => $cheque_poliza, 'Fecha' => $egreso->fecha_info, 'Beneficiario' => $egreso->benef->benef, 'Concepto' => $egreso->concepto, 'Monto' => $egreso->monto, 'Cuenta Clasificadora' => $egreso->cuenta->cuenta, 'Proyecto' => $proyectos, 'Fondo' => $fondos, 'ID AFIN' => $id_afin];
     }
     \Excel::create('Egresos', function ($excel) use($arr_egresos) {
         $excel->sheet('Jul-Sep', function ($sheet) use($arr_egresos) {
             $sheet->fromArray($arr_egresos);
         });
     })->download('xls');
 }
开发者ID:armandolazarte,项目名称:guia,代码行数:30,代码来源:EgresosController.php

示例3: report

 public function report()
 {
     //add security to avoid stealing of information
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $type = Input::get('expType');
     $from = date('Ymd', strtotime(Input::get('expFrom')));
     $to = date('Ymd', strtotime(Input::get('expTo')));
     $payments = Payment::where('club_id', '=', $club->id)->with('player')->whereBetween('created_at', array($from, $to))->get();
     $param = array('transaction_type' => 'cc', 'action_type' => 'refund,sale', 'condition' => 'pendingsettlement,complete,failed', 'club' => $club->id, 'start_date' => $from . '000000', 'end_date' => $to . '235959');
     $payment = new Payment();
     $transactions = $payment->ask($param);
     //return $transactions;
     //return json_decode(json_encode($transactions->transaction),true);
     // return View::make('export.lacrosse.accounting.all')
     // ->with('payments',  $transactions->transaction);
     //return json_decode(json_encode($transactions->transaction),true);
     Excel::create('transactions', function ($excel) use($transactions) {
         $excel->sheet('Sheetname', function ($sheet) use($transactions) {
             $sheet->setOrientation('landscape');
             // first row styling and writing content
             $sheet->loadView('export.lacrosse.accounting.all')->with('payments', $transactions->transaction);
         });
     })->download('xlsx');
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:25,代码来源:ExportController.php

示例4: postPurchases

 public function postPurchases()
 {
     $input_start_date = \Input::get('start_date');
     if ($input_start_date == "") {
         $input_start_date = "01/01/1900";
     }
     $start_date = \DateTime::createFromFormat('d/m/Y', $input_start_date);
     $input_end_date = \Input::get('end_date');
     if ($input_end_date == "") {
         $end_date = new \DateTime("NOW");
     } else {
         $end_date = \DateTime::createFromFormat('d/m/Y', $input_end_date);
     }
     $data = UserPricelist::where('created_at', '>=', $start_date)->where('created_at', '<=', $end_date)->orderBy('created_at', 'desc')->get();
     if (count($data) == 0) {
         $errors = new \Illuminate\Support\MessageBag();
         $errors->add('downloadError', "There's no data within the dates specified.");
         return \Redirect::to('admin/purchases')->withErrors($errors);
     }
     \Excel::create('Redooor_Purchases_Report', function ($excel) use($data) {
         $excel->sheet('Purchases Report', function ($sheet) use($data) {
             $sheet->loadView('redminportal::reports/purchases')->with('data', $data);
         });
     })->download('csv');
 }
开发者ID:tusharvikky,项目名称:redminportal,代码行数:25,代码来源:ReportController.php

示例5: Ajax

 public static function Ajax($param)
 {
     switch ($param) {
         case 'byCategory':
             $id = e(Input::get('id'));
             $productos = Producto::where('categoria', "=", $id)->take(20)->get()->toJson();
             echo $productos;
             break;
         case 'excelByCategory':
             // print_r(Input::all());
             $catName = utf8_decode(utf8_encode(Input::get('catName')));
             $id = Input::get('id');
             $productos = Producto::where("categoria", "=", $id)->get()->toArray();
             $lista = self::formatExcel($productos);
             Excel::create("CAT" . $id, function ($excel) use($lista) {
                 $excel->sheet('productos', function ($sheet) use($lista) {
                     $sheet->fromArray($lista, null, 'A0', true);
                 });
             })->store('xls', public_path('/exports/categoria'));
             echo url("exports/categoria/CAT" . $id . ".xls");
             break;
         default:
             # code...
             break;
     }
 }
开发者ID:EzequielDot175,项目名称:marelli,代码行数:26,代码来源:Producto.php

示例6: getRelatorioOperacoes

 public static function getRelatorioOperacoes()
 {
     Excel::create('Planilha de Controle da Farmacia - Ocorrencias', function ($excel) {
         $excel->sheet('Ref. ', function ($sheet) {
             $sheet->mergeCells('A1:J5');
             $sheet->setHeight(1, 50);
             $sheet->row(1, function ($row) {
                 $row->setFontFamily('Arial');
                 $row->setFontSize(20);
             });
             $sheet->cell('A1', function ($cell) {
                 $cell->setAlignment('center');
             });
             $sheet->getStyle('D')->getAlignment()->setWrapText(true);
             $sheet->row(1, array('Frizelo Frigorificos Ltda.'));
             $periodo = explode('-', Input::get('periodo'));
             $a = [];
             foreach (Ocorrencia::whereBetween('data_hora', $periodo)->get() as $val) {
                 $a[] = ['Nome' => $val->colaborador->nome, 'Setor' => !empty($val->colaborador->setor->descricao) ? $val->colaborador->setor->descricao : null, 'Data' => $val->data_hora, 'Queixa' => empty($val->queixa->descricao) ? null : $val->queixa->descricao, 'Descrição / Motivo' => $val->relato . ' - ' . $val->diagnostico, 'Conduta / Destino' => $val->conduta . ' - ' . $val->destino];
             }
             $sheet->setAutoFilter('A6:J6');
             $sheet->setOrientation('landscape');
             $sheet->fromArray($a, null, 'A6', true);
         });
     })->export('xls');
 }
开发者ID:kuell,项目名称:buriti,代码行数:26,代码来源:Ocorrencia.php

示例7: export

 /**
  * Export students (query in session) to excel
  *
  * @return mixed
  */
 public function export()
 {
     $students = $this->search->createQuery(session('students')) ? $this->search->createQuery(session('students'))->get() : Student::get();
     return \Excel::create('Students', function ($excel) use($students) {
         $excel->sheet('students', function ($sheet) use($students) {
             $sheet->fromArray($students->toArray());
         });
     })->download('xls');
 }
开发者ID:arielmagbanua,项目名称:sis_test,代码行数:14,代码来源:ReportsController.php

示例8: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $devices = Device::all();
     \Excel::create("Device List", function ($excel) use($devices) {
         $excel->sheet('Sheet1', function ($sheet) use($devices) {
             $sheet->fromModel($devices, null, 'A1', true);
         })->download('xls');
     });
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:14,代码来源:DeviceController.php

示例9: writeExcel

 public function writeExcel()
 {
     dd(\Schema::getColumnListing());
     Excel::create('Filename', function ($excel) {
         $excel->sheet('Sheetname', function ($sheet) {
             // Sheet manipulation
         });
     })->store('xlsx', storage_path('excel'));
 }
开发者ID:antron,项目名称:exceldb,代码行数:9,代码来源:Exceldb.php

示例10: export

 /**
  * Export students (query in session) to excel
  *
  * @return mixed
  */
 public function export()
 {
     $students = session()->has('students') ? session('students')->get() : Student::get();
     return \Excel::create('Students', function ($excel) use($students) {
         $excel->sheet('students', function ($sheet) use($students) {
             $sheet->fromArray($students->toArray());
         });
     })->download('xls');
 }
开发者ID:ljiriko,项目名称:hp_test1,代码行数:14,代码来源:ReportsController.php

示例11: generarExcel

 private function generarExcel($vista, $data)
 {
     $nom_reporte = $this->nombreReporte($vista);
     \Excel::create($nom_reporte, function ($excel) use($vista, $data) {
         $excel->sheet('Hoja 1', function ($sheet) use($vista, $data) {
             $sheet->loadView($vista, $data);
             //$sheet->getStyle('A:E')->getAlignment()->setWrapText(true);
         });
     })->download('xls');
 }
开发者ID:richarrieta,项目名称:miequipo,代码行数:10,代码来源:Reporte.php

示例12: getsheet

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getsheet()
 {
     $inputs = Input::all();
     $input = (object) $inputs;
     $subjects = Subject::select('name')->where('class', $input->class)->orderby('code', 'asc')->get();
     if (count($subjects) < 1) {
         return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "There are not subjects for this class!");
     }
     $students = Student::select('regiNo', 'firstName', 'middleName', 'lastName')->where('class', $input->class)->where('section', $input->section)->where('session', trim($input->session))->where('shift', $input->shift)->get();
     if (count($students) < 1) {
         return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "There are not student for this class!");
     }
     $merit = DB::table('MeritList')->select('regiNo', 'grade', 'point', 'totalNo')->where('exam', $input->exam)->where('class', $input->class)->where('session', trim($input->session))->orderBy('point', 'DESC')->orderBy('totalNo', 'DESC')->get();
     if (count($merit) < 1) {
         return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "Marks not submit or result not generate for this exam!");
     }
     foreach ($students as $student) {
         $marks = Marks::select('written', 'mcq', 'practical', 'ca', 'total', 'grade', 'point')->where('regiNo', $student->regiNo)->where('exam', $input->exam)->orderby('subject', 'asc')->get();
         if (count($marks) < 1) {
             return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "Marks not submited yet!");
         }
         /*$marks = DB::table('Marks')
           ->join('MeritList', 'Marks.regiNo', '=', 'MeritList.regiNo')
           ->select('Marks.written','Marks.mcq', 'Marks.practical', 'Marks.ca', 'Marks.total', 'Marks.grade', 'Marks.point', 'MeritList.totalNo', 'MeritList.grade as tgrade','MeritList.point as tpoint')
           ->where('Marks.regiNo',$student->regiNo)
           ->where('Marks.exam', '=',$input->exam)
           ->orderby('Marks.subject','asc')
           ->get();*/
         $meritdata = new Meritdata();
         $position = 0;
         foreach ($merit as $m) {
             $position++;
             if ($m->regiNo === $student->regiNo) {
                 $meritdata->regiNo = $m->regiNo;
                 $meritdata->point = $m->point;
                 $meritdata->grade = $m->grade;
                 $meritdata->position = $position;
                 $meritdata->totalNo = $m->totalNo;
                 break;
             }
         }
         $student->marks = $marks;
         $student->meritdata = $meritdata;
     }
     $cl = ClassModel::Select('name')->where('code', $input->class)->first();
     $input->class = $cl->name;
     $fileName = $input->class . '-' . $input->section . '-' . $input->session . '-' . $input->exam;
     // return $students;
     Excel::create($fileName, function ($excel) use($input, $subjects, $students) {
         $excel->sheet('New sheet', function ($sheet) use($input, $subjects, $students) {
             $sheet->loadView('app.excel', compact('subjects', 'input', 'students'));
         });
     })->download('xlsx');
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:59,代码来源:tabulationController.php

示例13: export

 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function export($orders, $details = null)
 {
     \Excel::create('Export Commandes', function ($excel) use($orders, $details) {
         $excel->sheet('Export_Commandes', function ($sheet) use($orders, $details) {
             $names = config('columns.names');
             $view = isset($details) ? 'details' : 'orders';
             $sheet->setOrientation('landscape');
             $sheet->loadView('backend.export.' . $view, ['orders' => $orders, 'generator' => $this->generator, 'names' => $names]);
         });
     })->export('xls');
 }
开发者ID:abada,项目名称:webshop,代码行数:16,代码来源:OrderController.php

示例14: getExcel

 public static function getExcel($data, $filename = null)
 {
     if (!$filename) {
         $filename = \Str::slug('statistics' . '_' . time());
     }
     return \Excel::create($filename, function ($excel) use($data) {
         $excel->sheet('sheet1', function ($sheet) use($data) {
             $sheet->fromModel($data, null, 'A1', true);
         });
     })->download('xls');
 }
开发者ID:ArturKp,项目名称:bloglyzer,代码行数:11,代码来源:ExcelService.php

示例15: xlStockOut

 public function xlStockOut()
 {
     $data = StockOut::getAllProductsStackOutExl();
     $data = array_map(function ($data) {
         return json_decode(json_encode($data), true);
     }, $data);
     Excel::create('Stock_Out_Product_List', function ($excel) use($data) {
         $excel->sheet('Sheetname', function ($sheet) use($data) {
             $sheet->fromArray($data);
         });
     })->export('xls');
 }
开发者ID:sarkerbappa,项目名称:Laravel-Simple-Inventory-Managment-system-,代码行数:12,代码来源:StockOutController.php


注:本文中的Excel::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。