Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding text from a specific position
Message
De
13/06/2002 07:23:18
 
 
À
13/06/2002 02:48:57
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00667789
Message ID:
00667832
Vues:
28
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform