Salut,
J'ai essayé de créer un tableau avec fpdf, dont le contenu est lu à partir d'un fichier XML grace a la librairie DOM de php5...
Mon probléme c'est comment ajouter des lignes a mon tableau !!!!!!!! En réalité je ne comprend pas grand chose à cette librairie je viens de la decouvrir, donc je vous montre mon code c'Est mieux:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 include("/home/magnu/phpToPDF.php"); $PDF=new phpToPDF(); $PDF->AddPage(); $PDF->SetFont('Arial','B',16); // Définition des propriétés du tableau. $proprietesTableau = array( 'TB_ALIGN' => 'L', 'L_MARGIN' => 15, 'BRD_COLOR' => array(0,92,177), 'BRD_SIZE' => '0.3', ); // Définition des propriétés du header du tableau. $proprieteHeader = array( 'T_COLOR' => array(150,10,10), 'T_SIZE' => 12, 'T_FONT' => 'Arial', 'T_ALIGN' => 'C', 'V_ALIGN' => 'T', 'T_TYPE' => 'B', 'LN_SIZE' => 7, 'BG_COLOR_COL0' => array(170, 240, 230), 'BG_COLOR' => array(170, 240, 230), 'BRD_COLOR' => array(0,92,177), 'BRD_SIZE' => 0.2, 'BRD_TYPE' => '1', 'BRD_TYPE_NEW_PAGE' => '', ); // Contenu du header du tableau. $contenuHeader = array( 10, 10, 10, 10, 10, 10, 10, 10, 10, "Nom", "Prénom", "Statut","Formation","Tel","Local","Courriel", "Projets", "Laboratoire", ); // Définition des propriétés du reste du contenu du tableau. $proprieteContenu = array( 'T_COLOR' => array(0,0,0), 'T_SIZE' => 10, 'T_FONT' => 'Arial', 'T_ALIGN_COL0' => 'L', 'T_ALIGN' => 'R', 'V_ALIGN' => 'M', 'T_TYPE' => '', 'LN_SIZE' => 6, 'BG_COLOR_COL0' => array(245, 245, 150), 'BG_COLOR' => array(255,255,255), 'BRD_COLOR' => array(0,92,177), 'BRD_SIZE' => 0.1, 'BRD_TYPE' => '1', 'BRD_TYPE_NEW_PAGE' => '', );
Jusque là tout va bien, ce code définit l'aspect graphique, et le header du tableau, mais c'est le contenu qui cause le probléme...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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$contenuTableau = array(); foreach ($dom->getElementsByTagName('fiche') as $fiche) { $nom = stripslashes(getVarByName($fiche,'nom')); $prenom = stripslashes(getVarByName($fiche,'prenom')); $statut = stripslashes(getVarByName($fiche,'statut')); $cour = stripslashes(getVarByName($fiche, 'courriel')); $dis = stripslashes(getVarByName($fiche, 'distinctions')); $formation = stripslashes(getVarByName($fiche , 'formation')); $tel = stripslashes(getVarByName($fiche, 'tel')); $local = stripslashes(getVarByName($fiche,'local')); $impl = imp($fiche); $projj=''; for($i=0;$i<$impl->length;$i++) { $projj=$projj."\n".stripslashes($impl->item($i)->nodeValue) ; } $labs = labo($fiche); $laboratoires=''; for($i=0;$i<$labs->length;$i++) { $laboratoires=$laboratoires."\n".stripslashes($labs->item($i)->nodeValue) ; } }
Je ne trouve pas comment ajouter mes lignes dans le tableau $contenuTableau = array() !!! sachant que c'est les variables $nom , $prenom etc que je vais placer dans le tableau , afin de pouvoir finalement faire cette operation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 $PDF->drawTableau($PDF, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau); $PDF->Output();
Aidez moi svp
...







Répondre avec citation



Partager