ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

HELLO LES FOXEURS !   



L'auteur

ybenam
Algérie Algérie
Membre Simple
# 0000002080
enregistré le 21/04/2008


Fiche personnelle


Note des membres
pas de note

Contributions > 09 - Automation > Word

HELLO LES FOXEURS !
# 0000000575
ajouté le 20/05/2008 15:28:18 et modifié le 20/05/2008
consulté 6671 fois
Niveau initié

Version(s) Foxpro :
VFP 6.0

Description
Automation de word ,écriture avec WordArt avec arrière plan.Sauvegarde sous page web ,supprimer les scrollbars et capturer image : Hello les foxeurs ! benameuryousfi1@gmail.com
Code source :
*Ecrire par automation dans un fichier WOrd avec effets WordArt,convertir en Page Web fullscreen(enlever les scrollbars),
*recopier et coller dans le presse papier l'image capturée  ****Hello les Foxeurs !*****

if len(sys(5)+sys(2003))<=3
yrep=sys(5)+sys(2003)
else
yrep=sys(5)+sys(2003)+"\"
endi
_screen.windowstate=1

#DEFINE wdCollapseEnd 0
#DEFINE CR CHR(13)
#DEFINE YLIGNE REPLICATE("_",100)
#DEFINE autoIn2Pts 72
#DEFINE msoTextEffect11 18   &&N°1 à 29
#DEFINE wdAlignParagraphRight 2   &&alignement à droite
#DEFINE msoGradientDaybreak  4
#DEFINE  msoShapeRectangle  1
PUBLIC oWord
oWord = CreateObject("Word.Application")
oWord.Visible = .f.
oDocument = oWord.Documents.Add()
oWord.WindowState = 2  &&minimisé
*************************************************************************
*expression.AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold,FontItalic, Left, Top, Anchor
#DEFINE MsoTextEffect 11
oDocument.Shapes.AddTextEffect(11,"HELLO WORLD","monotype corsiva",36,.t.,.f.,40,10 ,oDocument.Paragraphs(1).Range)
oDocument.Shapes.AddTextEffect(18,"WORD IS COOL with vfp6.0 !","monotype corsiva",36,.t.,.f.,80,10 ,oDocument.Paragraphs(1).Range)
oDocument.Shapes.AddTextEffect(27,"HELLO FOXERS !","monotype corsiva",60,.t.,.f.,100,150 ,oDocument.Paragraphs(1).Range)
oDocument.Shapes.AddTextEffect(12,"* * * * *","monotype corsiva",60,.t.,.f.,140,300,oDocument.Paragraphs(1).Range)

#DEFINE msoGradientFromCenter 7
With oDocument.Background.Fill
 .ForeColor.RGB = RGB(255,0,0)
 .BackColor.RGB = RGB(0,170,170)
 .TwoColorGradient(7, 1 )   &&msoGradientFromCenter
 endwith
***********************************************************************************************
&&sauvegarde sous page web et affichage
myDocName =yrep+ juststem(oDocument.Name)
bb=myDocName+"_fichiers"
myDocName =myDocName + ".html"
oDocument.SaveAs(myDocName,8)   &&sauvagarde web

&&afficher fullscreen
apIE=createobject("InternetExplorer.application")
apIE.navigate(myDocName)
with apIE
.fullscreen=.t.
endwith
do while apIE.busy or apIE.readystate<>4
enddo
inkey(1)
apIE.document.body.scroll="no"   &&enlever le scrollbar (après les transitionnings obligatoirement)
inkey(1)
apIE.visible=.t.
*********************************************************
&&capture écran
DECLARE INTEGER keybd_event IN Win32API ;
      INTEGERINTEGERINTEGERINTEGER
   VK_SNAPSHOT = 44
   VK_LMENU = 164
   KEYEVENTF_KEYUP = 2
   KEYEVENTF_EXTENDEDKEY = 1
DOEVENTS
keybd_event(VK_SNAPSHOT, 1, 0, 0 )
keybd_event(VK_SNAPSHOT, 1, KEYEVENTF_KEYUP, 0 )
DOEVENTS
**********************************************************
apIE.quit
**********
oShell = CreateObject("WScript.Shell")
run/N3 mspaint.exe ""   &&important : plein écran pour avoir le focus
inkey(1)
oShell.sendkeys("^{a}^{v}^{f}")  &&sélectionner tout,coller,afficher l'image
*******************
inkey(1)
oDocument.close()
oWord.quit

*dele file  &myDocname
fso =createobject('Scripting.FileSystemObject')
fldr = fso.DeleteFile(myDocName)
xx=juststem(myDocName)+"_fichiers"
fldr1=fso.DeleteFolder(xx)

set safe on
messagebox("L'image créée est aussi dans le presse papier.(run/n clipbrd)!",0+32,"")


Commentaires
Aucun commentaire enregistré ...

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3