我想在 PowerPoint 演示文稿中展示一些 C# 源代码。但是如何将包括语法突出显示的代码复制到幻灯片上?我可以制作屏幕截图,但这有一些缺点(难看、字体大小、无法维护)。你有什么想法吗?
8 回答
- copy the code from Visual Studio to PowerPoint
- choose "keep original formatting" on the Paste Options icon
如果我将代码从 Visual Studio 直接复制到 PowerPoint 中,使用选择性粘贴(并选择 RTF),它只会进行一些格式设置。
这是我如何进行所有格式化的方法。
- 在 Visual Studio 中复制代码。( Ctrl+ C)
- 打开一个新的 Word 文档并粘贴。( Ctrl+ V)
- 在 Word 中重新选择代码并再次复制。( Ctrl+ A, Ctrl+ C)
- 在 PowerPoint 中,将选择性粘贴为“HTML 格式”。( Ctrl+ Alt+ V)
"Paste Special" (Ctrl+Alt+V) will do it. This option is available in different places depending on your version of PowerPoint.
在Notepad++ 6.9.2 或更高版本中,右键单击文本并选择Plugin Commands
和Copy Text with Syntax Highlighting
。
- 在 PPT 中,点击“插入”->“对象”->“新建”->“Microsoft Word 文档”
- 将您的代码复制到 PPT 幻灯片中新创建的对象中,
- 您现在将看到格式并突出显示。
我接受以上所有答案。
我找到了一种更美观的方式来分享 ppt 中的代码,在演示中看起来会很优雅。
使用免费和开源的https://carbon.now.sh/ ,添加您的代码,进行自定义,然后将其导出以添加到 ppt 中。
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.