2

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 ?

1
  • Yes, don't use an embedded object for that purpose. I honestly don't know why so many people upvoted for the answer you linked to (and i write lot's of technical documents containing source code). What is your pain that you do not want to simply copy'n'paste the code into your document? Perhaps people don't know about setting deliberate page breaks (which prevents your source code being pushed to other pages when you edit/write some other text), or something, so that they need to come up with terrible crutches...
    – user274116
    Commented Nov 16, 2013 at 17:33

1 Answer 1

4

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.

1
  • I agree. Word will accept HTML or RTF formating.
    – surfasb
    Commented Nov 16, 2013 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .