How to: Copy and Paste highlighted and intented source code in Open Office

Maybe you have some repport due, where few lines of code are needed, but Open Office Writer doesn’t handle .c source file, neither .py, .m
The solution:

sudo apt-get install highlight

gedit “~/.gnome2/nautilus-scripts/Highlight and open with OOO”

#!/bin/bash
#
highlight -o /tmp/highlight_temp_file.html $*
openoffice /tmp/highlight_temp_file.html
rm /tmp/highlight_temp_file.html

chmod +c “~/.gnome2/nautilus-scripts/Highlight and open with OOO”

And now, any right clic on a file, and it’s opened in OOO with nice colors.

Leave a Reply

Your email address will not be published. Required fields are marked *