| View previous topic :: View next topic |
| Author |
Message |
Cellin General User

Joined: 13 Jan 2005 Posts: 11
|
Posted: Thu Jan 20, 2005 2:22 am Post subject: Text to Cell |
|
|
Hello everyone,
Here is my problem:
I have a TextTable (4 columns, 1row), I put a Bookmark in the last cell of the unique row.
I select the bookmark by using the following function
| Code: |
'permet de positionner le cursor sur un bookmark
Public Sub SelectBookmark(BookmarkName As String)
'Si le signet existe
If oDocument.bookmarks.hasByName(BookmarkName) Then
'Recuperation du bookmark
Dim oBookmark As Object
Set oBookmark = oDocument.bookmarks.getByName(BookmarkName)
'recuperation du cursor
Set oCursor = oBookmark.getAnchor.GetText.createTextCursor
End If
End Sub
|
My Question : Is there a way to access the TextTable structure from there in order to add new row? |
|
| Back to top |
|
 |
michelxld General User

Joined: 30 Sep 2004 Posts: 7 Location: France
|
Posted: Thu Jan 20, 2005 12:33 pm Post subject: |
|
|
Hello
you may try
| Code: | 'exemple to add a row in the first Table(getByIndex(0))
Tableau = ThisComponent.getTextTables().getByIndex(0)
Ligne = Tableau.getRows()
Ligne.insertByIndex(1, 1)
'insertByIndex(x ,y )
'x=position of the line in the table (first line = 0 )
'y=number of lines to insert |
michel |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3622 Location: Columbus, Ohio, USA
|
Posted: Thu Jan 20, 2005 1:40 pm Post subject: |
|
|
There is probably a TextTable attribute in the anchor that you can use. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
Cellin General User

Joined: 13 Jan 2005 Posts: 11
|
Posted: Thu Jan 20, 2005 10:55 pm Post subject: |
|
|
thanks to both of you!
Michel I can't use what you wrote because there may be more than one table in my document. It is my fault my question was not well asked.
My Question more precisely: Is there a way to access the TextTable structure from the "oCursor" created in my function in order to add new row?
The only thing I know in that case is the "oCursor" that is instantiate inside a Table Cell thanks to a bookmark and the function I wrote above.
Pitonyak I don't really understand what you meant, are you talking about the anchor that is in the bookmark? |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3622 Location: Columbus, Ohio, USA
|
Posted: Fri Jan 21, 2005 12:01 pm Post subject: |
|
|
Usually, a cursor or anchor has a TextTable property that you can use to see if the cursor or anchor is in a text table. Can you guess what the Cell property is for?
If you want to see if a bookmark is anchored in a text table, you should be able to do something similar to the following untested code:
| Code: | If NOT IsNull(oBookmark.getAnchor().TextTable) Then
Print "The bookmark is in a text table"
End If |
I think that my books demonstrates adding rows and such but my free macro document does not (I think). _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
Cellin General User

Joined: 13 Jan 2005 Posts: 11
|
Posted: Sun Jan 23, 2005 11:30 pm Post subject: |
|
|
Thank You so much.
This really helpt me a lot! |
|
| Back to top |
|
 |
|