Record a Styles macro in LibreOffice?

Why can’t I record a Styles macro in LibreOffice? I have created a macro that does all the steps except the part where I have style changes. I have created a Calc document where every other line is colored for easier reading, but unfortunately it does not work to implement in a macro. Kind regards, Thore from Sweden

There is no need for macro, simply define a ⇒Format⇒Conditional Format…

  • Formula ⇒ MOD(ROW();2) ⇒ »your style with backcolor«
2 Likes

Taking the original question literally:
The question isn’t precise enough.

  • What’s your LibO version? Your OS?
  • Describe your steps in detail. Or
  • Paste the code as Preformatterd text. Or much better
  • Attach an example file containing your macro.

How do you tell your macro for which cells you want to set a style or cell attributes?
Recording of macros is limitted.
E.g. A selection passed to the macro must be a single cell or a single range.

Hi and thanks, I’ve been away at work and came home today, didn’t think you’d answer so quickly. I think you’ve helped me figure out what the problem is, I have different cell ranges in different documents. But what I do when I make every other row colored is:

  1. Select the area you want to change.
  2. Select “Styles” at the top of the menu bar.
  3. Click on “New Style Fr…”
  4. Name it ex:everyother
  5. Click OK.
  6. Select “Styles” at the top of the menu bar.
  7. Click on “Manage styles”.
  8. Hover over “gray” and select “Edit Style” and then the “Background” tab.
  9. Select Colour->OK
  10. Format->Contitional->Manage->Add.
  11. Condition 1->Formula is->ISEVEN(ROW())
  12. Apply Style->everyother
  13. OK->OK
  14. CTRL+A
  15. Rightklick->Format cells
  16. Select “Background”->white color.
    DONE

Ok, thanks for the tip. But when I have created a cell format, the set is gone the next time I start Libreoffice. So I don’t really understand how to do it, but I’ll google for a guide and it will probably work. Thanks for the help so far.

-------- Originalmeddelande --------

Ola @Thore, para o formato/estilo de célula ficar ativo permanentemente no LibreOffice, creio que deva ser criado e salvo no arquivo padrão.


Hi @Thore, for the cell format/style to be permanently active in LibreOffice, I believe it must be created and saved in the default file.

Create a template and set it as default.

  1. Add the styles to a blank document.
  2. Click File - Templates - Save as template
  3. In the dialogue, give the new template a name, choose a location like My Templates, and tick the box Set as default

If you no longer need it set as default then click File - Templates - Manage templates, find your template, which will have a green tick, right click it and select Reset default

1 Like

THANK YOU SO MUCH for this guide. I’ll test it as soon as I have time, I’m away working nights. So it will be next week. Kind regards from Thore.

-------- Originalmeddelande --------

THANK YOU for tip. I’ll test it as soon as I have time, I’m away working nights. So it will be next week. Kind regards from Thore.

-------- Originalmeddelande --------