[Solved] Get current paragraph style and apply later

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
helpnewbie
Posts: 4
Joined: Wed Feb 01, 2012 11:31 pm

[Solved] Get current paragraph style and apply later

Post by helpnewbie »

Hi everyone,

In a macro using the language Basic, I would like to get / retrieve the current paragraph style, save it to a variable, and, at a later stage in the macro, apply that style.

Does anyone know if that's possible - and if yes, how?

Thank you,
Fab
Last edited by helpnewbie on Wed May 02, 2012 9:49 pm, edited 1 time in total.
FJCC
Moderator
Posts: 9280
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Macro get current paragraph style - and apply later

Post by FJCC »

You can get the name of the Paragraph Style at the current location of the view cursor with

Code: Select all

StyleName = ThisComponent.CurrentController.ViewCursor.ParaSytleName
and you can apply that style at another location using either the View Cursor or a Text Cursor by setting the ParaStyleName property

Code: Select all

oCursor.ParaStyleName = StyleName
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.
helpnewbie
Posts: 4
Joined: Wed Feb 01, 2012 11:31 pm

Re: Macro get current paragraph style - and apply later

Post by helpnewbie »

Thank you!
Windows, OpenOffice 3.3.0, LibreOffice 3.4.5
Post Reply