我是 Laravel 的初学者,我在我的项目中使用 Laravel 5.8。
我有生成PDF文件的功能:
public function getCalendar(Request $request)
{
$month = $request->input('month');
if ($month == null) {
$now = Carbon::now();
$month = $now->month;
}
$events = $this->frontendGateway->getEventCalendarDownload($request, $month);
$logo = public_path('assets/images/logo3.jpg');
$pdf = \PDF::loadView('prints.events-view', ['events' => $events, 'logo' => $logo]);
$pdf->setOptions(['isPhpEnabled' => true, 'dpi' => 150, 'setIsRemoteEnabled' => true]);
$pdf->setPaper('A4', 'letter');
return $pdf->download('Event Calendar' . '-' . now()->toDateString() . '.pdf');
}
我的刀片:
<div id="header" class="fontSize14">
<table width="100%">
<tr>
<td align="left" style="width: 20%;">
<img src="{{ $logo }}" class="logo" />
</td>
<td align="left" style="width: 80%;">
<span class="fontSize19"><b>My name</b></span><br />
street<br />
</td>
</tr>
</table>
</div>
<div id="content" class="fontSize11">
<b class="fontSize19">Calendar</b><br /><br />
<table width="100%">
<thead style="background-color: lightgray;">
<tr>
<th>#</th>
<th>Data</th>
<th>Godzina</th>
<th>Nazwa imprezy</th>
<th>Miejsce</th>
</tr>
</thead>
<tbody>
@foreach($events as $event)
@php
$hourFromX = explode(":", $event->hour_from);
$hourToX = explode(":", $event->hour_to);
$hourFrom = $hourFromX['0'].":".$hourFromX['1'];
$hourTo = $hourToX['0'].":".$hourToX['1'];
@endphp
<tr>
<th scope="row">{{ $loop->iteration }}</th>
<td>{{ $event->date_from }}</td>
如何将我的数据和视图添加到 Word?
慕姐8265434