How to: C# source with syntax highlighting on PowerPoint slides
C#Syntax HighlightingPowerpointC# Problem Overview
I would like to show some C# source code in a PowerPoint presentation. But how can I copy the code including the syntax highlighting onto the slides? I could make screenshots, but that has some drawbacks (ugly, font size, unmaintainable). Do you have some ideas?
C# Solutions
Solution 1 - C#
- copy the code from Visual Studio to PowerPoint
- choose "keep original formatting" on the Paste Options icon
Solution 2 - C#
If I copy the code from Visual Studio directly into PowerPoint, using Paste Special (and picking RTF), it only does some of the formatting.
Here is how I got it to do all the formatting.
- Copy the code in Visual Studio. (Ctrl+C)
- Open a new Word document and do a paste. (Ctrl+V)
- Re-select the code in Word and copy it again. (Ctrl+A, Ctrl+C)
- In PowerPoint, do a Paste Special, as "HTML Format". (Ctrl+Alt+V)
Solution 3 - C#
"Paste Special" (Ctrl+Alt+V) will do it. This option is available in different places depending on your version of PowerPoint.
Solution 4 - C#
In Notepad++ 6.9.2 or higher, right click the text and select Plugin Commands
and Copy Text with Syntax Highlighting
.
Solution 5 - C#
- in PPT, click "Insert" -> "Object" -> "Create New" -> "Microsoft Word Document"
- Copy your code to the newly created object in PPT slides,
- You will see the formatting and highlight now.
Solution 6 - C#
I accept all of the answers above.
I have found a more presentable way of sharing the code in ppt, which will look elegant in presentation.
use https://carbon.now.sh/ which is free and open source, add your code, do customizations and then export it to add it in ppt.
Solution 7 - C#
Copy and paste the code to WordPad, then copy from word pad to wherever you want and keep original formatting
Solution 8 - C#
You can use Windows Live Writer with the Insert Code plugin to "write" the C# code and syntax highlight it. This should be copy and pastable directly into PowerPoint, since it's inlines all of the syntax highlighting using styling elements.