I do this all the time using the syntax highlighter in Notepad++.

If you don't have Notepad++ (my favorite code/text editor), get it here: http://notepad-plus-plus.org/

Here's how to get syntax highlighted code into your LibreOffice documents:

1: Open source file with Notepad++
2: In Notepad++ click Plugins > NppExport > Export to RTF

You will now have a syntax highlighted copy of your source file however, it will be double spaced. To remove the extra spaces proceed as follows:

1: With any editor, open the .rtf file you just created
2: Search and replace "\par" with "\line"
3: Save file

Open the .rtf file with LibreOffice Writer, select all (CTRL-A), copy & paste into your working document.

This sounds like a bit of an ordeal, but I do this quite frequently, and once you've done it a few times, it becomes very fast and easy.

Good luck,

-Bill





On 8/11/2013 9:22 PM, aihaike wrote:
Hey Miguel,

thank you for you reply.
This the kind of macro I need but it does not seem to work with LibreOffice
4 unfortunately.
I think I'm going to make a snapshot of my codes and include them  as a
picture.
Éric.



--
View this message in context: 
http://nabble.documentfoundation.org/Including-code-example-in-documents-tp4069680p4069685.html
Sent from the Users mailing list archive at Nabble.com.



--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to