Ask Your Question

calc macro to toggle 'PagebreakMode' on and off

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

Kunjomachen gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

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( "" )

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

End Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 46 times

Last updated: Aug 15 '17