
In this article, we’ll see how to paste code into Microsoft Word with formatting.
First, open MS Word, click on the “Insert” tab, and insert a 1X1 table.

Next, select the table and click on the “Cell Shading” option. It changes the background color of the table. Choose a black color.

Next, copy your code from the IDE. I am copying the Python code.

Next, open the Word, click on our table, and press CTRL + V.

As you can see, the code snippet is pasted with formatting. Those red color underlines are because of the spell-checking features of the Word. You can disable it if you want.
This is a simple trick to paste code into MS Word with formatting. I hope you find it useful. If you have any doubts, comment below.
YOU MAY LIKE: