How to: C# source with syntax highlighting on PowerPoint slides

C#Syntax HighlightingPowerpoint

C# 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#

  1. copy the code from Visual Studio to PowerPoint
  2. 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.

  1. Copy the code in Visual Studio. (Ctrl+C)
  2. Open a new Word document and do a paste. (Ctrl+V)
  3. Re-select the code in Word and copy it again. (Ctrl+A, Ctrl+C)
  4. 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#

  1. in PPT, click "Insert" -> "Object" -> "Create New" -> "Microsoft Word Document"
  2. Copy your code to the newly created object in PPT slides,
  3. 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.

enter image description here

Solution 7 - C#

Copy and paste the code to WordPad, then copy from word pad to wherever you want and keep original formattingkeepOriginalFormatting

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohn DorianView Question on Stackoverflow
Solution 1 - C#sblomView Answer on Stackoverflow
Solution 2 - C#Krogue2View Answer on Stackoverflow
Solution 3 - C#IshmaelView Answer on Stackoverflow
Solution 4 - C#RobertoView Answer on Stackoverflow
Solution 5 - C#StevenLeeView Answer on Stackoverflow
Solution 6 - C#Deepak parameshView Answer on Stackoverflow
Solution 7 - C#Jaad ChacraView Answer on Stackoverflow
Solution 8 - C#Reed CopseyView Answer on Stackoverflow