Bonjour,
Je reprends ce sujet car c'est ce que je cherche à faire : Grand tableau sur un seul page
Je voudrais générer mon tableau sur une page unique mais il est trop long.
J'ai fais un sorte que le tableau prenne moins de la moitié de la page pour pouvoir mettre la suite du tableau ( qui déborde sur une deuxième page ) juste à côté de la première partie.
Voici ce que j'ai testé, sans succès
<style type="text/css">
* {color: black;}
h1 {margin: 0px; text-align: center;}
p {margin-bottom: 0;}
hr {background: #717375; height: 1px; border: none;}
table { width:100%; table-layout:fixed; border-collapse: collapse; font-size: 12pt; line-height: 5mm; text-align: center;}
th { word-break: break-all; border: 1px solid black; padding: 0px 2px; height: 35px;}
td { word-break: break-all; border: 1px solid black; padding: 0px 2px; font-size: 14px; height: 25px; vertical-align: middle;}
.nom {text-align: left; padding-left: 5px;}
</style>
<page backtop="0mm" backleft="0mm" backright="0mm" backbottom="0mm">
<h1>Liste Participants Rallye</h1>
<div style="column-count: 2;">
<?php foreach($users as $user): ?>
<p>
<span class="nom"><?= e($user->getPName()); ?></span>
<span><?= e($user->getImmat()); ?></span>
<span><?= e($user->getID()); ?></span>
</p>
<?php endforeach; ?>
</div>
</page>
<page>
<div style="columns: 2;">
<table cellspacing="0">
<thead>
<tr>
<th>Nom - Prénom</th>
<th>Immat</th>
<th>Dossard</th>
</tr>
</thead>
<tbody>
<?php foreach($users as $user): ?>
<tr>
<td class="nom"><?= e($user->getPName()); ?></td>
<td><?= e($user->getImmat()); ?></td>
<td><?= e($user->getID()); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</page>
J'ai accès au php et au css.
Par avance merci de votre aide
pour le moment, j'ai utilisé la même technique que le sujet précédent
<style type="text/css">
* {color: black;}
h1 {margin: 0px; text-align: center;}
p {margin-bottom: 0;}
hr {background: #717375; height: 1px; border: none;}
table { width:45%; table-layout:fixed; border-collapse: collapse; font-size: 12pt; line-height: 5mm; text-align: center;}
th { word-break: break-all; border: 1px solid black; padding: 5px;}
td { word-break: break-all; border: 1px solid black; padding: 0px 2px; font-size: 14px; height: 25px; vertical-align: middle;}
.nom {text-align: left; padding-left: 5px;}
.immat { width: 90px;}
.espace {width: 5px; background-color: black;}
</style>
<page backtop="0mm" backleft="0mm" backright="0mm" backbottom="0mm">
<h1>Liste Participants Rallye</h1>
</page><div style="columns: 2;">
<table cellspacing="0">
<thead>
<tr>
<th>Nom - Prénom</th>
<th>Immat</th>
<th>Dossard</th>
<th></th>
<th>Nom - Prénom</th>
<th>Immat</th>
<th>Dossard</th>
</tr>
</thead>
<tbody>
<?php for($i = 0; $i <= 33; $i++): ?>
<tr>
<td class="nom"><?= e($users[$i]->getPName()); ?></td>
<td class="immat"><?= e($users[$i]->getImmat()); ?></td>
<td><?= e($users[$i]->getID()); ?></td>
<td class="espace"></td>
<td class="nom"><?= e($users[$i+34]->getPName()); ?></td>
<td class="immat"><?= e($users[$i+34]->getImmat()); ?></td>
<td><?= e($users[$i+34]->getID()); ?></td>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div>
<page backtop="0mm" backleft="0mm" backright="0mm" backbottom="0mm">
<div style="columns: 2;">
<table cellspacing="0">
<thead>
<tr>
<th>Nom - Prénom</th>
<th>Immat</th>
<th>Dossard</th>
<th></th>
<th>Nom - Prénom</th>
<th>Immat</th>
<th>Dossard</th>
</tr>
</thead>
<tbody>
<?php for($i = 68; $i <= 101; $i++): ?>
<tr>
<?php if($i+1 <= $nb_users): ?>
<td class="nom"><?= e($users[$i]->getPName()); ?></td>
<td class="immat"><?= e($users[$i]->getImmat()); ?></td>
<td><?= e($users[$i]->getID()); ?></td>
<?php else: ?>
<td colspan="3"></td>
<?php endif; ?>
<td class="espace"></td>
<?php if($i+35 <= $nb_users): ?>
<td class="nom"><?= e($users[$i+34]->getPName()); ?></td>
<td class="immat"><?= e($users[$i+34]->getImmat()); ?></td>
<td><?= e($users[$i+34]->getID()); ?></td>
<?php else: ?>
<td colspan="3"></td>
<?php endif; ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div>
</page>
Pourquoi n'utilises tu pas une grille ?
C'est très souvent plus simple qu'un tableau et dans ce cas ton problème est résolu.
<div style="column-count:2">
<div style="dsiplay:grid">
<div>Cellule 1</div><div>cellule 2</die>
...
</div>
</div>
Je ne vois pas en quoi cela va résoudre mon problème initial ?
J'aurais toujours besoin de décaler l'index pour avoir la suite de mes données sur la même page.