I recently wrote a repport for school with a lot of code in it. The only way I found to wrok was to highlight it with STRONG and that is really quite ugly. So is there a code highlightning extension for libre office writer?

Like this one below:

<insert code here>

A syntax highlight with different colors is also ok. I never enter a whole program so I need to be able to highligt what I think is code.

Like this one: echo "Hello World!";

Cooder

I presonally didn't like this highlight since it formats the text and all the text that comes after. I want to mark some text then click on a highlight and that's it. This one is too complicated and hard to use, I have to select programming language each time I highlight which will be about 100 times in one report, that's way too much. I would like something similar to what they use on the site. simple code highlight if you will.

Code Colorizer Formatter

It installs for me, but I can't get it to work and it doesn't have PHP or HTML support, which I need.

4 Answers
4

It's not a plug-in, but I put the code into a website that colors syntax for you. The site I use is tohtml. I don't use the html generated code however, I just copy the colored and highlighted code from the browser and paste it into my document and WYSIWYG.

COOder

COOder seems to be abandoned, and it can't be installed in LibreOffice 4.2.8.2.

Code Colorizer Formatter

Code Colorizer Formatter installs and works correctly in LibreOffice. Code Colorizer Formatter has also added PHP support, but HTML support is missing completely and JavaScript didn't work when I tested it. The instructions for how to get it to work on the Code Colorizer Formatter website didn't work for me, however I've gotten Code Colorizer Formatter to work in LibreOffice the hard way, and here are my instructions:

A new LibreOffice Basic Macros window will open. Under the Macro from heading, select My Macros -> MacroFormatterADP -> a supported programming language. In the screenshot below, Java is selected.

Under the Existing macros in... heading, select HighlightSelLanguage where Language in HighlightSelLanguage is the same as the programming language that was selected in step five. In the screenshot below, HighlightSelJava is selected.

Code Colorizer Formatter was updated on March 1, 2015 with support up to LibreOffice 4.4 for many programming languages including PHP. I tested Code Colorizer Formatter on LibreOffice 4.2. The instructions on the official Code Colorizer Formatter website didn't work for me, so I put my own instructions for using Code Colorizer Formatter in my answer.
–
karelMay 4 at 10:19