How can I put a paragraph style on a menu?

In Writer, the paragraph style “Horizontal Line” is on the Insert-menu drop-down list.

I was wondering how to put other paragraph styles on a menu, but I can find no way to do it. Can anyone tell me how?

Consider using a file sharing service such as dropbox.

Which version do you use? The version 5.2 has already a “Styles” menu. What style do you want to add? Custom styles are only stored inside the document. It makes no sense to add them to a general menu. I know how to do it. But for an appropriate answer I need to know, what you want to achieve.

Hello Case Sensitive, if you want to customize the items from the Insert menu, or add your own menu items to it, you can do so via Tools:Customize… on the tab “Menus”.

Thank you, librebel, but this does not allow me to put a specific style on a menu. It seems that you can only put commands on a menu this way.

Let assume, you have got a version 5.2.

First you need to make a small change for to get your personal configuration file

  1. Go to menu Tools > item Customize > tab Menus.
  2. From the drop-down list Menu select the item Styles.
  3. Examine list Entries. The first group contains paragraph styles, the second group has character styles, the last groups contain more general commands. Now make a small change, go to item Preformatted Text and click on the up-arrow for example.
  4. Close the dialog with OK.

Now open the Styles and Formatting dialog in the sidebar and note the exact name of the style, you want to add, to a scratch pad. Here I assume you want to add the paragraph style “First Line Indent”. Close LibreOffice totally.

Now find your LibreOffice user folder and therein go to subfolders config > soffice.cfg > modules > swriter > menubar. You should see a file menubar.xml. Open that file in an editor, e.g. in Notepad++.

The file is very large. Search for the text Preformatted. You will see a section with menu:id=".uno:FormatStylesMenu" and a line <menu:menuitem menu:id=".uno:StyleApply?Style:string=Preformatted%20Text&amp;FamilyName:string=ParagraphStyles"/>.

Duplicate that line and change the string Preformatted%20Text to the style name, you want to add. Notice, that the Space character has to be escaped as %20. In my example it would be <menu:menuitem menu:id=".uno:StyleApply?Style:string=First%20Line%20Indent&amp;FamilyName:string=ParagraphStyles"/>

The item has no predefined label for the menu. Therefore you need to add it yourself. Go to the place directly before /> in that line and add menu:label="First Line Indent". Of cause you use the label, which you want to read in the Styles menu. All together you now have a new line <menu:menuitem menu:id=".uno:StyleApply?Style:string=First%20Line%20Indent&amp;FamilyName:string=ParagraphStyles" menu:label="First Line Indent"/>. All is in one long line.

Save the changed file. Close the editor and restart LibreOffice. Start a new text document and examine the menu Styles. You should see your style.

Be aware, that it makes only sense to add a predefined style, because custom styles are not stored at a general place, but in the document. If you want to use custom styles, then it would be better to generate a document template with all the custom styles in it, define a custom menu and store the custom menu inside the template. You then need to edit the source of the template, but that is another topic.

You notice, that this is not a simple task. Therefore again my question, “What do you want to achieve? Why do you need it?” There exists likely another way for your aim.

Excellent answer. Thank you for the clear, detailed explanation. Now I feel I have more control.