Ask Your Question

Macro to put cursor in section/paragraph

asked 2020-07-29 12:00:32 +0200

Fr3sh gravatar image

I need a macro that moves cursor to chosen section or paragraph in Writer. I have some macros that show/hide sections and I'd like to instant set the view to the uncovered text. Could you help with such a macro? or some another solution?

edit retag flag offensive close merge delete


How "chosen"?
In what way did you "cover" / "uncover" text?
In what way do you have access to the sections you are talking of?
The visual cursor (ViewCursor) you can only set to one TextRange at a time via the API.
mySection being the section object, you can set the ViewCursor spanning its complete range by
Lupp gravatar imageLupp ( 2020-07-29 12:53:59 +0200 )edit

This is almost right, but just need to only put cursor in the first (or last) paragraph of "mySection", without selecting the whole. Is it possible? :) Sorry, but i don't know the LO Basic "very well" (neither do English :P).

Fr3sh gravatar imageFr3sh ( 2020-07-29 13:53:29 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-07-29 15:25:12 +0200

Lupp gravatar image

updated 2020-07-29 20:54:13 +0200

Use (e.g.)

It's not the primitive Basic coming with LibreOffice, but the elaborate API you need for the task.

If you think to need macro programming for LibreOffice, you should probably start wit the famous texts by Andrew Pitonyak. They are named after "Basic" but lots of the content are actually about using the API - and the examples are in Basic.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-07-29 12:00:32 +0200

Seen: 34 times

Last updated: Jul 29