Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating Word
Message
From
01/04/2000 13:56:32
 
 
To
01/04/2000 09:30:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00351619
Message ID:
00353924
Views:
23
Nice solution to the issue while retaining the table structure, Cetin.

>I also think saving to memo binary or just keeping path&name is better. Anyway it might be to much asking you to convert to that style already in general field. So here's "one" way of doing it from general field (OleBoundControls are hosted by their applications themselves - word.application, that's instead of oWord = createobject("word.application") you use directly myForm.myContainer.myOleboundcontrol ) :
>
Create cursor wtest (wf g)
>Append blank
>Append general wf from (getfile("DOC"))
>lcSampleTable = _samples+"\data\employee"
>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 (lcSampleTable) ;
>      into cursor myCursor
>    Application.datatoclip("myCursor",_tally, 3)
>    With .object
>      .Content.select
>      With .Application.Selection
>        .Collapse(wdCollapseEnd) && Go to end of selection - remove selection
>        .Text = "Hello from VFP."+chr(13)
>        .Collapse(wdCollapseEnd)
>        .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.
>  Endwith
>  *.Show								&& If you want to display the form
>Endwith
>*READ EVENTS	&& Start event processing - not needed if just process the word object in background and quit
Cetin
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform