Images in Reports

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
vagblad
Posts: 160
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Images in Reports

Post by vagblad »

Hi all,

I've been trying to print a report using as reference the HMG3.2/SAMPLES/CONTROLS/REPORTADVANCED/REPORT.ADVANCED.8 sample.
While everything works just fine i have a problem regarding images inside the DETAILS BAND.

Code: Select all

#include "hmg.ch"

Function Main

	Public i := 1
	Public aRows [ 4 ] [ 4 ]
        
	aRows [1]	:= {'Simpson','Homer','555-5555', 'Foto1.jpg'} //I've added the 4th element of the array which is the name of the image file.
	aRows [2]	:= {'Mulder','Fox','324-6432'   , 'Foto2.jpg'}
	aRows [3]	:= {'Smart','Max','432-5892'    , 'Foto3.jpg'}
	aRows [4]	:= {'Grillo','Pepe','894-2332'   , 'Foto4.jpg'}
	
	  LOAD REPORT DEMO

	DEFINE WINDOW Win_1 ;
		ROW 0 ;
		COL 0 ;
		WIDTH 400 ;
		HEIGHT 400 ;
		TITLE 'Hello Report' ;
		WINDOWTYPE MAIN

		DEFINE MAIN MENU
			POPUP 'File'
				ITEM 'Execute Report'	ACTION ( i := 1 , ExecuteReport('Demo',.t.,.t. ) )
			END POPUP
		END MENU

	END WINDOW

	Win_1.Center

	Win_1.Activate

Return

Code: Select all

BEGIN DETAIL

		BANDHEIGHT	35

		BEGIN TEXT
			EXPRESSION	aRows [i] [1]
			ROW		2	
			COL		20	
			WIDTH		80	
			HEIGHT		10	
			FONTNAME	'Helvetica'
			FONTSIZE	9	
			FONTBOLD	.F.
			FONTITALIC	.F.
			FONTUNDERLINE	.F.
			FONTSTRIKEOUT	.F.
			FONTCOLOR	{ 0 , 0 , 0 }
			ALIGNMENT	Left 
		END TEXT

		BEGIN TEXT
			EXPRESSION	aRows [i] [2]
			ROW		2	
			COL		50
			WIDTH		80
			HEIGHT		10	
			FONTNAME	'Helvetica'
			FONTSIZE	9	
			FONTBOLD	.F.
			FONTITALIC	.F.
			FONTUNDERLINE	.F.
			FONTSTRIKEOUT	.F.
			FONTCOLOR	{ 0 , 0 , 0 }
			ALIGNMENT	Left 
		END TEXT

		BEGIN TEXT
			EXPRESSION	aRows [i] [3]
			ROW		2	
			COL		100	
			WIDTH		80	
			HEIGHT		10	
			FONTNAME	'Helvetica'
			FONTSIZE	9	
			FONTBOLD	.F.
			FONTITALIC	.F.
			FONTUNDERLINE	.F.
			FONTSTRIKEOUT	.F.
			FONTCOLOR	{ 0 , 0 , 0 }
			ALIGNMENT	Left 
		END TEXT
       
		BEGIN PICTURE
			VALUE	aRows[i][4] 
			ROW		8	
			COL		159	
			WIDTH		15
			HEIGHT		30	
			STRETCH		.F.
		END PICTURE
      
      
	END DETAIL
The problem is that while the text objects get the correct values from the aRows array, the picture shows only the Foto1.jpg.
So at the end of the report i have on my screen 4 times the same picture, while the text is different.
The exact same thing is happening when instead of an array i use a DBF file.
Is this happening because the PICTURE object doesn't have the EXPRESSION property?
And if you could give me any ideas of how to solve this.

Thanks in advance.

Best Regards
Vag
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
Post Reply