In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Incluir una imagen en un dbf

Foro público de Xailer en español
Responder
mhormigoz
Mensajes: 19
Registrado: Dom May 26, 2013 1:27 am

Incluir una imagen en un dbf

Mensaje por mhormigoz »

Buenas a todos:
¿Se puede?, leyendo y leyendo, usando el tipo general, por lo visto si se puede, pero no se como hacerlo. Si alguien sabe algo, se lo agradeceria.
Lo necesito, para pasarle imágenes al Crystal Reports 8.
Gracias de antemano.
Mario Hormigo.
xevi[1]
Mensajes: 39
Registrado: Lun Jun 14, 2010 3:52 pm

Incluir una imagen en un dbf

Mensaje por xevi[1] »

Mario,
Yo lo que hago es guardar una ruta de la imagen en cuestión, y así­, cada vez
que necesito de ella, la busco en la ruta y la abro, o la copio...
Un Saludo,
Xevi.
"Mario Hormigo" <mhormigoz[at]hotmail[dot]com> ha escrit al
missatge:52a8fb84$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Buenas a todos:
>
> ¿Se puede?, leyendo y leyendo, usando el tipo general,
> por lo visto si se puede, pero no se como hacerlo. Si alguien sabe algo,
> se lo agradeceria.
> Lo necesito, para pasarle imáges al Crystal Reports 8.
>
> Gracias de antemano.
> Mario Hormigo.
ze_pcinfor
Mensajes: 34
Registrado: Mar Jun 10, 2008 1:53 am

Incluir una imagen en un dbf

Mensaje por ze_pcinfor »

Olá
Se precisar gravar imagem em .DBF pode usar a rotina abaixo. No exemplo
estou gravando um .EXE mas pode gravar qualquer imagem.
** inicio rotina
* ArqImage.DBF COM 6 campos memos
* aqui estou salvando um executavel com o nome de gernota_fe.exe mas pode-se
salvar imagens que tambem dara certo
FUNCTION main
arquivo="c:s_gernota_fegernota_fe.exe"
caso=3
if caso=1 .OR. caso=3
** SALVA ARQUIVO EM DBF
qdirectory:=directory(arquivo)
mretorno=BinData(Memoread( arquivo ),.T.)
mtamimagem:=LEN(mretorno)
mtamgravar:=mtamimagem
mdividegrv:=INT(LEN(mretorno)/659000)
IF mdividegrv>1
mtamgravar:=INT(LEN(mretorno)/mdividegrv)
ENDIF
IF !FILE("ARQIMAGE.DBF")
estru:={{"MEMO01","M",8,0},{"MEMO02","M",8,0},{"MEMO03 ","M",8,0},{"MEMO04","M",8,0},{"MEMO05","M",8,0},{ "MEMO06","M",8,0},{"QTGRAVMEMO","N",2,0}}
DBCREATE("ARQIMAGE.DBF",estru)
ENDIF
mcontadgrv:=1
USE
USE ARQIMAGE ALIAS ARQIMAGE
IF LASTREC()=0
APPEND BLANK
ENDIF
DO WHILE !EMPTY(mretorno)
mretorgrv:=substr(mretorno,1,mtamgravar)
ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2)):=mretorgrv
* x:=ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2))
mretorno:=substr(mretorno,mtamgravar+1)
mcontadgrv++
ENDDO
ARQIMAGE->QTGRAVMEMO:=mcontadgrv-1
* FIM SALVA ARQUIVO EM DBF
ENDIF
*
************************************************************ ************************************
IF caso=2 .OR. caso=3
IF caso=2
USE
USE ARQIMAGE ALIAS ARQIMAGE
ENDIF
* VOLTANDO IMAGEM DO ARQUIVO
mcontadgrv:=1
mretorno:=""
DO WHILE mcontadgrv<=ARQIMAGE->QTGRAVMEMO
mretorgrv:=ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2))
mretorno+=mretorgrv
*? LEN(mretorgrv)
* ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2)):=mretorgrv
* x:=ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2))
* mretorno:=substr(mretorno,mtamgravar+1)
mcontadgrv++
ENDDO
mretorno:=BinData(mretorno,.F.)
caminearq=FCREATE("c:s_gernota_fetemp.EXE",0)
* Gravacao no arquivo.
FWRITE(caminearq,mretorno, Len(mretorno))
FCLOSE(caminearq)
* FIM VOLTANDO IMAGEM DO ARQUIVO
ENDIF
RETURN.T.
* #INCLUDE "common.ch"
function BinData(x,maskOnOff)
IF maskOnOff
x := StrTran(x,chr(00),'Ch#00Er')
x := StrTran(x,chr(26),'Ch#26Er')
x := StrTran(x,chr(34),'Ch#34Er')
x := StrTran(x,chr(39),'Ch#39Er')
x := StrTran(x,chr(47),'Ch#47Er')
x := StrTran(x,chr(91),'Ch#91Er')
x := StrTran(x,chr(92),'Ch#92Er')
x := StrTran(x,chr(93),'Ch#93Er')
x := StrTran(x,chr(96),'Ch#96Er')
x := StrTran(x,chr(132),'Ch#132Er')
x := StrTran(x,chr(145),'Ch#145Er')
x := StrTran(x,chr(146),'Ch#146Er')
x := StrTran(x,chr(148),'Ch#148Er')
x := StrTran(x,chr(180),'Ch#180Er')
ELSE
x := StrTran(x,'Ch#00Er',chr(00))
x := StrTran(x,'Ch#26Er',chr(26))
x := StrTran(x,'Ch#34Er',chr(34))
x := StrTran(x,'Ch#39Er',chr(39))
x := StrTran(x,'Ch#47Er',chr(47))
x := StrTran(x,'Ch#91Er',chr(91))
x := StrTran(x,'Ch#92Er',chr(92))
x := StrTran(x,'Ch#93Er',chr(93))
x := StrTran(x,'Ch#96Er',chr(96))
x := StrTran(x,'Ch#132Er',chr(132))
x := StrTran(x,'Ch#145Er',chr(145))
x := StrTran(x,'Ch#146Er',chr(146))
x := StrTran(x,'Ch#148Er',chr(148))
x := StrTran(x,'Ch#180Er',chr(180))
ENDIF
return x
** fim rotina
Sem mais
José Alves Siqueira
"Xevi" escreveu na notí­cia da mensagem:52a96b32$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
Mario,
Yo lo que hago es guardar una ruta de la imagen en cuestión, y así­, cada vez
que necesito de ella, la busco en la ruta y la abro, o la copio...
Un Saludo,
Xevi.
"Mario Hormigo" <mhormigoz[at]hotmail[dot]com> ha escrit al
missatge:52a8fb84$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Buenas a todos:
>
> ¿Se puede?, leyendo y leyendo, usando el tipo general,
> por lo visto si se puede, pero no se como hacerlo. Si alguien sabe algo,
> se lo agradeceria.
> Lo necesito, para pasarle imáges al Crystal Reports 8.
>
> Gracias de antemano.
> Mario Hormigo.
Cassiano de Oliveira
Mensajes: 475
Registrado: Mar Jul 24, 2012 10:21 pm

Incluir una imagen en un dbf

Mensaje por Cassiano de Oliveira »

Legal José, obrigado por compartilhar...
[]´s
"José Alves Siqueira" wrote in message news:52aa16a6$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
Olá
Se precisar gravar imagem em .DBF pode usar a rotina abaixo. No exemplo
estou gravando um .EXE mas pode gravar qualquer imagem.
** inicio rotina
* ArqImage.DBF COM 6 campos memos
* aqui estou salvando um executavel com o nome de gernota_fe.exe mas pode-se
salvar imagens que tambem dara certo
FUNCTION main
arquivo="c:s_gernota_fegernota_fe.exe"
caso=3
if caso=1 .OR. caso=3
** SALVA ARQUIVO EM DBF
qdirectory:=directory(arquivo)
mretorno=BinData(Memoread( arquivo ),.T.)
mtamimagem:=LEN(mretorno)
mtamgravar:=mtamimagem
mdividegrv:=INT(LEN(mretorno)/659000)
IF mdividegrv>1
mtamgravar:=INT(LEN(mretorno)/mdividegrv)
ENDIF
IF !FILE("ARQIMAGE.DBF")
estru:={{"MEMO01","M",8,0},{"MEMO02","M",8,0},{"MEMO03 ","M",8,0},{"MEMO04","M",8,0},{"MEMO05","M",8,0},{ "MEMO06","M",8,0},{"QTGRAVMEMO","N",2,0}}
DBCREATE("ARQIMAGE.DBF",estru)
ENDIF
mcontadgrv:=1
USE
USE ARQIMAGE ALIAS ARQIMAGE
IF LASTREC()=0
APPEND BLANK
ENDIF
DO WHILE !EMPTY(mretorno)
mretorgrv:=substr(mretorno,1,mtamgravar)
ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2)):=mretorgrv
* x:=ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2))
mretorno:=substr(mretorno,mtamgravar+1)
mcontadgrv++
ENDDO
ARQIMAGE->QTGRAVMEMO:=mcontadgrv-1
* FIM SALVA ARQUIVO EM DBF
ENDIF
*
************************************************************ ************************************
IF caso=2 .OR. caso=3
IF caso=2
USE
USE ARQIMAGE ALIAS ARQIMAGE
ENDIF
* VOLTANDO IMAGEM DO ARQUIVO
mcontadgrv:=1
mretorno:=""
DO WHILE mcontadgrv<=ARQIMAGE->QTGRAVMEMO
mretorgrv:=ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2))
mretorno+=mretorgrv
*? LEN(mretorgrv)
* ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2)):=mretorgrv
* x:=ARQIMAGE->&("MEMO"+STRZERO(mcontadgrv,2))
* mretorno:=substr(mretorno,mtamgravar+1)
mcontadgrv++
ENDDO
mretorno:=BinData(mretorno,.F.)
caminearq=FCREATE("c:s_gernota_fetemp.EXE",0)
* Gravacao no arquivo.
FWRITE(caminearq,mretorno, Len(mretorno))
FCLOSE(caminearq)
* FIM VOLTANDO IMAGEM DO ARQUIVO
ENDIF
RETURN.T.
* #INCLUDE "common.ch"
function BinData(x,maskOnOff)
IF maskOnOff
x := StrTran(x,chr(00),'Ch#00Er')
x := StrTran(x,chr(26),'Ch#26Er')
x := StrTran(x,chr(34),'Ch#34Er')
x := StrTran(x,chr(39),'Ch#39Er')
x := StrTran(x,chr(47),'Ch#47Er')
x := StrTran(x,chr(91),'Ch#91Er')
x := StrTran(x,chr(92),'Ch#92Er')
x := StrTran(x,chr(93),'Ch#93Er')
x := StrTran(x,chr(96),'Ch#96Er')
x := StrTran(x,chr(132),'Ch#132Er')
x := StrTran(x,chr(145),'Ch#145Er')
x := StrTran(x,chr(146),'Ch#146Er')
x := StrTran(x,chr(148),'Ch#148Er')
x := StrTran(x,chr(180),'Ch#180Er')
ELSE
x := StrTran(x,'Ch#00Er',chr(00))
x := StrTran(x,'Ch#26Er',chr(26))
x := StrTran(x,'Ch#34Er',chr(34))
x := StrTran(x,'Ch#39Er',chr(39))
x := StrTran(x,'Ch#47Er',chr(47))
x := StrTran(x,'Ch#91Er',chr(91))
x := StrTran(x,'Ch#92Er',chr(92))
x := StrTran(x,'Ch#93Er',chr(93))
x := StrTran(x,'Ch#96Er',chr(96))
x := StrTran(x,'Ch#132Er',chr(132))
x := StrTran(x,'Ch#145Er',chr(145))
x := StrTran(x,'Ch#146Er',chr(146))
x := StrTran(x,'Ch#148Er',chr(148))
x := StrTran(x,'Ch#180Er',chr(180))
ENDIF
return x
** fim rotina
Sem mais
José Alves Siqueira
"Xevi" escreveu na notí­cia da mensagem:52a96b32$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
Mario,
Yo lo que hago es guardar una ruta de la imagen en cuestión, y así­, cada vez
que necesito de ella, la busco en la ruta y la abro, o la copio...
Un Saludo,
Xevi.
"Mario Hormigo" <mhormigoz[at]hotmail[dot]com> ha escrit al
missatge:52a8fb84$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Buenas a todos:
>
> ¿Se puede?, leyendo y leyendo, usando el tipo general,
> por lo visto si se puede, pero no se como hacerlo. Si alguien sabe algo,
> se lo agradeceria.
> Lo necesito, para pasarle imáges al Crystal Reports 8.
>
> Gracias de antemano.
> Mario Hormigo.
---
Este email está limpo de ví­rus e malwares porque a proteção do avast! Antiví­rus está ativa.
http://www.avast.com
mhormigoz
Mensajes: 19
Registrado: Dom May 26, 2013 1:27 am

Incluir una imagen en un dbf

Mensaje por mhormigoz »

José, al intentar compilar no me reconoce al funcion bindata, algo estoy haciendo mal, debo incluir alguna libreria o algo.
Gracias de antemano.
Mario Hormigo.
ze_pcinfor
Mensajes: 34
Registrado: Mar Jun 10, 2008 1:53 am

Incluir una imagen en un dbf

Mensaje por ze_pcinfor »

Olá.
A funcao bindata esta no final do exemplo, pode verificar.
Copie o exemplo desde
** inicio rotina
ate
** fim rotina
Sem mais
José Alves Siqueira
"Mario Hormigo" escreveu na notí­cia da
mensagem:52ae1fca$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
José, al intentar compilar no me reconoce al funcion
bindata, algo estoy haciendo mal, debo incluir alguna
libreria o algo.
Gracias de antemano.
Mario Hormigo.
mhormigoz
Mensajes: 19
Registrado: Dom May 26, 2013 1:27 am

Incluir una imagen en un dbf

Mensaje por mhormigoz »

Perdón José, era tarde y no lo vi, solo compile la primera parte, la que graba, probaré todo.
Gracias.
Mario Hormigo.
Responder