Looking for a way to format my code in MS Word I found this question on Stack Overflow and combined the two high rated answers to create an openDocument with the code keeping its formatting:
- Go to "insert" tab, click "object" button (it's on the right)
- Choose "openDocument Text": it will open a new embedded word
document- Open code in Notepad++
- Select the programming language from the language menu
- In Notepad++ right click and select Plugin commands -> Copy Text with Syntax Highlighting
- Paste in to embedded word document
- save and close
This works good but I would like line numbers on the code, is there a way to do that?
Best Answer
When the code is in Notepad++, you can use TextFX->TextFX Tools->Insert line numbers to put line numbers in front of all of the necessary lines. Then when you copy/paste, the line numbers will be there.