Keyboard shortcut to zoom in and out

Discuss the spreadsheet application

Keyboard shortcut to zoom in and out

Postby rdr713 » Tue Jan 31, 2012 3:00 pm

I want a keyboard shortcut to zoom in and out of spreadsheets, so I did this:

Tools>Customize>Keyboard
Selected Shortcut keys:Ctrl+Shift+I, Category:View, Function:Zoom In, then "Modify"
Selected Shortcut keys:Ctrl+Shift+O, Category:View, Function:Zoom Out, then "Modify"
Selected "Okay"

I thought this would allow me to zoom in with Ctrl+Shift+I and zoom out with Ctrl+Shift+O, but nothing happens when I press those key combinations. What did I do wrong and how do I fix it?

Robert
Robert
San Francisco, Cal.

OpenOffice 3.3.0
Windows 7
rdr713
 
Posts: 3
Joined: Tue Jan 31, 2012 2:55 pm

Re: Keyboard shortcut to zoom in and out

Postby floris v » Tue Jan 31, 2012 3:15 pm

AOO 4.1.6 op Linux Mint
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 4192
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Keyboard shortcut to zoom in and out

Postby rdr713 » Tue Jan 31, 2012 3:48 pm

My problem has not been solved, that's why I posted it here. I don't understand: what made you think it had been solved?
Robert
San Francisco, Cal.

OpenOffice 3.3.0
Windows 7
rdr713
 
Posts: 3
Joined: Tue Jan 31, 2012 2:55 pm

Re: Keyboard shortcut to zoom in and out

Postby RoryOF » Tue Jan 31, 2012 3:50 pm

It is good manners to link to your other postings on the same subject, so that a Solved query can readily be found if there is a solution.

 Edit: Try pulling the zoom slider, bottom right of screen. 
Apache OpenOffice 4.1.7 on Xubuntu 18.04.4 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 30430
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Keyboard shortcut to zoom in and out

Postby floris v » Tue Jan 31, 2012 3:54 pm

I didn't tag is as solved, did I?
AOO 4.1.6 op Linux Mint
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 4192
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Keyboard shortcut to zoom in and out

Postby rdr713 » Tue Jan 31, 2012 4:04 pm

I don't know about tagging, but you wrote, "If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar." But I see now that you apparently add that to every comment you post.

To RoryOF's suggestion about dragging the zoom slider: if you can tell me how to do that with a single combination keystroke then my problem will be solved and I can execute floris_v's instructions regarding solved issues.
Robert
San Francisco, Cal.

OpenOffice 3.3.0
Windows 7
rdr713
 
Posts: 3
Joined: Tue Jan 31, 2012 2:55 pm

Re: Keyboard shortcut to zoom in and out

Postby floris v » Tue Jan 31, 2012 4:05 pm

That's in my signature. It's merely a reminder. And lots of people don't act on it, anyway. :(
AOO 4.1.6 op Linux Mint
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 4192
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Keyboard shortcut to zoom in and out

Postby RoryOF » Tue Jan 31, 2012 4:22 pm

In Andrew Pitonyak's document on OpenOffice Macros, in table 211 he gives hooks to zoom properties of the current document. It may be that you will need to write a macro to engage with these properties, then assign the Zoom up and Zoom down macros to shortcut keys. The starting point for OpenOffice macros is Andrew's document
http://www.pitonyak.org/OOME_3_0.odt
it is not a trivial read. There are other recensions of this (and similar information) on his site.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.4 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 30430
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Keyboard shortcut to zoom in and out

Postby floris v » Tue Jan 31, 2012 4:36 pm

More to the point: Can anyone confirm that the Zoom in and Zoom out items that you can link to keyboard shortcuts in the Tools - Customize section don't work? Wait, this thread is about the same problem. Apparently it hasn't been linked to an issue report.
AOO 4.1.6 op Linux Mint
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 4192
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Keyboard shortcut to zoom in and out

Postby Hagar Delest » Tue Jan 31, 2012 5:17 pm

+1. Can't set a shortcut to zoom in/out.
Definitively a bug.
AOO 4.1.7 on Xubuntu 19.10 and 4.1.5 on Windows 10 (with winPenPack port).
User avatar
Hagar Delest
Moderator
 
Posts: 28681
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Keyboard shortcut to zoom in and out

Postby Robert Tucker » Tue Jan 31, 2012 6:10 pm

No, I can't get the zoom in or out to work assigning keyboard shortcuts on LibreOffice 3.4.4 on Fedora 16; tried when I saw the first two posts on the other forum.
LibreOffice 6.x.x on Fedora 31 and Ubuntu 19.10 (Dual Boot)
User avatar
Robert Tucker
Volunteer
 
Posts: 1247
Joined: Mon Oct 08, 2007 1:34 am
Location: Manchester UK

Re: Keyboard shortcut to zoom in and out

