Is is possible to put code snippets into an OpenDocument Text file (.odt) file? I want it to be inside a bordered box, etc...

And I would like to know whether there is any way to add plugins to LibreOffice Writer?

  • 1
    You mean as plain text, within a bordered box or as an actual, functioning code? – TheWanderer May 8 '15 at 15:45
  • 2
    @Zacharee1 Actually i want it as a plain text within a bordered box – Kasrâmvd May 8 '15 at 17:27
  • Have you tried a text box with a formatted border? – TheWanderer May 8 '15 at 17:28
  • @Zacharee1 No i didn't! i don't know what is that :) – Kasrâmvd May 8 '15 at 17:29
  • Check the Insert menu for a text box. You can then format it. I can't tell you exactly what/where it is since I don't have my computer. – TheWanderer May 8 '15 at 17:30

See the following images to know how to create a text-box.

Click the icon with an A with a vertical bar next to it: enter image description here

Type whatever code you want to put in the box and then right-click on the border on the box. Select Line from the menu. enter image description here

Select the style you want for the box's border and click ok.

enter image description here

  • Thanks but this couldn't help me! – Kasrâmvd May 8 '15 at 19:35
  • 1
    @Kasra when an answer didn't help you, you need to explain why. Otherwise, we can't understand what's missing. How was this not enough for you? What else do you need? – terdon May 9 '15 at 9:30

IMO it's better to use "Insert > Frame > Frame..." -- do not use a text box.

Several reasons:

  • Text in frames can use paragraph styles. Text that you enter into a text box may be formatted only by hand. If it's a large document, you will want to create a paragraph style for code, and use the paragraph style instead of direct formatting. Suppose you need to change the code font later. If you used styles, you can change the style and all code examples update. If you used text boxes and direct formatting, you will have to edit every text box by hand. Not recommended.

  • AFAICS normal paragraph text automatically avoids frames, whereas, when I tried text boxes, I had to set text wrapping manually.

The point about styles is important. Styles are underused, but IMO if you're working on anything longer than, oh, 4 or 5 pages, the time you spend setting up styles will pay off many times over. Avoid LO features (like text boxes) that don't support styles.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.