Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Automation
Message
 
To
19/09/2006 12:58:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01155157
Message ID:
01155169
Views:
28
One option is to deal with a selection, the following would do your whole document, but you cannot do that with "Word.Basic". Try using the "wrod.application" which is a more "modern" object, the code is similar.
o = CREATEOBJECT("word.application")
odoc = o.Documents.Add()
** add you text here 
o.Selection.WholeStory()  && Select the whole text
o.Selection.Font.Bold=.t.
Or select smaller portions.


>I know this is a stupid question but then again most of mine are.
>How in the world to you change font ie. .bold=.t.
>I have tried numerouse way to toggle the font from regular to bold and I always get an error.
>I.e. .font.bold=.t. (error)
> .bold=.t. (error)
> .app.format.font.bold=.t. (error) ETC
>
>
>Any help would be greatly appreciated
>Thanks
>
>PUBLIC oWord,oselection,x
> x=1
>    oWord = CREATEOBJECT("Word.Basic")
>*    oselection=oword.selection
>    WITH oWord
>*       .AppShow        && Makes Wor Visible
>       .FileNewDefault && Opens up blank Word document
>
>
>          .Insert(DTOC(DATE())+" "+TIME())
>            && The above line shows the record number.
>          .InsertPara
>          .InsertPara
>		
>       	  	  .Insert(ALLTRIM(m.company_name))   && Field in the table.
>	          .InsertPara
>	          .Insert(m.company_address)
>	          .InsertPara
>	          .Insert(ALLTRIM(m.company_city)+", "+m.company_st+"  "+m.company_zip)
>	          .InsertPara
>	          .InsertPara
>	          .Insert("Separation Information Report")
>	          .InsertPara
>	          .Insert(ALLTRIM(cr_empl.first)+" "+ALLTRIM(cr_empl.lname))
>	          .InsertPara
>	          .INSERT("SSN   "+SUBSTR(cr_empl.empno,1,3)+'-'+SUBSTR(cr_empl.empno,4,2)+'-'+SUBSTR(cr_empl.empno,6,4))
>	          .InsertPara
>	          .InsertPara
>			  .Insert("Assignment History")
>			  .InsertPara
>			  .Insert(massignment)
>			  .Insertpagebreak
>			  .Insert("Contact History")
>			  .InsertPara
>			  .Insert(mreportcontact)
>*			  .Insertpagebreak
>			  .Insert("General Employee Notes")
>			  .Insertpara
>			  .Insert(cr_empl.interview_comm)
>			
>    		  .FileSaveAs(mfile)
>    		  PRIVATE manswer
>    		  IF x=1
>    		  	manswer=MESSAGEBOX('Would you like to print a copy of this report?',4+32)  && mfile declared in usexpress
>    		  ENDIF
>              IF manswer=6 AND x=1
>              	.fileprint
>              	x=x+1
>              ENDIF
>
>	       .AppClose
>    ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform