Page 1 of 1

[Solved] Get current paragraph style and apply later

PostPosted: Wed May 02, 2012 7:44 pm
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

Re: Macro get current paragraph style - and apply later

PostPosted: Wed May 02, 2012 8:28 pm
by FJCC
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

Re: Macro get current paragraph style - and apply later

PostPosted: Wed May 02, 2012 9:50 pm
by helpnewbie
Thank you!