ҧ report ٻẺ

   
** ˹֧Ũҡ c:\testdata.dbf տŴҧѧ
* name
* address
* city
* state
* zipcode

oMyform=CREATEOBJECT('new_form')
oMyform.SHOW
READ EVENTS

* Form class definition. The form contains two command buttons.

DEFINE CLASS new_form AS FORM
AutoCenter=.T.
BackColor=RGB(192,192,192)
Width= 225
Height= 150
Caption= "Using OLE Automation Print Mail Merge"
ADD OBJECT olecmd AS cmdOLE WITH Top=50, Left=60
ADD OBJECT mycmd AS cmdquit WITH Top=80, Left=60
ENDDEFINE

* Class definition for the command button. When the user clicks the
* command button, OLE Automation begins.

DEFINE CLASS cmdOLE AS COMMANDBUTTON
Width=100
Height=25
Caption = "Mail Merge"

PROCEDURE CLICK
PUBLIC oWord
oWord = CREATEOBJECT("Word.Basic")
WITH oWord
.AppShow && Makes Word Visible
.FileNewDefault && Opens up blank Word document
.MailMergeMainDocumentType(0) &&the active window a document

* ç鹤س˹ path ͧѺ
.MailMergeOpenDataSource("c:\testdata.dbf",0,0,1,0,"", ;
"",0, "","","DSN=Visual FoxPro Tables;DBQ=C:\;DefaultDir=C:\ ;
Deleted=1;DriverId=24;JetIniPath=odbcddp.ini;Statistics=0;", ;
"SELECT * FROM testdata.dbf","")

* Activates the mail merge main document
.MailMergeEditMainDocument

* The following Insert commands place text into the Word
* document. You can change these commands to place any text in
* the document. This example uses a typical business letter
* format.

&& ǹ͵Ǩ ͧԸ¹ҤѺҡ

.Insert("550 College Terrace") && Inserts a string && text
.InsertPara && Inserts a carriage return
.Insert("Orangeburg, SC 29915")
.InsertPara
.InsertPara
.InsertMergeField("name") && ͪͿŴ table
.InsertPara
.InsertMergeField("address") && ͪͿŴ table
.InsertPara
.InsertMergeField("city") && ͪͿŴ table
.Insert(", ")
.InsertMergeField("state") && ͪͿŴ table
.InsertPara
.InsertMergeField("zipcode") && ͪͿŴ table
.InsertPara
.InsertPara
.InsertPara
.Insert("Dear ")
.InsertMergeField("name") && ͪͿŴ table
.Insert(",")
.InsertPara
.InsertPara
.Insert("Thank You For Your Support.")
.InsertPara
.InsertPara
.InsertPara
.Insert("Sincerely,")
.InsertPara
.InsertPara
.InsertPara
.Insert("Your Name")

* Merges data records with the main document
.MailMergeToDoc

* Saves the active document with the specified name
.FileSaveAs("c:\lett.doc")
ENDWITH
ENDPROC
ENDDEFINE

* Class definition for the command button. When the user clicks
* the command button, the form is released.

DEFINE CLASS cmdquit AS COMMANDBUTTON
Width=100
Height=25
Caption = "Quit"

PROCEDURE CLICK
ThisForm.Release
CLEAR EVENTS
ENDPROC
ENDDEFINE
thai_vfp
19 .. 44 1:17:43 . --> 127.0.0.1, , pa
   
   

͹
5 .. 50 16:06:58 . --> 124.121.31.188,
  
ԭͺӶѺ
 
ͺ :
ʼҹ :
ٻҾ :
ӵͺ :