
Select "Do not check spelling or grammar".Under Language, choose "Proofing Language". To achieve requirement 5, follow the steps below: Note how nicely it breaks across the page - NO extra effort needed to manage this, which you would face if inserting "OpenDocument Text" object or if using "Simple TextBox". Resulting Microsoft word snippet will appear as shown in screenshot below.

I have kept the line numbers to show how well this works with Microsoft word. To achieve requirements 2, 3 and 4 above, use table in Microsoft word, to insert the code snippet. Thanks to this blog for providing this information. Now your code is ready to be pasted into Microsoft word.

Add code snippets to a word document, with syntax highlighting for easier visibility and differentiation of code and other text.Hopefully, the answer would be useful to someone. The post is longer than I would have liked, but I believe screenshots are always helpful. I am sharing the approach and my reasoning of why I chose this approach. However, I ended up using an entirely different approach which suited my needs. I recently came across this post and found some useful hints. Is there some better (and ideally portable) way to do this? Is there at least some sort of verbatim style similar to the LaTeX environment? Is there at least some pretty printer that I could copy-and-paste as RTF? My examples are primarily in Java.Īs someone who is used to LaTeX, doing this in Word is extremely painful.
:max_bytes(150000):strip_icc()/WriteText-d25e3ec4db2e4f5e91abbd91e888e432.jpg)
Some of the examples will be written from the IDE, and others would be written in place. I have to write some documents that will include source code examples.
