Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word OLE and VFP General fields
Message
De
20/09/1999 08:04:14
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
18/09/1999 20:55:46
Al Schoen
Surf Technologies, Ltd.
Princeton, New Jersey, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00266421
Message ID:
00266629
Vues:
11
>Using OLE commands from VFP to "control" Word is no problem. I have an application that uses documents stored in a general field of a VFP table. I have no problem initiating an edi session with Word for the document, but at times, I would like to reference the Word application object.
>
>Is there any way to take the document stored in a general field and be able to control Word as though full OLE automation was being used? If this is not possible, is there a way to take the document stored in the general field and move it to a temporary ".DOC" file?


Al,
It doesn't matter if you instantiate word with createobject or it's an object bound to a general field.

with thisform.OLEWord.Object.Application
*.....
endwith
CREATE cursor wtest (wf g)
APPEND blank
APPEND general wf from ("c:\my documents\test.doc")
oform = createobject("form")
WITH oform
  .addobject("olbW","Oleboundcontrol")
  .height = 420
  .width = 620
  WITH .olbW
    .top = 10
    .left = 10
    .height = 400
    .width = 600
    .controlsource = "wtest.wf"    		&& Embedded word doc
    #DEFINE wdSeparateByTabs  1
    #DEFINE wdTableFormatColorful1 8
    #DEFINE wdSaveChanges  -1
    #DEFINE wdCollapseEnd  0
    SELECT first_name, last_name ;
      from (home()+"samples\data\employee") ;
      into cursor myCursor
    Application.datatoclip("myCursor",_tally, 3)
    WITH .object
      .Content.select
      WITH .Application.Selection
        .Text = "Hello from VFP."+chr(13)
        .Collapse(wdCollapseEnd)	&& Go to end of selection
        .Text = _cliptext
        .ConvertToTable(wdSeparateByTabs,,,, ;
          wdTableFormatColorful1,,,,,,,.f.,,.f.)	&& Convert to table format Colorful 1
      ENDWITH
      .saveas("c:\temp\savedfromgen.doc")  && saved to disk
      .close(wdSaveChanges)
    ENDWITH
    *	.visible = .t. && If you want to display the form 
  ENDWITH
  *	.Show	&& If you want to display the form
ENDWITH
*READ EVENTS	&& Start event processing - not needed if just process the word object and close
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