How Do I Add Insert Anchor To The Context Menu?

I have been trying to Add “Anchor” to the context menu when editing text.

I was able to move the Hyperlink entry up to where it would show.

But, I have been unable to get the same “Anchor” functionality that appears in the ribbon under “Insert”.

I see that I can add an “Anchor Menu” item, but there is nothing in it and I am clueless as to what I am doing wrong?

My goal is to be able to add “Anchors” from the context menu instead of having to navigate up to the ribbon to do so.

First, I am transitioning from M$ Word 2016 to LibreOffice, and this is my first use of your help system, which is different from anything else I’ve used.

My OS is Windows 10, LibreOffice is 7.5.0.3 (X86_64/LibreOffice Community File is an HTML Bookmarks exported from Firefox and Copied into Word (hadn’t tried Writer yet) then saved as a Filtered HTM(L) file.

Please complete your question.
The help on this page is mainly provided by users like you.

Your question and the corresponding description should be as detailed as possible.
Please remember that no one can look over your shoulder when you ask your question and describe it.

In order to be able to help you as quickly as possible, we need to know your operating system and the LibreOffice version (four-digit, e.g. 7.3.2.2).
Please also state the file type in which you have saved your file.

All important information about your initial question should be present in the initial question box, otherwise edit and complete it., to do it.

Please do not use answers (solutions) or comments for this.

If you have already fulfilled some of these requirements, so much the better. Thanks.


Upload a reduced and anonymized file here so that someone can examine it.

Here you can find the further References for this page.


Thank you very much for your assistance.



You can’t anchor continuous text, or do you mean a Text Box?

Please edit your question (don’t use a comment; at this step no discussion has started yet) to describe your use case. Eventually add a screenshot of your user interface because I could not find an “Anchor” under any tabbed or standard interface (use of word “ribbon” suggests you configured your GUI to look like M$ ribbon).
Explain what you try to do. A style application may replace advantageously your current procedure.

My Topic has been edited:

Different places use different format for titles…

I did edit the post: How Do I Add Insert Anchor To The Context Menu - #2 by Hrbrgr

I still don’t understand the purpose (not your desire to customise the menus, but the final editing goal). Apart from the fact I don’t recognise the Insert menu (I’m still under 7.4.5.1) – you have perhaps already customised it --, anchors are used to position “objects” outside the main text flow. These objects are images, text frames containing text separate from the main one, shapes, … So, a sample of your document is welcome to clarify. If you don’t attach a file, make sure that View>Formatting Marks and View>Text Boundaries are enabled to provide more clues on screenshots.

The purpose is that I am 70 and have a bit of arthritis, so having both the add Hyperlink and add Anchor capabilities both on the Context Menus save a lot of Mouse Moving on a large screen.

The file I am editing is HTML it has a large number of URL links that are subdivided by plain text headers.

What is want to do is add anchors to all the subsection headers, reorganize with Links at the top of the page to those anchors.

I have been creating and editing static web pages in Word, but with out Links and Anchors. Doing those by hand in Notepad :smile: But, there are just too many in this case.
Writer seems more intuitive that MS Word when it comes to adding HTML compatible anchors.

OK I think I’m beginning to understand.
There is a problem of vocabulary. You mean an HTML anchor (something which identified by an id=… or name=… attribute in HTML tags). In Writer, this is called a bookmark or, preferentially, a cross-reference.

This needs quite a lot of manual work:

  • define a cross-reference target with Insert>Cross-reference, Set reference variant on your subsection headings (because a header is yet something different)
  • create the hyperlink with Insert>Hyperlink (but can’t reference a cross-reference)


One easy solution is to style your subsection headings Heading 1 and create a TOC at top of page. A TOC automatically creates hyperlinks to the headings.
Note that you must first force your document to .odt because you can’t insert a TOC when you’re in HTML mode.
I checked it works.

Just a test:
In the text.xml file (user configuration: sweb/popupmenu) I added an entry
containing the command .uno:InsertAnchor


EDIT:
When the HELP_DEBUG environmental variable is set to TRUE
the extended help tip (like the one in the above screenshot) lets you determine
the UNO command from the UI.

Configuration file \LibreOffice\share\config\soffice.cfg\modules\sweb\menubar\menubar.xml
stores the content of menu for Writer/Web. It contains i.a. the entries:

<menu:menuitem menu:id=".uno:HyperlinkDialog"/>
<menu:menuitem menu:id=".uno:InsertAnchor"/>

To get the “Anchor” item in the context menu, one needs to add the entry

<menu:menuitem menu:id=".uno:InsertAnchor"/>

to the configuration file for the pop-up menu i.e. text.xml
(preferably in the user configuration: \LibreOffice\4\user\config\soffice.cfg\modules\sweb\popupmenu\).

The problem is you try to add the Anchor menu to the Context Menu for Text.

Anchor isn’t for Text, it is for images, graphical objects etc. So if you click by right button to the selected graphical object, there is already Anchor menu :-).
object-anchor