10

I need to use MS Word to make some documentation for python code. Line number, or boxing around the code, or anything would be better than just use normal format.

Is there any good/useful style/method for code documentation purposes?

5

Do you have an editor that formats python code for you? I ask because Visual Studio will copy code onto the clipboard with formatting intact so that when pasted into word it looks identical (give or take line lengths).

Visual Studio itself supports python now. The Community Edition doesn't have the somewhat restrictive licensing limitations of the old Express edition; meaning it's likely to be an - admittedly heavyweight - option to get formatted code into other documents even if your preferred editor doesn't put syntax highligfhed code onto the clipboard.

5

At the most basic you can select a monospaced font - usually Courier New - as your code font. You won't get all the syntax highlighting, but it will stand out from the rest of your document.

1

You need to add Office-addin called Easy Syntax Highlighter

from Insert tab click ... > Add-ins >

search for Easy Syntax Highlighter > Add

It will show as a new tab

Setting > choose your prefered Theme

Personally I like Solarized Light

info: https://appsource.microsoft.com/en-us/product/office/WA200000011?src=office&corrid=2d952cc1-0c8e-4829-9c68-48df8e5da7c1&omexanonuid=b09037f4-bb6f-4171-b2c7-b2de18887d14&referralurl=https%3a%2f%2feuc-word-edit.officeapps.live.com%2f

0

If you manage to copy code style from your IDE, you'll find that the font used for Eclipse IDE (for example) is "Consolas". I find that it looks pretty good in MS Word. If you require 100% of the formatting you can always use this neat little website: http://www.planetb.ca/syntax-highlight-word

Just copy and paste the code into the box and click "show highlighted" and it should open in a new window. Then, simply copy everything and paste that into Word. It's pretty cool!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.