Ask Your Question

How can I put a paragraph style on a menu? [closed]

asked 2017-04-14 09:00:08 +0100

Case Sensitive gravatar image

updated 2020-07-29 09:15:27 +0100

Alex Kemp gravatar image

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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-29 09:16:19.922306


Consider using a file sharing service such as dropbox.

robleyd gravatar imagerobleyd ( 2017-04-14 10:50:22 +0100 )edit

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.

Regina gravatar imageRegina ( 2017-04-14 11:37:16 +0100 )edit

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".

librebel gravatar imagelibrebel ( 2017-04-17 09:53:25 +0100 )edit

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.

Case Sensitive gravatar imageCase Sensitive ( 2017-04-24 08:09:30 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-04-22 17:38:58 +0100

Regina gravatar image

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.

edit flag offensive delete link more


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

Case Sensitive gravatar imageCase Sensitive ( 2017-04-24 08:02:43 +0100 )edit

Question Tools

1 follower


Asked: 2017-04-14 09:00:08 +0100

Seen: 412 times

Last updated: Apr 22 '17