Postby qaz1qaz1qa » Wed Feb 01, 2012 2:41 am

I have assigned Zoom in, Zoom out to all kinds of keys and there is no responce.
Zoom,Scale Screen Display (apparently same thing as zoom) Does Work
It is possible to record a macro that will do what you want.
After recording a macro I placed it under MY MACRO and called it ZOOMIN

I got the following code

Code: Select all   Expand viewCollapse view
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = 87   '<---This Value can be changed
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0

dispatcher.executeDispatch(document, ".uno:Zoom", "", 0, args1())


end sub


I copied the code and pasted it into a new macro sheet named Zoomout and change the value noted above to a smaller number.

I then opened Tools > Customize > Keyboard >
Category + OpenOffice.OrgMacro + User + Zoomin and assigned it to the keyboard.
Ditto Zoom out.
Wala
Not sure if this does all that you want but you get the idea.

Was not that time consuming or just use the code above.
OpenOffice 3.3 XP If I am never wrong then I know everything and cannot improve. From the looks of things I have a lots to do.
User avatar
qaz1qaz1qa
 
Posts: 103
Joined: Fri Jan 27, 2012 1:36 am

Re: Keyboard shortcut to zoom in and out

Postby xerostomus » Sun Sep 02, 2012 5:02 am

You may try this macros. Just link keyboard shortuts with macros ZoomIn or ZoomOut

Code: Select all   Expand viewCollapse view
sub ZoomIn( )
Zoom(5)
end sub

sub ZoomOut( )
Zoom(-5)
end sub


function Zoom(SStep as Integer)
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
Maginfication= thiscomponent.currentcontroller.viewsettings.zoomvalue() 'get current zoom
Magnification = Magnification + SStep
if (Magnification < 20) then Magnification =20 'controls limits of zoom
if (Magnification >600) then Magnification =600

dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = Magnification
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:Zoom", "", 0, args1())
end function
xerostomus
 
Posts: 3
Joined: Sun Sep 02, 2012 4:52 am

Re: Keyboard shortcut to zoom in and out

Postby acknak » Sun Sep 02, 2012 4:00 pm

Just for the record, there is a standard shortcut included, although it's not strictly a keyboard shortcut: Ctrl+Mousewheel changes the zoom.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Keyboard shortcut to zoom in and out

Postby pahmer » Tue Sep 04, 2012 7:22 pm

Xerostamus, thanks for the code, but I'm getting 0 for the Magnification each time. Any idea what I'm doing wrong? I simply copied your whole code.
Libreoffice 3.6, Win XP
pahmer
 
Posts: 3
Joined: Tue Sep 04, 2012 7:07 pm

Re: Keyboard shortcut to zoom in and out

Postby Villeroy » Tue Sep 04, 2012 8:06 pm

Replace this line
Code: Select all   Expand viewCollapse view
Maginfication= thiscomponent.currentcontroller.viewsettings.zoomvalue()

with these 3 lines:
Code: Select all   Expand viewCollapse view
sv = thiscomponent.currentcontroller.viewdata
av = split(sv,"/")
Magnification = cInt(av(0))
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27757
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Keyboard shortcut to zoom in and out

Postby peterroots » Tue Sep 04, 2012 9:20 pm

Looking at LO bugs I found this https://bugs.freedesktop.org/show_bug.cgi?id=45705 which I have added a bit to
LibreOffice 4.0.3 OpenSUSE 12.3 : OpenOffice 4 Linux Mint 15
User avatar
peterroots
Volunteer
 
Posts: 299
Joined: Mon Mar 03, 2008 6:33 pm
Location: UK

Re: Keyboard shortcut to zoom in and out

Postby pahmer » Wed Sep 05, 2012 5:31 pm

Villeroy, your code fix didn't work for me, but I DID get it to work thanks to your code with a few tweaks:

sv = thiscomponent.currentcontroller.viewdata
av = split(sv,";")
Magnification = cInt(av(2))

The viewdata string is parsed by semicolons, rather than slashes, and the the current zoom factor is in the third position of the array.

I'm so pleased that this worked, since I have been hunting this topic for many months, and I once found a nice, elegant macro that worked, but I lost it in an upgrade, and I can no longer find the post that contained it, but this thread is an example of the forum at its best!

Thanks, xerostomus and Villeroy!
Libreoffice 3.6, Win XP
pahmer
 
Posts: 3
Joined: Tue Sep 04, 2012 7:07 pm

Re: Keyboard shortcut to zoom in and out

Postby Villeroy » Wed Sep 05, 2012 5:53 pm

You posted in the Calc forum.
This instruction by xerostomus works perfectly well with Writer: Maginfication= thiscomponent.currentcontroller.viewsettings.zoomvalue()
your split(sv,";") works with Writer too.

Calc has no viewsettings. Calc has a ViewData string joined by slashes and the first element is the zoom. I tested this with a spreadsheet view.

In Impress and Draw ZoomValue is a direct property of the controller.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27757
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Keyboard shortcut to zoom in and out

Postby pahmer » Wed Sep 05, 2012 6:01 pm

I just tried it with calc also, and discovered my error! I was using Writer, as you pointed out. Sorry! Thanks for the lesson as well.
Libreoffice 3.6, Win XP
pahmer
 
Posts: 3
Joined: Tue Sep 04, 2012 7:07 pm

Re: Keyboard shortcut to zoom in and out

Postby xerostomus » Tue Jul 02, 2013 1:23 pm

I bring the lates working version for Calk and Write.
:-)
xerostomus

Code: Select all   Expand viewCollapse view
sub ZoomIn( )
Zoom(3)
end sub

sub ZoomOut( )
Zoom(-3)
end sub


function Zoom(SStep as Integer)
'this is for Libreoffice Write
rem ----------------------------------------------------------------------
rem define variables
dim Magnification as Integer
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
Magnification = thiscomponent.currentcontroller.viewsettings.zoomvalue()
   Magnification = Magnification + SStep
if (Magnification < 20) then Magnification = 20
'restore counting from 100
if ((Magnification > (100-abs(sstep))) and (Magnification < (100+abs(sstep)))) then Magnification =100
if (Magnification >600) then Magnification =600
'statusbar   
ThisComponent.CurrentController.StatusIndicator.setText("Magnification: " + Magnification)
'print typename(magnification)

'- new 2013-07-02 ------------------------------------------------------------
dim args3(3) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ZoomSlider.CurrentZoom"
args3(0).Value = magnification
args3(1).Name = "ZoomSlider.SnappingPoints"
args3(1).Value = Array()
args3(2).Name = "ZoomSlider.SvxMinZoom"
args3(2).Value = 20
args3(3).Name = "ZoomSlider.SvxMaxZoom"
args3(3).Value = 600

dispatcher.executeDispatch(document, ".uno:ZoomSlider", "", 0, args3())
end function

sub Zoom_calc_In( )
Zoom_calc(3)
end sub

sub Zoom_calc_Out( )
Zoom_calc(-3)
end sub


function Zoom_calc(SStep as Integer)
'this is for Libreoffice Calc
rem ----------------------------------------------------------------------
rem define variables
dim Magnification as Integer
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
   sv = thiscomponent.currentcontroller.viewdata
   av = split(sv,"/")
   Magnification = cInt(av(0))
   Magnification = Magnification + SStep
if (Magnification < 20) then Magnification =20
'restore counting from 100
if ((Magnification > (100-abs(sstep))) and (Magnification < (100+abs(sstep)))) then Magnification =100
if (Magnification >600) then Magnification =600
'statusbar
ThisComponent.CurrentController.StatusIndicator.setText("Magnification: " + Magnification)
'print typename(magnification)

'- new 2013-07-02 -----------------------------------------------------
dim args1(3) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ZoomSlider.CurrentZoom"
args1(0).Value = Magnification
args1(1).Name = "ZoomSlider.SnappingPoints"
args1(1).Value = Array()
args1(2).Name = "ZoomSlider.SvxMinZoom"
args1(2).Value = 20
args1(3).Name = "ZoomSlider.SvxMaxZoom"
args1(3).Value = 600

dispatcher.executeDispatch(document, ".uno:ZoomSlider", "", 0, args1())

end function
Last edited by acknak on Tue Jul 02, 2013 3:34 pm, edited 1 time in total.
Reason: code placed in code tags
lubuntu, LibreOffice 3.5.4.2
Build ID: 350m1(Build:2)
xerostomus
 
Posts: 3
Joined: Sun Sep 02, 2012 4:52 am

Re: Keyboard shortcut to zoom in and out

Postby xerostomus » Sun Mar 02, 2014 3:11 pm

There works following command in Calc too:
Magnification = ThisComponent.getCurrentController().getPropertyValue( "ZoomValue" )
instead of these lines in previeous macro:
sv = thiscomponent.currentcontroller.viewdata
av = split(sv,"/")
Magnification = cInt(av(0))
lubuntu, LibreOffice 3.5.4.2
Build ID: 350m1(Build:2)
xerostomus
 
Posts: 3
Joined: Sun Sep 02, 2012 4:52 am

Re: Keyboard shortcut to zoom in and out

Postby daniloperetti » Mon Mar 20, 2017 5:12 pm

OH! Thank you :bravo: because I had the same problem and this post solved!

I needed this after using Chrome and Firefox, so I'm used to using the zoom!!!

Congratulations!
OpenOffice 4.1.1 Windows 7
daniloperetti
 
Posts: 2
Joined: Fri Jun 19, 2015 7:05 pm


Return to Calc

Who is online

Users browsing this forum: MSN [Bot] and 8 guests