Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to embed programming source code to Powerpoint slide, and keep code highlighting/coloring?

share|improve this question
    
what application are you copying from? – John T Dec 21 '09 at 4:26
    
I use textmate, e-texteditor and eclipse the most. – Yousui Dec 21 '09 at 4:58

10 Answers 10

After pasting, a small "Paste Options" icon appears below the pasted text.

Click this icon and choose "Keep Source Formatting" :

enter image description here

share|improve this answer
    
I don't see such a Paste Options icon. I don't see a button to give me these options. I'm using PowerPoint:mac 2011. I think I have seen it in Windows versions, however. – A-B-B Jul 19 '13 at 21:49
    
I tried different suggested methods and tools to copy from, but was actually missing that word/powerpoint was messing up the format by using "Destination Theme". Thanks! – Tim Büthe Jan 22 '14 at 11:23

Pygments can format almost every format to rtf:

pygmentize -f rtf -o code.rtf code.py
share|improve this answer
    
An online translator is available at pygments.org/demo – koppor Nov 25 '15 at 11:48
    
Same idea, straight to the OS X clipboard pygmentize -f rtf code.py | pbcopy. – Christian Long Mar 14 at 14:28

Use Notepad++ with add-on NppExport.

  • Select the source code

  • Use Copy RTF to clipboard of NppExport

  • Paste into empty PPT slide (do not select any textfiled)

share|improve this answer
    
YES I wish I knew about this years ago – kenbellows Mar 9 '15 at 13:59

If the source code does not need to be copied and pasted out of the presentation, a quick and dirty solution could be to simply take screenshots of the source code.

share|improve this answer
4  
Image can be fuzzy when zoom in. – Yousui Dec 21 '09 at 4:58
    
Use the magnifier and then take a screenshot of that. – wbeard52 May 17 '15 at 0:57
  1. Click on Insert → Object → OpenDocument Text
  2. Paste on opened panel
  3. Click outside.

Note: Copying from Notepad++ will preserve colors and styling.

share|improve this answer
    
Doesn't work for power point 2010. I copied text from Notepad++ to Power point presentation but it looses colors and styling. – AnkurTank Jan 4 at 5:11
    
If I use NPPExport pluging and use "copy RTF to clipboard" and then paste it works. – AnkurTank Jan 4 at 5:13

Online syntax highlighter like TextMate seems good as well, http://markup.su/highlighter/

But after pasting into PowerPoint presentation new lines and line spacing is lost, so we can take a screen shot of the preview and paste it in our PowerPoint presentation

share|improve this answer
    
Pasting into ppt does not quite work here on Windows 10: The new lines are not pasted. – koppor Nov 24 '15 at 15:22

Pasting from Eclipse should retain formatting if the app supports it. I know Word does... not sure about PPT.

share|improve this answer
1  
Works from Eclipse Juno to Word 2010, but not to Powerpoint 2010 - it loses the colours and converts some of them to bold text – DNA Sep 4 '13 at 17:21

May I commend an excellent html service by ookii.org:

http://www.ookii.org/software/formatc/

it works for C/C#/VB/HTML only though.

share|improve this answer

I've had no success pasting into Powerpoint 2010 on Windows.

However, pasting from Eclipse into Word 2010 works.

You can then save this formatted text as an RTF file, then embed the RTF into a Powerpoint 2010 slide using Insert Object (and optionally select 'link' so you can edit and update the text in Word).

share|improve this answer

Using Notepad++ and Npp Export works great, but your text will end up with a white background.

To remove it, paste first the text in word with the "preserve source formatting" option. Then, select the text and in Home > Font, remove the background with the Text Highlight Color option.

Then, copy again the text from word, and paste it in powerpoint with the "preserve source formatting" option.

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.