Home » Questions » Computers [ Ask a new question ]

Syntax highlighting in Microsoft Office Word [duplicate]

Syntax highlighting in Microsoft Office Word [duplicate]

I need to paste some code (ANSI C) in Microsoft Office Word, and I need some form of syntax highlighting (instead of simply changing the font to Lucida Console)

Asked by: Guest | Views: 274
Total answers/comments: 2
Guest [Entry]

"Taken from Breakthrough's answer for this question (thanks to T. Kaltnekar's comment)

You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files ""out of the box"" - PHP included!

Download & install it, fire it up, and load up your PHP file. You should automatically see it beautifully coloured (if not, because the file extension is something other than .php, go to Language -> PHP or Language -> P -> PHP).

If you need to change any of the colours, you can easily do so - just go to Settings -> Styler Configurator. From that menu, you can change the various highlighting and font options, to suit your needs - although the default usually suffices for most.

Then, go to Plugins -> NppExport. From there, you have three options you can consider:

Export to RTF
Export to HTML
Copy all formats to clipboard

Start with the last one - ""Copy all formats to clipboard"" - which will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method."
Guest [Entry]

I'm not aware of any Office plugins that will do this, but if you have Visual Studio or Visual C++ Express Edition installed, you can copy and paste code (that will keep its formatting) from Visual Studio directly into Word.