Copying Code to Word

Dominic B

New Member
I am trying to copy code I've written in Programming Editor, into Word for a write up of the project - is there a way to copy the code and maintain it's formatting?

Thanks,
Dominic
 

Peter M

Senior Member
Yes you loose the colour, also the character spacing (font dependant)/ tab spacing alters. So if you had comments in nice strait lines down the page, they are now all over the place.

I tried using Arial, font size 10 and a charater spacing of 130%.
This lined up most of my comments etc.

To change the font spacing go>format> font>>character spacing
To change the standard tab spacing, go>format>paragraph>tabs and set the default tab stops to 1.2cm

But the best way is as Andrew suggests, a screen shot
Hit the print screen button then goto word and Ctrl V (paste).
.
 

slimplynth

Senior Member
Can get the colour formatted text into word (open office) if you don't mind having the line numbers or take the time to remove them.

Chose print in the PE.. selected PDFCreator from printer options, the PDF doc then lets you copy and paste the colour formatted text into a document.
 
Last edited:

MartinM57

Moderator
I often find that Courier font in Word allows the spacing to be accurately represented .. and makes the code stand out from the rest of the text quite nicely
 

Mycroft2152

Senior Member
I often find that Courier font in Word allows the spacing to be accurately represented .. and makes the code stand out from the rest of the text quite nicely
Yes, you need a mono-spaced font, rather than a variable spaced font.

After you do this so many times, it just becomes second nature.

A mono-spaced font has all the the letters and numbers exactly the same width. Think of an old mechanical typewriter, or for those even older a teletype machine.
 
Top