FoxPro/Visual FoxPro - EXPORTAR IMAGENES DE CAMPO GENERAL

 
Vista:

EXPORTAR IMAGENES DE CAMPO GENERAL

Publicado por Juan Carlos (7 intervenciones) el 21/04/2005 19:07:11
HOLA AMIGOS

TENGO UNA TABLA CON UN CAMPO GENERAL QUE CONTIENE IMAGENES .... MI PREGUNTA ES " COMO PUEDO EXTRAER ESAS IMAGENES Y ENVIARLAS A ARCHIVOS DE CUALQUIER FORMATO COMO *.BMP, *.GIF, *.JPG

GRACIAS POR SU TIEMPO
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:EXPORTAR IMAGENES DE CAMPO GENERAL

Publicado por David Amador T. (520 intervenciones) el 21/04/2005 21:34:15

Con VFP 9

Extractar graficas de campos generales usando el ReportListiner
http://support.microsoft.com/kb/894819/EN-US/

Otra forma con VFP 6 hasta 9

*------------------------------------
* Program....: CopyGen
* Author.....: Martín Salías (with special thanks to Raymond Krauss)
* Date.......: 19/18/98
* Notes......: Replace the missing command COPY GENERAL
* Parameters.: tcTable, tcField = Table & Field
* Parameters.: tcBMPFileName = Filename to generate (if no extension supplied, BMP is assumed)
* Returns....: The lenght of the generated file (in bytes)
* See Also...:
*
Lparameters tcTable, tcField, tcBMPFileName

Local lnReturn, lcSaveArea

lnReturn = 0
lcSaveArea = SaveArea()

If Used( tcTable )

If "." $ tcBMPFileName
* se pasó con extensión
Else
* Se agrega la extensión BMP
tcBMPFileName = Allt( tcBMPFileName )
+ ".bmp"
Endif

Local lcTempFile
lcTempFile = Sys(2023) + "\" + Sys(3)

Select ( tcTable )
Copy Next 1 To ( lcTempFile ) Field ( tcField )

lcMemoFileName = lcTempFile + ".fpt"

If File( lcMemoFileName )

Local lnFPT, lnBMP

lnFPT = Fopen( lcMemoFileName, 10 ) &&
Open the Memo File
lnBMP = Fcreate( tcBMPFileName ) &&
Create the new Image File

If lnFPT > 0 And lnBMP > 0
&& If both files are open

Local lnSize, lnPointer

lnSize = Fseek( lnFPT, 0, 2 )
&& Find the total size of the memo

lnPointer = Fseek( lnFPT, 0 )
&& Return to the beginning

* PROBLEM, PROBLEM; fRead can't
Read more than 64K At once, so we have To
* read the whole picture on 64K
Blocks.
*
Local lnBytesLeft, lcReadBuffer,
lnBytesToRead

lnBytesLeft = lnSize
lcReadBuffer = ""

Do While lnBytesLeft > 0

lnBytesToRead = Iif(
lnBytesLeft > 65535, 65535, lnBytesLeft )

lnBytesLeft = lnBytesLeft -
lnBytesToRead

* Gets the binary data of
the Image
lcReadBuffer =
lcReadBuffer + Fread( lnFPT, lnBytesToRead )
Enddo

Local lnBMPStart, lcWriteBuffer

lnBMPStart = At( 'BM',
lcReadBuffer ) && find start of a BMP file

* Put the rest of the binary data
On the Buffer
lcWriteBuffer = Right(
lcReadBuffer, Len( lcReadBuffer ) - lnBMPStart + 1 )

lnReturn = Fwrite( lnBMP,
lcWriteBuffer ) && write to BMP file
Endif

Fclose( lnFPT )
&& close files
Fclose( lnBMP )

Delete File ( lcTempFile + ".*" )
Endif
Endif

RestArea( lcSaveArea )

Return lnReturn

Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar