Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FRX2ANY word module
Message
De
08/03/2011 10:10:59
 
 
À
07/03/2011 23:00:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Database:
Visual FoxPro
Divers
Thread ID:
01502885
Message ID:
01502905
Vues:
59
Hi Michael,

This is how I have mine set up. It may be overkill, but there could be some useful parts.
This iterates through the users' selections of filetypes, erases previous creations, (re)creates them,
and deposits them in defined folders. It also morphs the mouse into the appropriate logo.
Things to watch out for when creating Word docs with FRX2ANY: if you're using a logo,
make sure it's not too big; set lwordwrap to .f.; if you have any 'Print When' conditionals,
make sure the 'Print Repeated Values' is set to Yes, even if it's disabled.

parameters tcdocname,tcreference,tcprefix,tcfilter

Where:

tcdocname= document filename
tcreference= record ID
tcprefix=internal document type identification
tcfilter= FOR expression
ognrl= object in which this code resides


local lcreference,lcprefix,lcextension,lcoutputfilename,lncount,loobjname,;
llimage,llword,llpdf,llexcel,lcfullname,lctableref,lnreturn,lcforexpr,;
lnpdfdirlen,i,lcclasslib,lcerase,loactiveform,lcicon,lWrapText

store "" to lcreference,lcprefix,lcextension,lcoutputfilename,loobjname,lcfullname,lctableref,lcforexpr
store 0 to lncount,lnreturn,lnpdfdirlen,i

if vartype(oforms)="O"
loactiveform=oforms.screenactiveform()
else
if type("_screen.activeform.baseclass")=="C"
loactiveform=_screen.activeform
endif
endif

lcreference=lower(alltrim(tcreference))
lcprefix=lower(alltrim(tcprefix))
lcerase=left(lcprefix,4)
lcerase=this.icsearchdir+"\"+lcerase+"*.*"
erase &lcerase
lncount=iif(this.increateimg>1,1,0)+this.increateword+this.increatepdf+this.increateexcel
lctableref=this.ictablealias
lcoutputfilename=lcprefix+lcreference
lcoutputfilepath=sys(5)+this.icsearchdir
ognrl.inrpttxtimg=1
lcclasslib="set classlib to frx2any in frx2any.app alias frx2any additive"

for i=1 to lncount

do case

case this.increateimg>1 .and. !llimage
lcicon=iif(this.increateimg=2,"c:\ed\graphics\jpeg.ico","c:\ed\graphics\gif.ico")
_screen.mousepointer=99
_screen.mouseicon=lcicon
loactiveform.setall("MousePointer",99)
loactiveform.setall("MouseIcon",lcicon)
public goimagefile
&lcclasslib
goimagefile=createobj('frx2any.imagefile')
store this.increateimg to goimagefile.nimagefiletype
loobjname="goimagefile"
llimage=.t.

case this.increateword=1 .and. !llword
lcicon="c:\ed\graphics\word.ico"
_screen.mousepointer=99
_screen.mouseicon=lcicon
loactiveform.setall("MousePointer",99)
loactiveform.setall("MouseIcon",lcicon)
public gowordfile
&lcclasslib
gowordfile=createobj('frx2any.wordfile')
loobjname="gowordfile"
gowordfile.lwraptext=.F.
llword=.t.

case this.increateexcel=1 .and. !llexcel
lcicon="c:\ed\graphics\excel.ico"
_screen.mousepointer=99
loactiveform.mouseicon=lcicon
loactiveform.setall("MousePointer",99)
loactiveform.setall("MouseIcon",lcicon)
public goexcelfile
&lcclasslib
goexcelfile=createobj('frx2any.excelfile')
loobjname="goexcelfile"
llexcel=.t.

case this.increatepdf=1 .and. !llpdf
lcicon="c:\ed\graphics\pdffile.ico"
_screen.mousepointer=99
loactiveform.mouseicon=lcicon
loactiveform.setall("MousePointer",99)
loactiveform.setall("MouseIcon",lcicon)
public gopdffile
&lcclasslib
gopdffile=createobj('frx2any.pdffile')
loobjname="gopdffile"
if this.inpdfstyle=1
local array lapdfdir[1]
lnpdfdirlen=adir(lapdfdir,lcoutputfilepath+"\*.PDF")
if lnpdfdirlen=0
lcoutputfilename="1-"+lcprefix+lcreference
else
lcoutputfilename=alltrim(str(val(left(lapdfdir[1,1],at("-",lapdfdir[1,1])-1))+1))+"-"+lcprefix+lcreference
gopdffile.caddto=sys(5)+lower(alltrim(lcoutputfilepath+"\"+lapdfdir[1,1]))
endif
endif
if this.inpdfprotect=1
gopdffile.cmasterpassword=x3ed("D",alltrim(getpref("pdfpwd",,"sysvars")))
endif
llpdf=.t.

endcase

lcfullname=lower(alltrim(lcoutputfilepath+"\"+lcoutputfilename))

with &loobjname
.unlock('KEY')
.cexportfilename=lcoutputfilename
.csavefolder=lcoutputfilepath
.ldisplaystatus=.f.
.noutputtype=4
.cforexpression=tcfilter
if vartype(gopdffile)="O"
.lincludefont=.t.
.ncodepage=1251
endif
_screen.mousepointer=99
_screen.mouseicon=lcicon
loactiveform.setall("MousePointer",99)
loactiveform.setall("MouseIcon",lcicon)
lnreturn=.save(gcdocreport)
if lnreturn>0
x3msgsvc("Error no. . Cannot create output file.",alltrim(str(lnreturn)))
else
if this.increatepdf=1 .and. lnpdfdirlen>0 .and. file(gopdffile.caddto)
erase (gopdffile.caddto)
endif
.release()
loobjname=null
release (loobjname)
release lapdfdir
endif
endwith

next i

_screen.mouseicon=""
_screen.mousepointer=0
loactiveform.setall("MousePointer",0)
loactiveform.setall("MouseIcon","")
loactiveform=null
release loactiveform
_screen.paint()
ognrl.inrpttxtimg=0

return
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform