Ask Your Question
1

calc macro to toggle 'PagebreakMode' on and off [closed]

asked 2017-08-15 14:42:49 +0200

Kunjomachen gravatar image

updated 2020-07-21 01:28:22 +0200

Alex Kemp gravatar image

Is it possible to toggle 'normal' and 'page break' view using a Basic macro?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-21 01:28:27.784378

1 Answer

Sort by » oldest newest most voted
1

answered 2017-08-15 22:56:00 +0200

librebel gravatar image

Hello @Kunjomachen,

Yes that's possible using a macro such as the following:

Global g_IsPageBreakViewActive As Boolean       REM Bareuh: the ViewData.ShowPageBreakPreview property seems to be unused...
Sub TogglePageBreakView()
REM This toggles the current Page View in Calc, between "Normal View" and "Page Break Preview".
REM Uses a Global boolean g_IsPageBreakViewActive declared outside of this method.
    Dim oDispatcher As Object : oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )

    If g_IsPageBreakViewActive Then
        oDispatcher.executeDispatch( ThisComponent.CurrentController.Frame, ".uno:NormalViewMode", "", 0, Array())
    Else
        oDispatcher.executeDispatch( ThisComponent.CurrentController.Frame, ".uno:PagebreakMode", "", 0, Array() )
    End If
    g_IsPageBreakViewActive = Not g_IsPageBreakViewActive

End Sub
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-08-15 14:42:49 +0200

Seen: 60 times

Last updated: Aug 15 '17