OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Text to Cell

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Cellin
General User
General User


Joined: 13 Jan 2005
Posts: 11

PostPosted: Thu Jan 20, 2005 2:22 am    Post subject: Text to Cell Reply with quote

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
View user's profile Send private message
michelxld
General User
General User


Joined: 30 Sep 2004
Posts: 7
Location: France

PostPosted: Thu Jan 20, 2005 12:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Thu Jan 20, 2005 1:40 pm    Post subject: Reply with quote

There is probably a TextTable attribute in the anchor that you can use.
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Cellin
General User
General User


Joined: 13 Jan 2005
Posts: 11

PostPosted: Thu Jan 20, 2005 10:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Fri Jan 21, 2005 12:01 pm    Post subject: Reply with quote

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? Smile

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Cellin
General User
General User


Joined: 13 Jan 2005
Posts: 11

PostPosted: Sun Jan 23, 2005 11:30 pm    Post subject: Reply with quote

Thank You so much.
This really helpt me a lot!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group