Inserting code snippets into MS Word documents
Step 1 – Insert Object from MS Word’s INSERT menu. Select OBJECT from the drop-down (as opposed to ‘Text from file’).
Step 2 – You should see an ‘Object’ pop-up – that contains a list of ‘object types’ that you can insert. Select ‘OpenDocument – Text’.
Step 3 – That’s it – Now cut and paste your code (from your IDE or wherever) into the OpenText document. When you ‘paste’ it, you can paste ‘with formatting’ so that it looks like code. The resulting object shows up neatly inside your word document – and takes up only as much space as you need it to (you can drag and reduce the size of the embedded document).
This is how my document ended up looking (after inserting some TSQL code).
Leave a Reply