Génerer colspan en pdf !!!! aidez moi svp
fille95
Messages postés
72
Statut
Membre
-
ortys4 Messages postés 254 Statut Membre -
ortys4 Messages postés 254 Statut Membre -
Bonjour,
j'ai generer un pdf un tableau
et dans mon tableau, il ya un colspan
et je vois pas comment le generer en pdf
pouvez vous m'aider svp !!
c'est un colspan de 6 colonnes
g fai sa mais sa marche pas :
$this->Cell($w[0],7,$header[0],1,0,'C',1);
aidez moi svp
j'ai generer un pdf un tableau
et dans mon tableau, il ya un colspan
et je vois pas comment le generer en pdf
pouvez vous m'aider svp !!
c'est un colspan de 6 colonnes
g fai sa mais sa marche pas :
$this->Cell($w[0],7,$header[0],1,0,'C',1);
aidez moi svp
Configuration: Windows XP Internet Explorer 7.0
2 réponses
-
salut
si tu arrives a savoir si tu as un colspan ou pas tu peux faire :
if($colspan == true)
{
$this->Cell($w[0]+$w[1],7,$header[0],1,0,'C',1);
}
else
{
$this->Cell($w[0],7,$header[0],1,0,'C',1);
}-
MERCI A TOI
sa marche mais sa me decale les celleules et sa m'ecrase la deuxieme ligne
voici mon code :
$this->SetFillColor(142,205,255);
$this->SetLineWidth(.3);
$this->SetFont('','B');
//En-tête : largeur des colonnes
$w=array(22,22,25,25,22,37);
$this->SetX((35)/2);
$this->Cell($w[0],7,$header[0],1,0,'C',1);
//affiche les th des traois tableaux
for($i=1;$i<count($header);$i++)
$this->Cell($w[$i],6,$header[$i],1,0,'L',1);
$this->Ln();
//Données
$fill=1;
for ($i=0;$i<count($liste_data);$i++) {
foreach($liste_data[$i] as $row)
{
$this->SetX((35)/2);
$this->SetFillColor(142,205,255);
$this->Cell($w[0],6,$row[0],'LT',0,'L',$fill);
$this->SetFillColor(255,255,255); // couleur des cellule des chiffres
$this->Cell($w[1],6,number_format($row[1],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[2],6,number_format($row[2],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[3],6,number_format($row[3],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[4],6,number_format($row[4],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[5],6,number_format($row[5],0,',',' '),'LRT',0,'C',$fill);
$this->Ln();
}
}
foreach($data_total as $row)
{
$this->SetX((35)/2);
// $this->SetFillColor(142,255,255);
$this->Cell($w[0],6,$row[0],'LT',0,'L',$fill);
$this->SetFillColor(255,255,120); // couleur des cellule des chiffres
$this->Cell($w[1],6,number_format($row[1],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[2],6,number_format($row[2],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[3],6,number_format($row[3],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[4],6,number_format($row[4],0,',',' '),'LRT',0,'C',$fill);
$this->Cell($w[5],6,number_format($row[5],0,',',' '),'LRT',0,'C',$fill);
$this->Ln();
}
$this->SetX((35)/2);
$this->Cell(array_sum($w),6,'','T');
}
merci a toi
-
-
Salut,
c'est normale, vu que tu additionne la largeur de 2 cellules en 1, il faut supprimer la deuxième en faisant un soustraction sur la largeur par exemple. ou plus propre :
if (fusion == true)
{
tu format ta ligne avec la fusion
}
else
{
tu format ta ligne sans fusion
}