1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| // Fonctions pour les tableaux
function WriteTable($data,$w)
{
$this->SetLineWidth(.3);
$this->SetFillColor(255,255,255);
$this->SetTextColor(0);
$this->SetFont('');
foreach($data as $row)
{
//print_r ($row);
$nb=0;
for($i=0;$i<count($row);$i++)
$nb=max($nb,$this->NbLines($w[$i],trim($row[$i])));
$h=5*$nb;
$this->CheckPageBreak($h);
$nb_cols = count($row);
for($i=0;$i<count($row);$i++)
{
$x=$this->GetX();
$y=$this->GetY();
// Nombre de colonnes
if ($nb_cols == 2)
{
$this->Rect($x,$y,$w[$i],$h);
$this->MultiCell($w[$i],5,trim($row[$i]),0,'J');
$this->SetXY($x+$w[$i],$y);
}
elseif ($nb_cols > 2)
{
$this->Rect($x,$y,$w[$i],$h);
$this->MultiCell($w[$i],5,trim($row[$i]),0,'J');
$this->SetXY($x+$w[$i],$y);
}
}
$this->Ln($h);
}
} |
Partager