Q:

Open/Libre Office Writer: Display line numbers in frames only

I'm writing a report in which I have to explain some programming code. I'm putting bits of code into a frame so I can place it nicely around the text. I would like to number the lines in the frame. As far as I can tell the Line Numbering tool only allows you to display line numbers in the general document, and not a particular frame.
Is anyone aware of a way to do this? A plugin to recommend perhaps?

A:

You can solve this issue by using different paragraph styles for the frame content and the main text:

Enable line numbering for the complete document (Menu "Tools" -> "Line Numbering..."; don't forget to enable counting of "Lines in text frames"):

Assign a custom paragraph style to the frame content;
Disable line numbering for the default paragraph style, and enable it only for the custom style used in frames. On the "Outline and Numbering" tab of the paragraph style properties, you can enable / disable the line numbering for the current paragraph style:

As result, line numbers will only appear at the text paragraphs in the frames:

EDIT:
Take care to set an appropriate value for left spacing (Frame Properties -> "Borders" tab -> "Spacing to contents" setting), to make sure there's enough space left of the content to display the line numbers.

