Information générale
Catégorie:
COM/DCOM et OLE Automation
>Ok another question. If I create a table in a word document with automation. How do I move from the right most column to the next row.
>
>.Selection.MoveDown(1) does not work
>
In general, unless you're trying to set things up for an end-user, there's no reason to work with the Selection object in Word. Work with the Range object, and the other objects available to you. For example, when you create a table, you can get an object reference to it, then you can use the objects within to get to the various cells. To work with the contents of a cell, create a Range from cell.
oTable = oDoc.Tables.Add( oRange, 5, 3)
* Access 1st cell in 3rd row
oCell = oTable.Rows[3].Cells[1].Range()
Now you can talk to the cell directly.
If you're trying to deal with a table that's already there, use the Tables collection to get the right one:
oTable = oDoc.Tables[5]
Tamar
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement