Word – Copy-paste multiple pages of programming codes to Microsoft Word

copy/pastedocumentationdocumentsmicrosoft word

My problem: want to copy hundreds of lines of programming codes to a Microsoft Word 2010 document. (make some sort of documentation)

I've tried the method described in this question, to copy and paste programming codes to Microsoft Word 2010 document. The method is : Insert -> Object -> OpenDocument Text.
This worked perfectly and I liked it.

But there's one thing it can't do, it is when the code exceeds the size of one document page. It can't show codes longer than one page. The code can't be separated in two different pages.

Do you have a better solution to this problem ?

Best Answer

Inserting an object is a very bad way of pasting code into a Word document. An inserted object cannot span more than one page.

It is much more effective to just copy the text from the source code, then use the Paste Keep Formatting option in Word2010. You may find that your source code editor doesn't pass the formatting information, in which case you will have to add it yourself.

Related Question