Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > PDF > phpToPDF
phpToPDF Forum d'entraide pour la classe phpToPDF permettant de générer des documents PDF en PHP. Avant de poster -> tutoriels EZPDF
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 30/01/2008, 17h17   #1
Invité de passage
 
Inscription : janvier 2008
Messages : 3
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 3
Points : 1
Points : 1
Par défaut [phpToPDF] Manipulation des couleurs

Salut,

Je découvre PHPTOPDF, il me rend bien service! J'arrive à faire à peut près ce que je veux sauf deux choses :

- Assigner une couleur de fond à une cellule précise
- Assigner une coulmeur à une partie de texte au sein d'une cellule..

Ais-je loupé qqchose ou ce n'est tout simplment pas possible?

Merci
benjamin_m est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 31/01/2008, 11h27   #2
Membre du Club
 
Inscription : janvier 2008
Messages : 60
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 60
Points : 59
Points : 59
Bonjour,

Tu peux aller voir ici
http://www.developpez.net/forums/sho...87&postcount=3
J'ai fait des ajouts dans la bibliothèque, la méthode n'est pas très orthodoxe mais je peux t'assurer que ça marche.
Si les couleurs ne te plaisent pas tu peux les modifier ou en ajouter.
Le_Moustachu est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 31/01/2008, 13h53   #3
Invité de passage
 
Inscription : janvier 2008
Messages : 3
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 3
Points : 1
Points : 1
Salut,

Merci pour ton message. J'ai regardé, ça ne répond pas excatment à ce dont j'ai besoin mais merci quand même.
benjamin_m est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/02/2008, 18h56   #4
Membre du Club
 
Inscription : janvier 2008
Messages : 60
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 60
Points : 59
Points : 59
Ci-dessous la fonction drawTableau() modifiée pour permettre l'utilisation de qqs couleurs de fonds et de polices :
Code :
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
 
	function drawTableau(&$pdf, $tableType, $headerType, $headerDatas, $datasType, $datas)
	{
		$nbCol = count($headerDatas)/2;
 
		//we initialize the table class
		$pdf->Table_Init($nbCol, true, true);
 
		//***************************************************************************
		//TABLE HEADER SETTINGS
		//***************************************************************************
		$table_subtype = $tableType;
		$pdf->Set_Table_Type($table_subtype);
 
		for($i=0; $i<$nbCol; $i++) 
		{
			$header_type[$i] = $headerType;
			$header_type[$i]['WIDTH'] = $headerDatas[$i];
 
			// Les contenus
			$j = $nbCol+$i;
			$header_type[$i]['TEXT'] = $headerDatas[$j];
 
			// Si une donnée == 0 alors on affiche rien...
			if ($header_type[$i]['TEXT'] != "0") ;
			else $header_type[$i]['TEXT'] = "";
 
			// par défaut, le texte est centré à gauche, non italic, non souligné et non gras.
			// par défaut, les cellules ne sont pas fusionnées.
			$header_type[$i]['T_TYPE'] = '';
			$header_type[$i]['T_ALIGN'] = '';		
			$header_type[$i]['COLSPAN'] = "1";
		}
 
		// Si l'utilisateur veut un alignement spécifique pour la première colonne. Sinon, T_ALIGN  prend le dessus...
		if (isset($headerType['T_ALIGN_COL0']))
			$header_type[0]['T_ALIGN'] = $headerType['T_ALIGN_COL0'];
 
		// Si l'utilisateur veut un fond coloré spécifique  pour la première colonne. Sinon, BG_COLOR  prend le dessus...
		if (isset($headerType['BG_COLOR_COL0']))
			$header_type[0]['BG_COLOR'] = $headerType['BG_COLOR_COL0'];
 
		// Si l'utilisateur précise un type ou un alignement pour une cellule précise du tableau, on l'applique ici
		// Il faut utiliser les balises [I], [B], [U] pour Italic, Bold et Underline
		// Il faut utiliser les balises [L], [C], [R] pour left, centered et rigth
		for($i=0; $i<$nbCol; $i++) 
		{
			if (sscanf($header_type[$i]['TEXT'], "[%[a-zA-Z]]%s", $balise, $reste) != 0)
			{
				//echo "balise = " . $balise;
				if ( (strpos($balise, "I")===FALSE) && (strpos($balise, "B")===FALSE) && (strpos($balise, "U")===FALSE)
				  && (strpos($balise, "L")===FALSE) && (strpos($balise, "C")===FALSE) && (strpos($balise, "R")===FALSE) )
					; // Mauvaise balise ou l'utilisateur veut mettre des crochets dans son tableau, c'est son droit...
				else
				{
					// On teste les différentes balises pour ajuster la cellule.
					if (strpos($balise, "I") === FALSE) ;
					else $header_type[$i]['T_TYPE'] .= 'I';
					if (strpos($balise, "B") === FALSE) ;
					else $header_type[$i]['T_TYPE'] .= 'B';
					if (strpos($balise, "U") === FALSE) ;
					else $header_type[$i]['T_TYPE'] .= 'U';
					if (strpos($balise, "L") === FALSE) ;
					else $header_type[$i]['T_ALIGN'] .= 'L';
					if (strpos($balise, "C") === FALSE) ;
					else $header_type[$i]['T_ALIGN'] .= 'C';
					if (strpos($balise, "R") === FALSE) ;
					else $header_type[$i]['T_ALIGN'] .= 'R';
				}
 
				// On supprime la balise du texte de la cellule...
				$header_type[$i]['TEXT'] = str_replace("[".$balise."]", "", $header_type[$i]['TEXT']);
			}
		}
		// Si l'utilsateur ne veut pas de header pour son tableau, il met NULL dans la premiere cellule...
		if ($header_type[0]['TEXT'] == NULL)
		{
			for($i=0; $i<$nbCol; $i++)
			{
				$header_type[$i]['LN_SIZE'] = 0;
				$header_type[$i]['TEXT'] = "";
			}
		}
 
 
		// Test si l'utilisateur veut fusionner DEUX cellules dans le header de son tableau. Il doit mettre "COLSPAN2" dans la première cellule à fusionner.
		for($i=0 ; $i<$nbCol ; $i++)
		{
			$k=$nbCol+$i;
			$i_1 = $i-1;
			if ( ($k<count($headerDatas)) && ($headerDatas[$k] === "COLSPAN2") )
			{
				$header_type[$i_1]['COLSPAN'] = "2";
				$header_type[$i]['TEXT']= "";
			}
		}
 
		//set the header type
		$pdf->Set_Header_Type($header_type);
		$pdf->Draw_Header();
 
		//***************************************************************************
		//TABLE DATA SETTINGS
		//***************************************************************************		
		$data_type = Array();//reset the array
		for ($i=0; $i<$nbCol; $i++) $data_type[$i] = $datasType;
		$pdf->Set_Data_Type($data_type);
 
		//*********************************************************************
		// Ce qui suit est valable pour toutes les cellules du tableau (hors header bien entendu).
		//*********************************************************************
		$data = Array();
		for ($i=0 ; $i<count($datas) ; $i+=$nbCol)
		{
			//*********************************************************************
			// Ce qui suit est valable pour la première colonne du tableau
			//*********************************************************************
			// si l'utilisateur a précisé un alignement pour la première colonne, on l'applique ici
			if (isset($datasType['T_ALIGN_COL0']))
				$data[0]['T_ALIGN'] = $datasType['T_ALIGN_COL0'];
 
			// Si l'utilisateur a précisé une couleur de fond pour la première colonne, on l'applique ici.
			if (isset($datasType['BG_COLOR_COL0']))
				$data[0]['BG_COLOR'] = $datasType['BG_COLOR_COL0'];
 
 
			for ($j=$i ; $j<$i+$nbCol ; $j++)
			{
				$k = $j-$i;
 
 
				$data[$k]['TEXT'] = $datas[$j];
				$data[$k]['T_SIZE'] = $datasType['T_SIZE'];
				$data[$k]['LN_SIZE'] = $datasType['LN_SIZE'];
 
				// par défaut, le texte est centré à gauche, non italic, non souligné et non gras.
				// par défaut, les cellules ne sont pas fusionnées.
				$data[$k]['T_TYPE'] = '';
				$data[$k]['T_ALIGN'] = '';		
				$data[$k]['COLSPAN'] = "1";
 
				// Si l'utilisateur a précisé une couleur de fond pour les autres colonnes, on l'applique ici.
				if ( (isset($datasType['BG_COLOR'])) && ($k!=0) )
					$data[$k]['BG_COLOR'] = $datasType['BG_COLOR'];
 
				// Si l'utilisateur précise un type ou un alignement pour une cellule précise du tableau, on l'applique ici
				// Il faut utiliser les balises [I], [B], [U] pour Italic, Bold et Underline
				// Il faut utiliser les balises [L], [C], [R] pour left, centered et rigth
                // Il faut utiliser les balises [D], [V], [E] pour red, green et blue
                // Il faut utiliser les balises [N], [O], [T] pour black, orange et violet
                /* Il faut utiliser la balise [P] pour saut de page (ajout Andre)
                   (On la place dans une cellule de la ligne avant laquelle on veut faire le saut de page)*/
				if (sscanf($data[$k]['TEXT'], "[%[a-zA-Z]]%s", $balise, $reste) != 0)
				{
					if ( (strpos($balise, "I")===FALSE) && (strpos($balise, "B")===FALSE) && (strpos($balise, "U")===FALSE)
					  && (strpos($balise, "L")===FALSE) && (strpos($balise, "C")===FALSE) && (strpos($balise, "R")===FALSE)
                      && (strpos($balise, "D")===FALSE) && (strpos($balise, "V")===FALSE) && (strpos($balise, "E")===FALSE)
                      && (strpos($balise, "N")===FALSE) && (strpos($balise, "O")===FALSE) && (strpos($balise, "T")===FALSE)
                      && (strpos($balise, "X")===FALSE) && (strpos($balise, "Y")===FALSE) && (strpos($balise, "Z")===FALSE)
                      && (strpos($balise, "W")===FALSE) && (strpos($balise, "G")===FALSE) && (strpos($balise, "P")===FALSE))
                      //Modif Andre ajout de balises couleurs textes, fond cellules et saut de page
						; // Mauvaise balise ou l'utilisateur veut mettre des crochets dans son tableau, c'est son droit...
					else
					{
						//echo "balise = " . $balise . "<br>";
						// On teste les différentes balises pour ajuster la cellule.
						if (strpos($balise, "I") === FALSE) ;
						else $data[$k]['T_TYPE'] .= 'I';
						if (strpos($balise, "B") === FALSE) ;
						else $data[$k]['T_TYPE'] .= 'B';
						if (strpos($balise, "U") === FALSE) ;
						else $data[$k]['T_TYPE'] .= 'U';
						if (strpos($balise, "L") === FALSE) ;
						else $data[$k]['T_ALIGN'] .= 'L';
						if (strpos($balise, "C") === FALSE) ;
						else $data[$k]['T_ALIGN'] .= 'C';
						if (strpos($balise, "R") === FALSE) ;
						else $data[$k]['T_ALIGN'] .= 'R';
                        if (strpos($balise, "D") === FALSE) ;//Rouge
                        else $data[$k]['T_COLOR'] = array(255,0,0); //Modif Andre
                        if (strpos($balise, "V") === FALSE) ;//Vert
                        else $data[$k]['T_COLOR'] = array(0,128,0);
                        if (strpos($balise, "E") === FALSE) ;//Bleu
                        else $data[$k]['T_COLOR'] = array(0,0,255);
                        if (strpos($balise, "N") === FALSE) ;//Noir
                        else $data[$k]['T_COLOR'] = array(0,0,0);
                        if (strpos($balise, "O") === FALSE) ;//Orange
                        else $data[$k]['T_COLOR'] = array(255,128,0);
                        if (strpos($balise, "T") === FALSE) ;//Violet
                        else $data[$k]['T_COLOR'] = array(128,0,128);
                        if (strpos($balise, "G") === FALSE) ;//Fond orange
                        else $data[$k]['BG_COLOR'] = array(255,205,102);
                        if (strpos($balise, "H") === FALSE) ;//Fond Gris foncé
                        else $data[$k]['BG_COLOR'] = array(200,200,200);
                        if (strpos($balise, "W") === FALSE) ;//Fond blanc
                        else $data[$k]['BG_COLOR'] = array(255,255,255);
                        if (strpos($balise, "X") === FALSE) ;//Fond Violet
                        else $data[$k]['BG_COLOR'] = array(128,0,128);
                        if (strpos($balise, "Y") === FALSE) ;//Fond Gris pâle
                        else $data[$k]['BG_COLOR'] = array(230,230,230);
                        if (strpos($balise, "Z") === FALSE) ;//Fond jaune
                        else $data[$k]['BG_COLOR'] = array(255,255,0);
					}
 
                    if (ereg("P", $balise)) //balise saut de page existe on appelle la fonction
                    {
                        $this->CheckPageBreak($h, true, $data[$k]['TEXT']);
                        // On supprime la balise du texte de la cellule...
	                    $data[$k]['TEXT'] = str_replace("[".$balise."]", "", $data[$k]['TEXT']);
                    }
                    else
                    {
                        // On supprime la balise du texte de la cellule...
                        $data[$k]['TEXT'] = str_replace("[".$balise."]", "", $data[$k]['TEXT']);
                    }
				}
 
				// Si la valeur de la cellule est 0, le choix a été fait ICI de ne rien mettre dans la cellule.
				if ($data[$k]['TEXT'] == "0")
					$data[$k]['TEXT'] ="";
				// Test si l'utilisateur veut fusionner deux cellules dans le header de son tableau. Il doit mettre le contenu
				// de la cellule fusionnée dans la première cellule et "COLSPAN2" dans la deuxième cellule.
				if ( ($k<$nbCol) && ($data[$k]['TEXT'] === "COLSPAN2") )
				{
					$k_1 = $k-1;
					$data[$k_1]['COLSPAN'] = "2";
					$data[$k]['TEXT']= "";
				}				
			}
	        $pdf->Draw_Data($data);
		}
 
		$pdf->Draw_Table_Border();
	}
}
et la fonction Draw_Data() modifiée pour pouvoir diviser horizontalement une cellule en 2 avec des couleurs de polices et de fond différentes en utilisant un "\n".
Code :
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
 
	function Draw_Data($data, $header = true){
 
		$h = 0;
 
		//calculate the maximum height of the cells
		for($i=0; $i < $this->tb_columns; $i++)
		{
 
			if (!isset($data[$i]['T_FONT'])) $data[$i]['T_FONT'] = $this->tb_data_type[$i]['T_FONT'];
            if (!isset($data[$i]['IMAGE'])) $data[$i]['IMAGE'] = $this->tb_data_type[$i]['IMAGE'];//Ajout Andre
			if (!isset($data[$i]['T_TYPE'])) $data[$i]['T_TYPE'] = $this->tb_data_type[$i]['T_TYPE'];
			if (!isset($data[$i]['T_SIZE'])) $data[$i]['T_SIZE'] = $this->tb_data_type[$i]['T_SIZE'];
			if (!isset($data[$i]['T_COLOR'])) $data[$i]['T_COLOR'] = $this->tb_data_type[$i]['T_COLOR'];
			if (!isset($data[$i]['T_ALIGN'])) $data[$i]['T_ALIGN'] = $this->tb_data_type[$i]['T_ALIGN'];
			if (!isset($data[$i]['V_ALIGN'])) $data[$i]['V_ALIGN'] = $this->tb_data_type[$i]['V_ALIGN'];
			if (!isset($data[$i]['LN_SIZE'])) $data[$i]['LN_SIZE'] = $this->tb_data_type[$i]['LN_SIZE'];
			if (!isset($data[$i]['BRD_SIZE'])) $data[$i]['BRD_SIZE'] = $this->tb_data_type[$i]['BRD_SIZE'];
			if (!isset($data[$i]['BRD_COLOR'])) $data[$i]['BRD_COLOR'] = $this->tb_data_type[$i]['BRD_COLOR'];
			if (!isset($data[$i]['BRD_TYPE'])) $data[$i]['BRD_TYPE'] = $this->tb_data_type[$i]['BRD_TYPE'];
			if (!isset($data[$i]['BG_COLOR'])) $data[$i]['BG_COLOR'] = $this->tb_data_type[$i]['BG_COLOR'];
 
			$this->SetFont( $data[$i]['T_FONT'],
							$data[$i]['T_TYPE'],
							$data[$i]['T_SIZE']);
 
			$data[$i]['CELL_WIDTH'] = $this->tb_header_type[$i]['WIDTH'];
 
			if (isset($data[$i]['COLSPAN'])){
 
				$colspan = (int) $data[$i]['COLSPAN'];//convert to integer
 
				for ($j = 1; $j < $colspan; $j++){
					//if there is a colspan, then calculate the number of lines also with the with of the next cell
					if (($i + $j) < $this->tb_columns)
						$data[$i]['CELL_WIDTH'] += $this->tb_header_type[$i + $j]['WIDTH'];
				}
			}
			$data[$i]['CELL_LINES'] = $this->NbLines($data[$i]['CELL_WIDTH'], $data[$i]['TEXT']);
 
			//this is the maximum cell height
			$h = max($h, $data[$i]['LN_SIZE'] * $data[$i]['CELL_LINES']);
 
			if (isset($data[$i]['COLSPAN'])){
				//just skip the other cells
				$i = $i + $colspan - 1;
			}
 
		}
 
 
		$this->CheckPageBreak($h, $header);
 
		if ($this->Draw_Header_Command){//draw the header
			$this->Draw_Header_($h);
		}
 
		$this->Table_Align();
 
		//Draw the cells of the row
		for($i=0;$i<$this->tb_columns;$i++)
		{
 
			//border size BRD_SIZE
			$this->SetLineWidth($data[$i]['BRD_SIZE']);
 
			//fill color = BG_COLOR
			list($r, $g, $b) = $data[$i]['BG_COLOR'];
			$this->SetFillColor($r, $g, $b);
 
			//Draw Color = BRD_COLOR
			list($r, $g, $b) = $data[$i]['BRD_COLOR'];
			$this->SetDrawColor($r, $g, $b);
 
            if (ereg("\n", $data[$i]['TEXT']))/*Ajout Andre si il existe un retour chariot dans le texte, 
            on crée deux cellules pour pouvoir obtenir des couleurs différentes pour chaque lignes*/
            {
                //Save the current position
                $x=$this->GetX();
                $y=$this->GetY();
 
                //print the text
                $texte=substr($data[$i]['TEXT'],0,strpos($data[$i]['TEXT'],"\n"));
                list($r, $g, $b) = $data[$i]['T_COLOR'];
                $this->SetTextColor($r, $g, $b);
                //Set the font, font type and size
                $size=$data[$i]['T_SIZE'];
                $lignesize=$data[$i]['LN_SIZE'];
                if ($size>8)
                {
                    $size=$data[$i]['T_SIZE']-2;//On réduit la police pour que ce soit plus clair
                    //$lignesize=$data[$i]['LN_SIZE']-2;
                }
                $this->SetFont( $data[$i]['T_FONT'],
                                $data[$i]['T_TYPE'],
                                $size);
//Ce serait bien de pouvoir passer un paramètre afin de choisir le BRD_TYPE 
                $this->Cell(
                        $data[$i]['CELL_WIDTH'],
                        $lignesize,
                        $texte,
                        $data[$i]['BRD_TYPE'],
                        2,
                        $data[$i]['T_ALIGN']
                        );
 
                $texte=trim(strstr($data[$i]['TEXT'],"\n"));
                /*On est en 2ème ligne il faut prendre en compte la balise qui se trouve après le \n*/
                if (sscanf($texte, "[%[a-zA-Z]]%s", $balise, $reste) != 0)
                {
                    //on réinitialise le type pour qu'il ne se duplique pas en passant dans le "else"
                    $data[$i]['T_TYPE']="";
                    //idem avec align
                    $data[$i]['T_ALIGN']="";
//Pour explications se reporter à function drawTableau()
                    if ( (strpos($balise, "I")===FALSE) && (strpos($balise, "B")===FALSE) && (strpos($balise, "U")===FALSE)
                      && (strpos($balise, "L")===FALSE) && (strpos($balise, "C")===FALSE) && (strpos($balise, "R")===FALSE)
                      && (strpos($balise, "D")===FALSE) && (strpos($balise, "V")===FALSE) && (strpos($balise, "E")===FALSE)
                      && (strpos($balise, "N")===FALSE) && (strpos($balise, "O")===FALSE) && (strpos($balise, "T")===FALSE)
                      && (strpos($balise, "X")===FALSE) && (strpos($balise, "Y")===FALSE) && (strpos($balise, "Z")===FALSE)
                      && (strpos($balise, "W")===FALSE) && (strpos($balise, "G")===FALSE) && (strpos($balise, "P")===FALSE))
                        ; // Mauvaise balise ou l'utilisateur veut mettre des crochets dans son tableau, c'est son droit...
                    else
                    {
                        // On teste les différentes balises pour ajuster la cellule.
                        if (strpos($balise, "I") === FALSE) ;
                        else $data[$i]['T_TYPE'] .= 'I';
                        if (strpos($balise, "B") === FALSE) ;
                        else $data[$i]['T_TYPE'] .= 'B';
                        if (strpos($balise, "U") === FALSE) ;
                        else $data[$i]['T_TYPE'] .= 'U';
                        if (strpos($balise, "L") === FALSE) ;
                        else $data[$i]['T_ALIGN'] .= 'L';
                        if (strpos($balise, "C") === FALSE) ;
                        else $data[$i]['T_ALIGN'] .= 'C';
                        if (strpos($balise, "R") === FALSE) ;
                        else $data[$i]['T_ALIGN'] .= 'R';
                        if (strpos($balise, "D") === FALSE) ;//Rouge
                        else $data[$i]['T_COLOR'] = array(255,0,0); //Modif Andre
                        if (strpos($balise, "V") === FALSE) ;//Vert
                        else $data[$i]['T_COLOR'] = array(0,128,0);
                        if (strpos($balise, "E") === FALSE) ;//Bleu
                        else $data[$i]['T_COLOR'] = array(0,0,255);
                        if (strpos($balise, "N") === FALSE) ;//Noir
                        else $data[$i]['T_COLOR'] = array(0,0,0);
                        if (strpos($balise, "O") === FALSE) ;//Orange
                        else $data[$i]['T_COLOR'] = array(255,128,0);
                        if (strpos($balise, "T") === FALSE) ;//Violet
                        else $data[$i]['T_COLOR'] = array(128,0,128);
                        if (strpos($balise, "G") === FALSE) ;//Fond orange
                        else $data[$i]['BG_COLOR'] = array(255,205,102);
                        if (strpos($balise, "H") === FALSE) ;//Fond Gris foncé
                        else $data[$i]['BG_COLOR'] = array(200,200,200);
                        if (strpos($balise, "W") === FALSE) ;//Fond blanc
                        else $data[$i]['BG_COLOR'] = array(255,255,255);
                        if (strpos($balise, "X") === FALSE) ;//Fond Violet
                        else $data[$i]['BG_COLOR'] = array(128,0,128);
                        if (strpos($balise, "Y") === FALSE) ;//Fond Gris pâle
                        else $data[$i]['BG_COLOR'] = array(230,230,230);
                        if (strpos($balise, "Z") === FALSE) ;//Fond jaune
                        else $data[$i]['BG_COLOR'] = array(255,255,0);
                    }
 
                    if (ereg("P", $balise)) //balise saut de page existe on appelle la fonction
                    {
                        $this->CheckPageBreak($h, true, $data[$i]['TEXT']);
                        // On supprime la balise du texte de la cellule...
                        $texte = str_replace("[".$balise."]", "", $texte);
                    }
                    else
                    {
                        // On supprime la balise du texte de la cellule...
                        $texte = str_replace("[".$balise."]", "", $texte);
                    }
                }
                list($r, $g, $b) = $data[$i]['T_COLOR'];
                $this->SetTextColor($r, $g, $b);
                //Set the font, font type and size
                $size=$data[$i]['T_SIZE'];
                $lignesize=$data[$i]['LN_SIZE'];
                if ($size>8)
                {
                    $size=$data[$i]['T_SIZE']-2;
                    //$lignesize=$data[$i]['LN_SIZE']-2;
                }
                $this->SetFont( $data[$i]['T_FONT'],
                                $data[$i]['T_TYPE'],
                                $size);
//Ce serait bien de pouvoir passer un paramètre afin de choisir le BRD_TYPE 
                $this->Cell(
                        $data[$i]['CELL_WIDTH'],
                        $lignesize,
                        $texte,
                        $data[$i]['BRD_TYPE'],
                        $data[$i]['T_ALIGN']
                        );
            }//Fin d'ajout Andre pour insertion de sous-cellules avec possibilité couleur,type et align différents 
            else
            {
                //Text Color = T_COLOR
                list($r, $g, $b) = $data[$i]['T_COLOR'];
                $this->SetTextColor($r, $g, $b);
 
 
                //Set the font, font type and size
                $this->SetFont( $data[$i]['T_FONT'],
                                $data[$i]['T_TYPE'],
                                $data[$i]['T_SIZE']);
 
                //Save the current position
                $x=$this->GetX();
                $y=$this->GetY();
 
                //print the text
                $this->MultiCellTable(
                        $data[$i]['CELL_WIDTH'],
                        $data[$i]['LN_SIZE'],
                        $data[$i]['TEXT'],
                        $data[$i]['BRD_TYPE'],
                        $data[$i]['T_ALIGN'],
                        $data[$i]['V_ALIGN'],
                        1,
                        $h - $data[$i]['LN_SIZE'] * $data[$i]['CELL_LINES']
                        );
            }
 
			//Put the position to the right of the cell
			$this->SetXY($x + $data[$i]['CELL_WIDTH'],$y);
 
			//if we have colspan, just ignore the next cells
			if (isset($data[$i]['COLSPAN'])){
				$i = $i + (int)$data[$i]['COLSPAN'] - 1;
			}
//Ajout de la possibilité d'insérer une image
//j'ai modifié la fonction Draw_Data
/*
if($data[$i]['IMAGE'])
{
    $this->Image($data[$i]['IMAGE'], $x+1, $y+1); //Ajout Andre
}
*/
		}
 
		$this->Data_On_Current_Page = true;
 
		//Go to the next line
		$this->Ln($h);
 
    }
Le_Moustachu est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 13h18.


 
 
 
 
Partenaires

Hébergement Web