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

Select current sheet (a work around...)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
nom
OOo Enthusiast
OOo Enthusiast


Joined: 17 Dec 2003
Posts: 153
Location: NSW, Australia

PostPosted: Tue Apr 13, 2004 1:50 am    Post subject: Select current sheet (a work around...) Reply with quote

I have been looking for a way to select the current sheet, but couldn't find an elegant answer. The best I could come up with is to select the sheet that has a "cell" selected.

If anyone knows the "elegant" answer to this, please post a reply:

Code:

   oDoc = ThisComponent
   
      ' Get the currently selected cell.
      oView = oDoc.getCurrentController()
      oCell = oView.getSelection()
      
      ' Get cell address
      iCellRow = oCell.getCellAddress.Row
      iCellCol = oCell.getCellAddress.Column
      iCellSheet = oCell.getCellAddress.Sheet ' THIS IS THE IMPORTANT ONE
      
      oSheet = oDoc.getSheets().getByIndex(iCellSheet)



nom
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 Apr 14, 2004 11:17 am    Post subject: Reply with quote

The sheet that we see on screen can be found like that :

Code:

MaFeuille = MonDocument.CurrentController.ActiveSheet
print "Active Sheet name is : "; MaFeuille.Name

_________________
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
nom
OOo Enthusiast
OOo Enthusiast


Joined: 17 Dec 2003
Posts: 153
Location: NSW, Australia

PostPosted: Fri Apr 16, 2004 4:39 am    Post subject: Reply with quote

Hi Serge,

That is exactly what I was looking for. Thanks!

nom
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: Fri Apr 16, 2004 9:11 am    Post subject: Reply with quote

Thanks to Bernard Marcelly I have found this answer in his french document :
http://fr.openoffice.org/Documentation/How-to/indexht.html : "l'API d'OO (presque) sans peine"
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets 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