Hi all,
I have some problem about VFP7 report. I want to use report to print
the image
that I have scan from the document in tif type but the report ole
image can use only bmp and jpg.Is the vfp7 report can use only this
two type? And when I use BMP file which greater than 1 meg the report
can not run, it is error. How can I do? Thank you for your advise.
Kitty

RE: How to print image file from VFP report? by Leemi

Leemi
Wed Aug 04 08:47:53 CDT 2004

Hi Kitty:

VFP 7.0 does not handle TIFF files. VFP 8.0 does handle TIFF files.

What error do you get with a 1 MG bitmap file?

Here is some code that shows you how to display images in forms and reports
without using a general field. You may find it useful.

REPORT
---------------
By using the MEMO BINARY field type and a UDF(), we can store .JPG files in
a table
field yet when the report runs have them read from DISK. Here's how:

(1) Create a table or cursor with a structure like this (plus any added
fields as
necessary)

FileName C (150)
MemBin MEMO(BINARY)

The command would be CREATE TABLE GENDBF (FileName c(150), MemoBin M
NOCPTRANS)

(2) Append .JPGs file into the MEMO(Binary) field using FILETOSTR() and set
the
filename field accordingly. For instance:

INSERT INTO CURSORNAME VALUES("ToothBrush.JPG", FILETOSTR(<PathToFile>))

(3) The FoxPro report will still need an OLEBOUND control on it to print
pictures,
but instead of pointing the OLEBOUND to a general field, point it FILE and
use this
as the expression:

MYUDF(FileName, MemoBin)

Where MyUDF is in some program made available via SET PROC and reads thusly:

PROCEDURE MYUDF(lpFileName, lpMemoBinFld)
LOCAL lcTemp as String
lcTemp = ADDBS(SYS(2023)) + "JPGTEMP\"
IF !DIRECTORY(lcTemp)
MD (lcTemp)
ENDIF
SET SAFETY OFF
STRTOFILE(lpMemoBinFld, lcTemp + lpFileName)
SET SAFETY ON
RETURN lcTemp + lpFileName

(4) Finally, preview/print the report. You may also want to fire some lines
like
this to clean up afterward:

ERASE ADDBS(SYS(2023)) + "JPGTEMP\*.jpg"
RD ADDBS(SYS(2023)) + "JPGTEMP"

The .PRG uses the code above and the .JPGs that come with W2K, so it should
run on
that OS with no problem.

----------------------------------------------------------------------------
---



FORM
----------
Let's assume we have the table created earlier:

FileName C (150)
MemBin MEMO(BINARY)

This form will display images from it:

PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
DEFINE CLASS form1 AS form
Top = 71
Left = 48
Height = 310
Width = 504
Caption = "Fox Image Demo"
Name = "Form1"

ADD OBJECT image1 AS image WITH ;
Height = 296, ;
Left = 3, ;
Top = 8, ;
Width = 381, ;
Name = "Image1"

ADD OBJECT cmdPrevious AS commandbutton WITH ;
Top = 27, ;
Left = 422, ;
Height = 27, ;
Width = 24, ;
Caption = "<", ;
Name = "cmdPrevious"

ADD OBJECT cmdNext AS commandbutton WITH ;
Top = 27, ;
Left = 446, ;
Height = 27, ;
Width = 24, ;
Caption = ">", ;
Name = "cmdNext"

ADD OBJECT cmdQuit AS commandbutton WITH ;
Top = 72, ;
Left = 405, ;
Height = 27, ;
Width = 84, ;
Caption = "Quit", ;
Name = "cmdQuit"

PROCEDURE getimage
LPARAMETERS lpFileName, lpMemoBinFld

LOCAL lcTemp AS STRING
lcTemp = ADDBS(SYS(2023)) + "JPGTEMP\"
IF !DIRECTORY(lcTemp)
MD (lcTemp)
ENDIF
SET SAFETY OFF
STRTOFILE(lpMemoBinFld, lcTemp + lpFileName)
SET SAFETY ON
RETURN lcTemp + lpFileName
ENDPROC

PROCEDURE Destroy
USE IN SELECT("PICTURES")
ERASE ADDBS(SYS(2023)) + "JPGTEMP\*.jpg"
RD ADDBS(SYS(2023)) + "JPGTEMP"
ENDPROC

PROCEDURE Load
CD JUSTPATH(SUBSTR(SYS(16),AT(' ',SYS(16),2)))
USE PICTURES
ENDPROC

PROCEDURE Init
THISFORM.Image1.Picture = ;
THIS.GetImage(Pictures.FileName, Pictures.MemBin)
ENDPROC

PROCEDURE cmdPrevious.Click
IF RECNO() <> 1
SKIP -1
THISFORM.Image1.Picture = ;
THISFORM.GetImage(Pictures.FileName, Pictures.MemBin)
THISFORM.REFRESH
ENDIF
ENDPROC

PROCEDURE cmdNext.Click
IF RECCOUNT() <> RECNO() AND !EOF()
SKIP
THISFORM.Image1.Picture = ;
THISFORM.GetImage(Pictures.FileName, Pictures.MemBin)
THISFORM.REFRESH
ENDIF
ENDPROC

PROCEDURE cmdQuit.Click
THISFORM.RELEASE
ENDPROC
ENDDEFINE



I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 Public Beta Now Available!! --*
Download the VFP9 beta here: http://msdn.microsoft.com/vfoxpro/

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003

>Hi all,
> I have some problem about VFP7 report. I want to use report to print
>the image
> that I have scan from the document in tif type but the report ole
>image can use only bmp and jpg.Is the vfp7 report can use only this
>two type? And when I use BMP file which greater than 1 meg the report
>can not run, it is error. How can I do? Thank you for your advise.
>Kitty


why i can't print well by fouad

fouad
Fri Aug 06 02:51:02 CDT 2004



hi
i have foxpro 5.0
the printer print the invoice with very small letters (the invoice A4,it
appear only 01 cm)never with normal letter.
i download pak3 but there are not a setup.what must i do?
fouad

Re: why i can't print well by Holger

Holger
Fri Aug 06 03:10:21 CDT 2004

Hi,

you can download the complete SP3 for Visual Studio 97 from here:
http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs97/full.aspx

It's one .EXE and 8 .CAB files with over 100 MB together !!!

--
Holger Vorberg
MS Visual FoxPro MVP, Germany



Re: How to print image file from VFP report? by kittipong60

kittipong60
Fri Aug 06 04:58:47 CDT 2004

thank you very much Lee I'll try it.
kitty