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

How to freeze the panes with a macro in a calc sheet

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


Joined: 13 Mar 2006
Posts: 2
Location: Bagneux, France

PostPosted: Tue Mar 14, 2006 12:05 am    Post subject: How to freeze the panes with a macro in a calc sheet Reply with quote

Hi,

I am looking for an OpenBasic macro (working with OOo 2.0) to freeze the panes of several sheets in my calc document and i don't know how to do so. Don't know neither how to do it on a single sheet !

Example: i'd like to freeze the first line and the two first columns while scrolling up and down.

I have tried to use the macro recorder, but the generated code is so ugly, i can't stand using it !

Is there anyone who could help me ?
Back to top
View user's profile Send private message
uros
Super User
Super User


Joined: 22 May 2003
Posts: 601
Location: Slovenia

PostPosted: Tue Mar 14, 2006 3:42 am    Post subject: Reply with quote

Hi Thierry!

Try this:
Code:
Sub Freeze
   oDocument = ThisComponent
   oController = oDocument.getCurrentController   ' freezes active sheet
   oController.freezeAtPosition(2,3)

   oSheets = oDocument.Sheets
   oDocument.getCurrentController.select(oSheets.getByIndex(1)) ' activate second sheet
   oController.freezeAtPosition(4,5)
   
   numSheets = oSheets.Count
   For i = 0 To numSheets - 1
      oDocument.getCurrentController.select(oSheets.getByIndex(i).getCellByPosition(0,0)) ' activate all sheets one by one
      oController.freezeAtPosition(0,6)
   Next i
End Sub
Hope it helps!
Uros
Back to top
View user's profile Send private message
thierry07
Newbie
Newbie


Joined: 13 Mar 2006
Posts: 2
Location: Bagneux, France

PostPosted: Thu Mar 16, 2006 4:36 am    Post subject: Reply with quote

It works perfectly !
Thank you.
Back to top
View user's profile Send private message
ssureshkumar
Power User
Power User


Joined: 21 Dec 2005
Posts: 71

PostPosted: Wed Nov 29, 2006 1:20 am    Post subject: Reply with quote

hi uros,

can u post some sample code to do it the same in JAVA?

Thanks,
Suresh.
Back to top
View user's profile Send private message
uros
Super User
Super User


Joined: 22 May 2003
Posts: 601
Location: Slovenia

PostPosted: Wed Nov 29, 2006 11:10 pm    Post subject: Reply with quote

Hi ssureshkumar!
Sorry, I can't help you. All I know about java is that it looks complicated. Wink
Uros
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