Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with class FRX2WORD
Message
From
02/04/2002 10:19:16
 
 
To
31/03/2002 13:49:36
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00639283
Message ID:
00639933
Views:
16
I use FRX2Word and my reports have bitmaps that are located in a different folder from the report form. It always prints my bitmap in the WORD doc with no error. I have a private variable that is visible when the report is printed that specifies the bitmap with its fullpath.

All my graphics files are located in \graphics folder in the main application folder. Prior to running the report, I set the value of the
variable m._printbitmap
IF LEFT(SYS(16,0),9) = "PROCEDURE"
   m._graphicspath = addbs(SUBSTR(SYS(16,0),AT(" ",SYS(16,0),2)+1))+"GRAPHICS\"
ELSE
     m._graphicspath = addbs(SYS(16,0))+"GRAPHICS\"
ENDIF 
m._printbitmap = m._graphicspath+"mybitmap.bmp"
In my report form, the file expression for the bitmap is set to :
(IIF(TYPE("M._PRINTBITMAP") = "C" .AND. FILE(M._PRINTBITMAP),LOCFILE(M._PRINTBITMAP),""))
FRX2Word does not have a problem with this rather convoluted method of specifying the file in the report form. It always includes the bitmap in the report with no problem. With this code in the report form file expression for the bitmap, if it cannot find the file or if the variable is not properly set up or is out of scope, it leaves it out.

The code that handles this is in the .placeitem method of frx2word. I have added some comments to explain what it is doing. I added some code to handle my reports in earlier versions, but I think that version 2.3 already contained the code listed below.
Case m.nobjtype=17 and empty(m.vexpr)
	If  ! empty(m.cpicture)
		If  ! file(m.cpicture)
			if  type(m.cpicture) # "U"  && picture passed as an expression
				cpicture = evaluate(m.cpicture)  && evaluate expression
			endif
			if  file(m.cpicture)  && picture exists in VFP path
				cpicture=locfile(m.cpicture) && ensure full path to picture is specified for WORD
			else
				if  empty(fullpath(.reporthome+m.cpicture))
					cpicture=locfile(m.cpicture)
				else
					cpicture=fullpath(.reporthome+m.cpicture) && assume that picture exists in reporthome
				endif
			endif
		else
			if  juststem(m.cpicture)+"."+justext(m.cpicture) = m.cpicture && only picture with no path specified
				cpicture=locfile(m.cpicture) && ensure full path to picture is specified to WORD
			endif
		Endif
		If  file(m.cpicture)
			=m.odocshapes.addpicture(m.cpicture,.f.,.t.,m.nleft,m.ntop,m.nwidth,m.nheight) && ,m.odoc.sections(m.npage).range)
		Endif
	Endif
I suspect that the full path is not being passed to Word and somehow the above code doesn't set cpicture to fullpath to the bitmap. If this the case you could probably add cpicture = locfile(cpicture) just before the call to m.odocshapes.addpicture to make sure that it gets set in all cases.

HTH
Elmer
Previous
Reply
Map
View

Click here to load this message in the networking platform