Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word automation to unlimited number of items
Message
From
14/06/2002 00:57:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/06/2002 12:08:10
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00667775
Message ID:
00668381
Views:
16
>>Create a mailmerge template with 2 (or 3?) fields and make them in whatever layout you want. ie:
>>
>>
>>#Define MYDBC fullpath("testdata.DBC")
>>#Define wdSendToEmail  2
>>#Define wdSendToFax  3
>>#Define wdSendToNewDocument  0
>>#Define wdSendToPrinter  1
>>cSQLStatement1 = "SELECT * FROM employee where title like [Sales%]"
>>cSQLStatement2 = ""
>>
>>* Be carefull with where clause - where title = [Sales] fails
>>* for ODBC uses ANSI SQL (exact match)
>>* Two strings for first is limited to 255 chars
>>
>>oWordDocument=createobject("word.application")	&& Create word object
>>With oWordDocument
>>  .Documents.Add(sys(5)+curdir()+'mytemplate.dot') && Use a predefined template
>>  With .ActiveDocument.MailMerge
>>    .OpenDataSource(,,,.T.,,,,,,,, ;
>>      "DSN=Visual FoxPro Database;SourceDB="+MYDBC+;
>>      ";SourceType=DBC;Exclusive=No;",;
>>      cSQLStatement1, cSQLStatement2) && Open data source - Link to source
>>    .Destination = wdSendToNewDocument
>>    .Execute
>>  Endwith
>>  .Visible = .t.
>>Endwith
>>
>
>I just need to understand how will the store will be done in regards to two fields for example.

This would be fieldcount free as long as you don't include any mergefield in template that doesn't exist in source.

>
>>Alternatively (I think this one easier for you:) create an HTML file and open that in word.
>
>I've been thinking about that but only Word will take care of the 3 columns format I need with exact page breaks where needed.

You could place page breaks anywhere in doc after sending to a new document (say every 10th).

But as I could understand from your other post you solved that by HTML approach. If misunderstood then I can send you a working sample:)
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform