If you’ve ever tried copy-past­ing source codes into a Word doc­u­ment, you know what a night­mare it is to apply syn­tax high­light­ing. Most prob­a­bly, you have to man­u­al­ly apply col­ors on sec­tions of source code. While search­ing for a solu­tion, I came to know about a Notepad++ plu­g­in Npp­Ex­port that’ll help you copy code from Notepad++ and paste it in Microsoft Word with syn­tax-col­or­ing attached.

If you haven’t got a copy of Notepad++, down­load it from their down­load page. After installing it on your machine, launch Notepad++ and copy-paste this Python source code into a new file:

Now go to Lan­guage > P > Python to apply syn­tax high­light­ing for Python code. You can select oth­er lan­guages depend­ing on your require­ments. You’ll notice that the source code is now col­or­ful. Now go to Plu­g­ins > NPP­Ex­port > Copy all for­mats to clip­board. Select­ing this option saves a copy of the select­ed source code in the clip­board. Launch Microsoft Word and press Ctrl + V to paste the copied source code. Here is how it looks like in Microsoft Word:


If you’re aware of any oth­er method, do let me know in your com­ments.

Tagged with →  
Share →
%d bloggers like this: