[Solved] Get current paragraph style and apply later

Creating a macro - Writing a Script - Using the API

[Solved] Get current paragraph style and apply later

Postby helpnewbie » Wed May 02, 2012 7:44 pm

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

Re: Macro get current paragraph style - and apply later

Postby FJCC » Wed May 02, 2012 8:28 pm

You can get the name of the Paragraph Style at the current location of the view cursor with
Code: Select all   Expand viewCollapse view
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   Expand viewCollapse view
oCursor.ParaStyleName = StyleName
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7226
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Macro get current paragraph style - and apply later

Postby helpnewbie » Wed May 02, 2012 9:50 pm

Thank you!
Windows, OpenOffice 3.3.0, LibreOffice 3.4.5
helpnewbie
 
Posts: 4
Joined: Wed Feb 01, 2012 11:31 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 6 guests