Does anyone know how to copy and paste some code into Notepad++ and preserve all the styles and colors of the pasted text?
3 Answers
Plain text does not have formatting.
What you are asking for is not possible.
If you mean that you are seeing colors/styles in one IDE, that's because the IDE "understands" the format and shows your the text in colors. This doesn't mean that the text itself has associated color.
Notepad++ has syntax highlighting for many languages/formats - select the appropriate one from the Language
menu.
Some document formats do have color/styles (exmaples: RTF, HTML).

- 489,969
- 99
- 883
- 1,009
-
Just if it helps, the opposite is possible. See [Copy Notepad++ text with formatting?](http://stackoverflow.com/questions/3475790/copy-notepad-text-with-formatting) – chelder Mar 03 '14 at 19:37
The question added as a bounty has a different answer than the question originally asked. I'm documenting an answer here for the answer to the bounty
Is it possible to copy from notepad++ while conserving the Syntax Highlighting? Is it possible to do that with a plugin?
Yes, this is possible. An excellent answer was provided on SuperUser on how to do this. I've quoted it below.
Go to Plugins -> NppExport. From there, you have three options you can consider:
Export to RTF Export to HTML Copy all formats to clipboard Start with the last one - "Copy all formats to clipboard" - which will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method.
Additionally, this was captured in screenshots on this answer.
You can't preserve the coloring of the code you paste into notepad++. The indentations and formatting should copy over fine.
If you want to copy and paste code and have the exact same coloring and styling you will need to either copy and paste within one IDE or program. So for example, copy and paste from one file in Visual Studios to another file in Visual Studios. Or take the time to make your own style of colors in Notepad++. The option exists to do that.

- 741
- 1
- 11
- 32