Highlight line from starting margin to end margin

Is it possible to paint a line in LibreOffice Writer with a colour from the left document margin to the right document margin?

I know that the Character Highlighting Tool exists but that only paints from the beginning of the line to the end of the line. I want to be able to pain from margin to margin so that even short lines of text are fully painted.

Additional information:

  • Operating system version: Windows 11 24H2
  • Libre Office version: LibreOffice 7.6.3.2
  • Document format: .odt
  • Context for highlight: I am creating a text choice quizz and I want that by default, the answers are hidden to the user. To achieve, this I thought of highlighting the text with the same text colour (black). This partially works, but the user can still guess the answer if some of the quizz answer choices differ in length. I could technically solve this issue by just using white text and no highlightong, but I would like to have an explicit line covering the margins as I mentioned.

There are several possibilities. Edit your question (press below it, then on the “pencil” icon to enter edit mode) to give more details. We need OS name, LO version and save format.

Your line is not a stand alone stroke. It is related to some “object” in your document. For spot-on answer, describe as thoroughly as possible the context in which you want this line.

It can be a separator between fixed elements of the page, like header or footer. Then it can be solved with a border on a side of this element.

Within your text, this line will conclude a series of arguments. Then it can be attached as the bottom border of the last paragraph (or the top border of the next paragraph).

Don’t insert a drawing object because such a shape is totally external to your text and will not move with it (you’ll have to reposition it if you modify your text).

@ajlittoz done, hope this helps. I do not need anything fancy, just that it works as a mentioned. As a last resort I could stick with white as I explained.

Then you don’t need a line but a solid rectangle covering the paragraph area. Then configure the background paragraph colour (Area tab of the paragraph style). However, a smart solution is to paint your text the same colour as the background (white on white usually as you suggested).

There is another solution which may be more handy for you. I assume the same document is used to print exam sheets for your students and the full “solution” sheet for you.

You can use the hidden paragraph feature. Such paragraphs are shown or hidden depending on a variable value.

Near the beginning of your document, add a reminder paragraph reading “Masked <>” where <> is an inserted field Insert>Field>More Fields, Variables Type Set variable. Give it a name like “masked” and value 0 or 1.


At start of your answers, Insert>Field>More Fields, Functions tab, Type Hidden paragraph. In the condition field, enter the name of you variable, i.e. masked.

On screen, nothing changes. Your “hidden” paragraphs are always visible. But if you click on the Print Preview button to show the printed result, your paragraphs are shown only when the variable value is 0.

To change the control variable value, double-click on the variable field (it has a gray background if you enabled View>Field Shadings. A dialog pops up and you can change the value.