Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying JPG image in report

Status
Not open for further replies.

vdeveloper

Programmer
Aug 5, 2000
42
IN
Hi all

I have a report which is supposed to display a jpg image stored in a general field of the underlying cursor. My problem is that when the report is generated, instead of the actual image, the JPG file icon is displayed/printed. what could be the cause of this?

Thanks in advance

 
Does this happen on all machines? Does it work right on the system that added the images? Often problems like this have to do with the OLE server used to insert the image into the General field. If each system doesn't EXACTLY the same server as the last one that added/changed the General field you can have problems. (<hint> NEVER use General fields!)

Rick
 
Rick. . .your comment. . .

(<hint> NEVER use General fields!)

could expound a little

THX

Bill
 
Bill,
If each system doesn't EXACTLY the same server as the last one that added/changed the General field you can have problems.
I found this to be true way back in FPW when people started using our Win 3.x app on WinNT and Win95. The OLE server for .BMP fields was different on these two OS than on Win 3.1, so people couldn't view or print their pictures! (Win 3.x used PBRUSH and Win 95 and NT used PAINT by default, but if you upgraded from Win 3.x to 95, then you had both! <s>)

It's only more complicated for "non-standard" file types where people may use alternate programs for dealing with files. e.g. .MPG files - Media Player, RealPlayer, Quicktime, one of the Jukebox players or ripper programs may be the application associated this file extension and that is whats stored in the general field. If someone else doesn't have that app installed they normally can't access the data!

Using Binary Memo fields (or the VFP 9.0 BLOB fields) or simply storing the path to external file is a much better alternative to using General fields.

Rick
 
Hi all

There seems to be not alternative to using general fields as the VFP 6.0 report writer demands it. Please inform if this can be done any other way. I generate a temporary cursor for the purpose of reporting, which is anyway destroyed after the reporting is over so storing images is not at all an issue.

Thanks

Ravi
 
vdeveloper

When you drop a Picture/ActiveX Bound Control onto a report, the Report Picture dialog will appear.

You can then select a filename to be the image in your report, such as 'C:\temp\MyImage.jpg'.

Assuming you have saved the image to a memo field you can then copy the image to that file before the report runs with code such as
Code:
[COLOR=blue]COPY MEMO TABLENAME.memofield TO C:\temp\MyImage.jpg[/color]
IF you have used the FILETOSTR() function to save the image, you need to use STRTOFILE() to reverse the process.

If you have stored the path\filename.ext in a table instead you can use either the native COPY FILE or the WinAPI call CopyFile() to copy the file to the temporary file.

You could also assign the value of TABLENAME.filename to an object property and access it that way providing the object was available to the report writer, instead of copying the file.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommander[sup]tm[/sup].com
PDFcommander[sup]tm[/sup].co.uk


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top