In Word, use a particular paragraph style for your code examples. Add paragraph shading to that style.
Also, enable Line Numbering as required. You will have to suppress it for other styles in the document.
how to
Also, enable Line Numbering as required.
?????