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
| function FancyTable($header,$data,$taille_col)
{
$this->y=50;
//Couleurs, épaisseur du trait et police grasse
$this->SetFillColor('rgb',0.5,0.5,0.5);
$this->SetTextColor('rgb',1,1,1);
$this->SetLineWidth(.3);
$this->SetFont('','B');
//En-tête
for($i=0;$i<count($header);$i++)
$this->Cell($taille_col,7,$header[$i],1,0,'C',1);
$this->Ln(7);
//Données
$fill=0;
$i=0;
foreach($data as $row)
{
$this->SetFillColor('rgb',0.88,0.92,1);
$this->SetTextColor('rgb',0,0);
$this->SetFont('');
if ($i == count($header)){
$this->Ln(6);
$i=0;
$fill=!$fill;
}
$this->Cell($taille_col,6,substr($row,0,$taille_col/2),'LR',0,'L',$fill);
$i++;
}
$this->Ln(6);
$this->Cell($taille_col*count($header),0,'','T');
} |
Partager