Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to collect thousands of code lines from the programming tool to Microsoft Office Word 2010 to prepare a book, but when copying the code to Word, it looks horrible. The semi-columns and brackets are in the wrong places; it looks like this:

1

It's hard to write the whole code manually again. Any help??

share|improve this question
    
What program are you copying the text from? Which word paste command are you using? Are you using a monospace font? –  EntropyWins Jul 11 '13 at 12:54
    
the program I'm copying from is multisim(mentor graphics) which for vhdl code the word paste command is Ctrl+C I'm not using monospace font –  Salahuddin Jul 11 '13 at 13:09
    
Just real quick for me, try using the paste+text only command. If that doesn't work, see nsr81's answer on line endings, it sounds like that's really your problem. –  EntropyWins Jul 11 '13 at 13:25
    
the problem is not that two lines appear in the same line, but you may find the semi-column at the begging of the line with strange shape, you may find the begging bracket at the begging followed by the end bracket directly.. –  Salahuddin Jul 11 '13 at 13:29
1  
Also try not copying directly from the program. For example (I do not use multisim so apologies if these features do not exist) "save as" the source code in a .txt format, then copy it into word from notepad rather than multisim. Or use notepad as an intermediary to remove formatting (I do this all the time). Basically copy paste it into notepad first, then copy paste from notepad into word. If it copy pastes into notepad funny then let us know because that is helpful information (still thinking line endings though...) –  EntropyWins Jul 11 '13 at 13:31

3 Answers 3

up vote 3 down vote accepted

Notepad++ has a plugin called NppExport. It allows you to copy RTF formatted text. The RTF formatted text will have syntax highlighting and proper indenting when you paste it into Word, as it appears in Notepad++.

To use the NppExport:

  1. Select the text to be copied
  2. In the menu, select [Plugins, NppExport, Copy all formats to clipboard]
  3. Paste the text into Word
share|improve this answer
    
This is awesome, thanks @daxlerod –  CLockeWork Jul 11 '13 at 14:18
    
man, you're cool, thanks alot, it worked –  Salahuddin Jul 11 '13 at 14:44

If Word is screwing up your line endings, e.g. multiple lines of code show as one continuous line, your code might be using unix/linux line endings (\n character). You can try converting those to windows line endings (\r\n). Most text editors, like Notepad++/Ultraedit, will do it for you.

You can also do it online.

Also, you will need to use a proper font for styling your code, could be Courier or Consolas.

share|improve this answer

You can in fact see the code in the IDE or in any convenient tool.

Printing the on the virtual printer PDF.

To create the PDF.

If you need to convert PDF to Word.

All ...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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