Calc Macro: Help on how to split the window

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
SoCal
Posts: 1
Joined: Mon Jan 19, 2009 4:52 pm

Calc Macro: Help on how to split the window

Post by SoCal »

I am rewriting a Excel Macro in Calc. It is now 90% complete but I have not been able to find how to split the Window within the macro code.
I've done extensive searches but so far no luck.

My sheet is 26 columns in width and I want to split the sheet at column index 15 - basically the equivalent of Window Split from the menu.

If anybody could please help me out with the code snippet to accomplish this, it would be appreciated.
OOo 1.X on MS Windows Vista
Anser
Posts: 11
Joined: Tue Jan 13, 2009 7:33 am

Re: Calc Macro: Help on how to split the window

Post by Anser »

Try this

Code: Select all

   oBook.CurrentController.select( oSheet.GetCellByPosition( 15,1 ) )
   oDispatcher.ExecuteDispatch(oBook.GetCurrentController().GetFrame(), ".uno:FreezePanes", "", 0, {})
Socal,

You can get these codes by simply recording a macro while trying to split the window as desired.

Regards

Anser
OOo 3.0.X on Ms Windows XP
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Calc Macro: Help on how to split the window

Post by FJCC »

I think the dispatcher call provided results in freezing the window pane. A split can be done with ".uno:SplitWindow" in place of the ".uno:FreezePanes" I have also found the method

Dim Doc as Object
Doc = ThisComponent
Doc.CurrentController.FreezeAtPosition(5,0)

for freezing at the position (column,row).

The only method I have found for splitting a window is Doc.CurrentController.SplitAtPosition(x,y) where x and y are expressed in pixels. The API reference lists this method as deprecated, but I can't find any other non-deprecated method.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Post Reply