Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP, Word, selected cell in table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01045304
Message ID:
01045340
Vues:
19
Steve,

Not elegant, but works:
lnstart=oWord.Selection.start
lnend=oWord.Selection.end

llfound=.f.
WITH oWord.ActiveDocument
	*find table
	FOR it=1 TO .Tables.count
		IF .Tables(it).Range.End >= lnend
			llfound= (.Tables(it).Range.Start<= lnStart)
			exit
		ENDIF
	ENDFOR
ENDWITH


IF llfound
	*Find Row
	WITH oWord.ActiveDocument.Tables(it)
		FOR ir=1 TO .Rows.Count
			IF .rows(ir).range.end >= lnend
				EXIT
			endif
		ENDFOR
	ENDWITH
	*Find Column
	WITH oWord.ActiveDocument.Tables(it).rows(ir)
		FOR ic=1 TO .Cells.Count
			IF .cells(ic).range.end >= lnend
				EXIT
			endif
		ENDFOR
	ENDWITH

	?"Table #",TRANSFORM(it),", Row #",TRANSFORM(ir), ", Cell #",TRANSFORM(ic)

ELSE
	?"not in the table"
ENDIF
>Hi:
>1) I am working with Word and have a table
>
>
>oWord = CreateObject("Word.Application")
>oWord.Visible = .t.
>oDocument = oWord.Documents.Add()
>CopyTable = oDocument.Tables.Add(oRange ,oRow, oColNum, wdWord9TableBehavior, wdAutoFitContent)
>
>
>2) But my questions is this. Someone clicks on a particular cell in this table.
>Is there a function that will tell me which cell has been selected?
>
>From the command line in VFP, I can select a particular cell like this:
>
>
>CopyTable.Cell(1,3).Select
>
>
>The problem came up because when I did
>
>
>CopyTable.Cell(1,1).Select
>
>
> it selected row 1 and column 2 and I could not seem to select row 1 and column 1
>
>Thanks
>Steve
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform