views:

416

answers:

7

Hi guys,

We have a project, and the professor asked us to print the program codes using microsoft word. however when i pasted all my codes in ms word it turns out that it doesn't have coloring, those nice programming fonts.. It just looks awfully ugly in microsoft word..

I want this to be printed on papers very gorgeously. Like what we see in our notepad++

+5  A: 

If you are on Windows, you can open the source code in Visual Studio (assuming it is C++, C# or VB), copy the code, and paste it to Word.

"Visual Studio" to "Word" does keep the formatting (color and fonts).

decasteljau
I didn't know the formatting was retained. Nice.
Michael Todd
Same thing happen when I paste code into Outlook, the formatting is retained (since Outlook uses Word internally).
decasteljau
A: 

I'm not sure I understand the question, but if you're asking "how do I put my source code into Word and make it look pretty like Notepad++," you'll want to do some research into automating Microsoft Word.

Word automation using C#
OLE Automation using Word (Article)
Microsoft Word Automation Class

Michael Todd
yea, my brain is gonna explode. but i upp'd it cause i wanna study it later. very resourceful
rymn
A: 

This may seem obvious, but how about you just print it from notepad++?

Alex Fort
He doesn't want a hard copy. He needs it in MS Word. I think he just used the "print" verb to describe a possible method of getting the formatting from Notepad++ to Word.
Beska
yes because we need to add additional details. and some screenshots of the running program.
rymn
+1  A: 

Microsoft Word is very handy for code reviews. Particularly if you don't want to splurge for one of the tools explicitly designed for peer code reviews. Each reviewer can insert their comments and/or modify the code themselves right in the document. If you keep track changes on then you can see what was changed and accept or reject the changes. During the review you only have to cycle through the comments and changes. When you are all done, you can simply copy and paste the final product back into the source file. It beats having to take a list of comments, decipher them and then incorporate the requests yourself.

EDIT: We use Visual Studio. So Cut/Paste between the source and Microsoft Word works fine, except in the cases where the line length exceeds the page size.

Dunk
Wouldn't SVN work better?
Mark
I wouldn't know since I've never used SVN. Is that Subversion? If so, it seems like just a source code control system. How would it help with peer reviews? The benefit of using Word is that there is no learning curve.
Dunk
A: 

Eclipse does the same thing told by decasteljau.

When you copy code from eclipse, and then you paste on Outlook, the code keeps its colours.

Alex. S.
+2  A: 

I do not use Word for this when I can avoid it. It's simply not very good at keeping the formatting and doesn't provide really good-looking prints.

  • The line-breaking isn't program-aware.
  • The paragraph breaking isn't program aware.
  • The keeping of the formatting from VS doesn't do structure-based markup, does it?
  • The typesetting engine of Word is a lot worse than TeX or Quark/Indesign
Stephan Eggermont
A: 

If you have the NppExport Plugin, go to

Plugins -> NppExport -> (Then you can choose between "Export to RTF", "Copy RTF to Clipboard", or "Copy all formats to clipboard")

Then open it in Microsoft Word if you choose export to rtf, or paste it to Word if you choose copy to clipboard

Hope this helps

I tried it for my SQL assignment and it works