Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anyone use MS Word with Foxpro before?
Message
 
À
12/10/2000 14:56:54
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00428712
Message ID:
00428718
Vues:
18
>Hello All ;
>I am creating an Instance of MS Word(2000)to Open up a document and parse out some data... However I cannot find any Documentation to do this. Unfortaunately the only thing close to documentation refers to VB, not VFP! Does anyone have any information on this, or maybe know where to get a help file for it? Here is a snipet of my Code:
>
>PARAMETER FileNameToProcess
>
>oWordApp = GETOBJECT("Word.Application")
>oWordApp.Visible = .T.
>oWordApp.Open(&FileNameToProcess)
>
>
>
>Any Ideas, Suggestions, Links, Code Sample(s)?
>Thanks
>Rick

You can use the vb help and translate that to vfp. Most of all that isn't very difficult.
Also you can use the Word macro recorder to record the things you want to do.
Then you can read that (VB) code and convert it to foxpro code

Some simple sample code follows
(Just a tryout from myself when i started using word from vfp)
#Define wdLineStyleDouble	7
#Define wdLineWidth050pt	4
#Define wdAuto				0

#Define wdBorderTop			-1
#Define wdBorderLeft		-2
#Define wdBorderBottom		-3
#Define wdBorderRight		-4

#Define wdCharacter			1
#Define wdCell				5
#Define wdLine				12

oWord = CreateObject("Word.Application")
oWord.Caption = "Flexiglas 5.0.14"
oWord.documents.add 
oWord.Selection.Font.Size = 12
oWord.Selection.Font.Name = "Times New Roman"
oWord.Selection.TypeText("Ko Wisse")
oWord.Selection.MoveUp(wdLine, 1)
oWord.Selection.TypeParagraph
oWord.Selection.TypeText("Cor Scheele")
oWord.ActiveDocument.Tables.Add(oWord.Selection.Range, 3, 6)
oWord.Selection.TypeText("cel 1")
oWord.Selection.MoveRight(wdCell)
oWord.Selection.TypeText("cel 2")
oWord.Selection.MoveRight(wdCell)
oWord.Selection.TypeText("cel 3")
oWord.Selection.MoveDown(wdLine, 1)
oWord.Selection.TypeText("cel 10")
oWord.Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
oWord.Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
oWord.Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
oWord.Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
oWord.Selection.MoveRight(wdCharacter, 2)
oWord.Selection.MoveUp(wdLine, 1)
oWord.Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
oWord.Selection.MoveDown(wdLine, 2)
oWord.Selection.MoveRight(wdCharacter, 2)
oWord.Selection.MoveLeft(wdCharacter, 1)
With oWord.Options
    .DefaultBorderLineStyle = wdLineStyleDouble
    .DefaultBorderLineWidth = wdLineWidth050pt
    .DefaultBorderColorIndex = wdAuto
EndWith
With oWord.Selection.Borders(wdBorderTop)
    .LineStyle = oWord.Options.DefaultBorderLineStyle
    .LineWidth = oWord.Options.DefaultBorderLineWidth
    .ColorIndex = oWord.Options.DefaultBorderColorIndex
EndWith
oWord.visible = .t.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform