[英]How to set the page of print preview when looping data
這是我的打印預覽頁面,您可以看到數據循環到下一頁。 我應該怎么做,然后數據將在同一頁面中循環?
比如下圖就是我想做的布局,數據會在同一個頁面循環,如果滿了就開始循環到下一頁
我的打印頁面代碼
<!DOCTYPE html>
<html>
<head>
<title>This is a print page!</title>
</head>
<style>
</style>
<body>
@foreach ($xyprintPreview as $item)
<h1>{{ $item->xy_sx_ID}}</h1>
@endforeach
</body>
</html>
新更新的圖片
新更新的編碼
<body>
<table class="report-container" style="width: 100%">
<thead class="report-header">
<tr>
<th class="report-header-cell">
<div class="header-info mt-3">
<h4 style="text-align: center;">
<img src="https://scontent.fmkz1-1.fna.fbcdn.net/v/t31.0-8/o.jpg?_nc_cat=111&ccb=2&_nc_sid=09cbfe&_nc_ohc=gLnsAI4ON1MAX98YpzP&_nc_ht=scontent.fmkz1-1.fna&oh=bacd1bd15cf7a118af57abe52bf7e07e&oe=5FFAAEC0" alt="Avatar" style="width:60px">
柔佛古廟許願燈登記名單({{$year}}年)
</h4>
<hr style="border: 1px solid;">
<b style="margin-left: 180px; font-size: 20px">善信編號 名字</b>
<b style="margin-left: 290px; font-size: 20px">善信編號 名字</b>
<b style="margin-left: 290px; font-size: 20px">善信編號 名字</b>
</div>
</th>
</tr>
</thead>
<tfoot class="report-footer">
<tr>
<td class="report-footer-cell">
<div class="footer-info mb-3">
</div>
</td>
</tr>
</tfoot>
<tbody class="report-content ">
<tr>
<td class="report-content-cell">
<div class="main" style="column-count:3; margin-left: 180px;">
@foreach($xyprintPreview as $item)
<ul>
<li>
<span style="font-size: 20px"><b>{{$item->xy_sx_ID}}</b> {{$item->xylight_label}}</span>
</li>
</ul>
@endforeach
</div>
</td>
</tr>
</tbody>
第2頁
css 屬性column-count
可以解決你的問題。 附加到包含 h1 標簽或 ul li 標簽的 div 標簽。
<div style="column-count: 3;">
</div>
它將這個 div 內的內容分成三列,具有相同的頁面。 你可以看到演示(jsfiddle)
您可以使用 ul, li 標簽將項目符號樣式刪除為 none 以獲得有序結果。 你可以看到演示(jsfiddle)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.