Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP5 word automation
Message
De
13/01/2000 03:05:47
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00317221
Message ID:
00317428
Vues:
12
>Hi All,
>
>I'd like to reset the top and bottom margin of the new .doc to 0.5.
>
>This code does not crash but, it also does not change the margins. I've tried moving the code but this doesn't help.
>
>When the .doc loads in "Word", the text is still "selected", do you think this has something to do wioth the margins not be reset?
>
>Any help woould be appreciated, as always.
>
>Thanks,
>
>Jim Harvey
>jharvey@netrax.net
>
>
>***Here's the code
>store ThisForm.Sttxtcons.value to mcon
>repo form strpconsignorstatement for stncwork.cons_no = ThisForm.Sttxtcons.value ;
>to file &mcon ascii
>OWORD = createobject("Word.application")
>OWORD.visible = .T.
>mcurdir = curdir()
>myDocument = mcurdir + "\" + "&MCON" + ".DOC"
>oword.documents.open(mydocument)
>OWORD.activedocument.pagesetup.TopMargin = 0.5
>OWORD.activedocument.pagesetup.BottomMargin = 0.5
>OWORD.Selection.WholeStory
>OWORD.selection.Font.Name = "Courier New"
>OWORD.selection.Font.Size = 10
>ThisForm.Sttxtcons.value = " "
>ThisForm.Sttxtcons.SETFOCUS()
>thisform.refresh


James,
Margin setup is by points. Make it :

lnMargin = oword.CentimetersToPoints(0.5)
OWORD.activedocument.pagesetup.TopMargin = lnMargin
OWORD.activedocument.pagesetup.BottomMargin = lnMargin

PS: Also there is InchesToPoints if that's inch.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform