Home » Questions » Computers [ Ask a new question ]

Are there any plugins for Microsoft Word to format source code samples inside a regular document?

Are there any plugins for Microsoft Word to format source code samples inside a regular document?

I need to write a technical document in Microsoft Word, with source code samples sprinkled throughout the text.

Asked by: Guest | Views: 301
Total answers/comments: 2
Guest [Entry]

"You can create a ""code style"" using the Format / Styles and Formatting option. From the ""Styles and Formatting"" sidebar, create a new style to use for code. You can specify the font, size, tabs, borders, shading, shortcut keys, etc...

Once you have a new code style, select your code in the document and apply your new style. You can select multiple locations in text by holding the button while selecting the text.

Another advantage of using styles is that you can easily change the format of any text that uses that style. You just change the properties of the style, and any text that uses that style is automatically updated."
Guest [Entry]

"Not technically an answer to the question you asked, but there is a plugin to do exactly what you're looking to do... for OpenOffice.

http://extensions.services.openofficedotorg/project/CodeFormatter

It's still under development, and isn't perfect nor lightning-fast, but for the languages it supports (C[++], Java, XML, Perl, Python, and Basic) it does a pretty damn sweet job! And unlike Visual Studio copy-n-pasting, you can adjust the formatting just by modifying the styles it uses (and generates) to tag up the colorized code.

Seeing as OpenOffice is a $0 product, and it seems to do what you're looking for (unlike Word), it's at least worth considering, no?"