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

inserting rows in table: how to get Index?

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


Joined: 23 Dec 2004
Posts: 11

PostPosted: Wed Jul 20, 2005 1:24 am    Post subject: inserting rows in table: how to get Index? Reply with quote

Hello there!

I have: table and tableCursor:
Code:
[...]
oTable = oResult.TextTable
oTableCursor = oTable.createCursorByCellName(oResult.cell.cellName)
oRows = oTable.getRows()


And now I want to insert some rows below the one I am currently in. The problem is method:
oRows.insertByIndex( long nIndex, long nCount )

How can I get nIndex? All I have is: oTable.cell.cellName, but it is String like A1, B8, W4... How can I convert from this Range to nIndex of row or column?
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed Jul 20, 2005 10:34 am    Post subject: Reply with quote

See
How to know calc cell x and y coordinates http://www.oooforum.org/forum/viewtopic.phtml?t=19629&highlight=
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
pitonyak
Administrator
Administrator


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

PostPosted: Wed Jul 20, 2005 11:55 am    Post subject: Reply with quote

You can use a cursor to obtain the range name and you also claim to know a Cell name. You can easily parse the name to obtain the row number. In a text table, it is pretty safe to assume that there are less than 26 columns, so the following should work:
Code:
  s = "B23"
  Print CInt(Right(s, Len(s)-1))

You need different code, of course, if therer are more than 26 columns. I might show code in my book to handle this, I would need to check.
_________________
--
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
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