Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Constants?
Message
De
16/09/1999 14:04:16
 
 
À
16/09/1999 12:46:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00265502
Message ID:
00265577
Vues:
19
>>Is there an *.h file with all the constants that Word2000 uses. Also is there any good books on OLE Automation of particularly Word or the entire Office Suite. I am trying to create a Word *.Doc of a quotation, with data from VFP5.0, that can be attached to an E-mail and sent to the respective party. I am having a heck of a time trying to figure out how to move around in Word. I just want to do some basic formating, like set some tabs and change some font sizes. I just can't seem to figure out how to control the "Insert point" very well. Any guidance would be much appreciated
>>
>>Thanks in Advance.
>>
>>Jon
>
>
There is no mention about a difference in header files of w97 and w2000 in MSDN lib. w97 constants should be in files section. Help file is ...\Microsoft Office\Office\vbawrd8.hlp for w97.
>Understanding insertion point is a challenge :) But not only that if you go that way. It would be slow too (VBA).
>Instead create a template in word with formatting as you want. Instead of hardcoded text use fieldcodes. ie: insert fields :
>DOCVARIABLE "cFirst_name" \* MERGEFORMAT
>DOCVARIABLE "cLast_name" \* MERGEFORMAT
>and do any formatting in word. Then uncheck tools\Options\Field codes if checked.
>
>
>from VFP all you have to do is :
>
>
oWordDocument = createobject("Word.Application")
>with oWordDocument
>  .Documents.Add("c:\mypath\mysavedtemplate.doc") && New file with a template
>  with .Activedocument
>    _SetVar("cFirst_Name", myTable.First_name)
>    _SetVar("cLast_Name", myTable.Last_name)
>*...
>  endwith
>*...
> .Visible = .t. && Show word
>endwith
>
>
>FUNCTION _SetVar
>LPARAMETERS tcVarName, tcVarValue
> .Variables(tcVarName).value = iif(empty(tcVarValue)," ",tcVarValue)
This works pretty well for one record templates (or Parent table data).
>Cetin


Thanks, I did find that *.h file in the files section. As for you code sample that would work pretty good for a parent table. But... I couldn't have anything that would be easy. Here is some code I was playing with originally, I was just creating an e-mail with the data, but when it gets to the other party it is "Wordwrapped" somewhere along the way, and is hard to make out.
strSubject = "Quotation No.:  "+ALLTRIM(QTHD.QUOTENO)

theApp = CreateObject("Outlook.Application")
theNameSpace = theApp.GetNameSpace("MAPI")
*theNameSpace.Logon(strProfile , strPassword)
theMailItem = theApp.CreateItem(0)

*theMailItem.Recipients.Add( strRecipient )
theMailItem.Subject = strSubject
theMailItem.Body = test()
*theMailItem.Font.name = "Fixedsys"
theMailItem.display
theNameSpace.Logoff

FUNCTION test
REQUERY("QUOTEVW")
m.Description = "Requested By:"+SPACE(2)+ALLTRIM(QTHD.REQUESTED_)+CHR(13)+;
	"Inquiry No.:"+SPACE(2)+ALLTRIM(QTHD.INQUIRY_NO)+CHR(13)+;
	"Inquiry Date:"+SPACE(2)+DTOC(QTHD.INQUIRY_DA)+CHR(13)+;
	"Date:"+SPACE(2)+DTOC(QTHD.DATE)+CHR(13)+;
	"Estimated Delivery:"+SPACE(2)+ALLTRIM(QTHD.ESTIMATED_)+CHR(13)+;
	"Terms:"+SPACE(2)+ALLTRIM(QTHD.TERMS)+CHR(13)+;
	"Salesman:"+SPACE(2)+ALLTRIM(QTHD.SALESMAN)+CHR(13)+CHR(13)+CHR(13)+;
	"Quantity"+SPACE(20)+"Description"+SPACE(20)+;
	"Umeas"+SPACE(10)+"Amount"+CHR(13)
	SELECT QUOTEVW
	FOR I = 1 TO RECCOUNT()
		GO RECORD I
		m.description = m.description+STR(QUOTEVW.QUANTITY)+;
			SPACE(2)+QUOTEVW.DESCRIPTION+SPACE(2)+QUOTEVW.UMEAS+;
			SPACE(2)+STR(QUOTEVW.AMOUNT,10,2)+CHR(13)
	ENDFOR
	m.Description = m.Description+CHR(13)+CHR(13)+CHR(13)
	m.Description = m.Description+QTHD.OTHER_INFO
	RETURN m.Description
ENDFUNC
As you can see I can have a lot of items or just one. Got any Ideas?

Jon
Non-MVP :)
Thanks
Jon
Non-MVP Non-MCP Non-MCSE

Visual FoxPro, What else is there?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform