Show image with report and template

Other discussions about CSPro
Forum rules
New release: CSPro 8.0
Post Reply
kawtef
Posts: 18
Joined: March 24th, 2016, 5:54 am

Show image with report and template

Post by kawtef »

Hi,
I'm using this code to show a report with a template.
The function to fill the array record is

Code: Select all

array string LISTE_UNITE(50,6);

function rapport();
	setreportdata("title","Récap");
	
	numeric j = 1;
     forcase DICT_ECHANTILLON do
           LISTE_UNITE(j,1) = strip(E_COMMUNE);
           LISTE_UNITE(j,2) = strip(E_RAISON_SOC);
           LISTE_UNITE(j,3) = strip(E_TYPE_EMPLOYEUR);
           LISTE_UNITE(j,4) = strip(E_ADRESSE);
           LISTE_UNITE(j,5) = strip(E_TIR_REM_ADD);
           LISTE_UNITE(j,6) = "<img src='vert.png'>";
           inc(j);
     endfor;
     
	setreportdata(LISTE_UNITE);
	report(PATH_RAPPORT+"recap.html");
end;
When calling this function, the report display the content of the array by not the Image

My template is here

Code: Select all

<div id="cspro_report"></div>

<script type="application/vnd.cspro.report-template" id="cspro_report_template">
 <h2>{{title}}</h2>
 <table border="1" align="center"> 
	<tr><th>COM.</th><th>RAISON SOC.</th><th>TYPE</th><th>ADRESSE</th><th>&nbsp;</th><th>&nbsp;</th></tr>
	{{#LISTE_UNITE}} 
		<tr>{{#.}}<td>{{.}}</td>{{/.}}</tr> 
	{{/LISTE_UNITE}} 
 </table> 
 </script>
How we can show the picture/image in the template
kawtef
Posts: 18
Joined: March 24th, 2016, 5:54 am

Re: Show image with report and template

Post by kawtef »

Finally, i resolve the problem with this syntax :

In the the function

Code: Select all

function rapport();
	setreportdata("title","Récap");
	
	numeric j = 1;
     forcase DICT_ECHANTILLON_UNITE_DICT do
           LISTE_UNITE(j,1) = strip(E_COMMUNE);
           LISTE_UNITE(j,2) = strip(E_RAISON_SOC);
           LISTE_UNITE(j,3) = strip(E_TYPE_EMPLOYEUR);
           LISTE_UNITE(j,4) = strip(E_ADRESSE);
           LISTE_UNITE(j,5) = strip(E_TIR_REM_ADD);
           [color=#FF0000]LISTE_UNITE(j,6) = "vert.png";[/color]
          
           inc(j);
     endfor;
     
	setreportdata(LISTE_UNITE);
	report(PATH_RAPPORT+"recap.html");
end;
In the template

Code: Select all

<div id="cspro_report"></div>

<script type="application/vnd.cspro.report-template" id="cspro_report_template">
 <h2>{{title}}</h2>
 <table border="1" align="center"> 
	<tr><th>COM.</th><th>RAISON SOC.</th><th>TYPE</th><th>ADRESSE</th><th>&nbsp;</th><th>&nbsp;</th></tr>
	{{#LISTE_UNITE}} 
		<!--tr>{{#.}}<td>{{.}}</td>{{/.}}</tr-->
		<tr>
			<td>{{0}}</td>
			<td>{{1}}</td>
			<td>{{2}}</td>
			<td>{{3}}</td>
			<td>{{4}}</td>
			[color=#FF0040]<td><img src="{{5}}"></td>[/color]
		</tr> 
	{{/LISTE_UNITE}} 
 </table> 
 </script>
Post Reply