Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding text from a specific position
Message
From
13/06/2002 07:23:18
 
 
To
13/06/2002 02:48:57
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00667789
Message ID:
00667832
Views:
27
How about something similar to this? This will put your info in a table. Your select is only defining two fields, so I only put two columns in the table.
SELECT Title,FirstName FROM Employee INTO CURSOR Temp
loDoc=loWord.ActiveDocument
loRange=loDoc.Range()
loRange.Collapse(wdCollapseEnd) && Defined as #DEFINE wdCollapseEnd  0
loDoc.BookMarks.Add("list",loRange)
WITH loDoc.BookMarks("list").Range()
	loTable=loWord.ActiveDocument.Tables.Add(loRange,lnRecCount+1,2)
	WITH loTable
		WITH .Rows[1]
			.cells[1].range.InsertAfter("Title")
			.cells[1].range.font.name="Tahoma"
			.cells[2].range.InsertAfter("First Name")
			.cells[2].range.font.name="Tahoma"		
			.Shading.Texture=100
		ENDWITH
	SCAN
		WITH .Rows[RECNO()+1]
		    .cells[1].range.insertafter(ALLTRIM(title))	
		    .cells[1].range.font.name="Tahoma"
		    .cells[1].range.font.size=8
                      .cells[1].range.font.bold=.t.
		    .cells[2].range.insertafter(ALLTRIM(firstname))	
		    .cells[2].range.font.name="Tahoma"
		    .cells[2].range.font.size=8
                      .cells[1].range.font.bold=.f.
		ENDWITH
	ENDSCAN
	ENDWITH
ENDWITH
>I am trying to add some text from a specific location from my Word document. I have some code like this:
>
>
>SELECT Title,FirstName FROM Employee INTO CURSOR Temp
>loDocument=toWord.ActiveDocument
>SCAN
>loDocument.insertafter(Title)
>loDocument.insertafter(CHR(13))
>loDocument.font.bold=.T.
>loDocument.insertafter(FirstName)
>loDocument.font.bold=.F.
>loDocument.insertafter(CHR(13)+CHR(13))
>ENDSCAN
>
>
>Basically, I am trying to print a few records in a row by showing the Title followed by the first name in bold. However, Word doesn't like it. I believe I have to define a range. How do I do that?
>
>Also, I have defined my Word document in 3 columns. So, I would like all that text to be within those columns and start from the upper part. Is there a way to specify that?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform