55

我想在 PowerPoint 演示文稿中展示一些 C# 源代码。但是如何将包括语法突出显示的代码复制到幻灯片上?我可以制作屏幕截图,但这有一些缺点(难看、字体大小、无法维护)。你有什么想法吗?

4

8 回答 8

49
  1. copy the code from Visual Studio to PowerPoint
  2. choose "keep original formatting" on the Paste Options icon
于 2009-05-05T15:18:52.133 回答
28

如果我将代码从 Visual Studio 直接复制到 PowerPoint 中,使用选择性粘贴(并选择 RTF),它只会进行一些格式设置。
这是我如何进行所有格式化的方法。

  1. 在 Visual Studio 中复制代码。( Ctrl+ C)
  2. 打开一个新的 Word 文档并粘贴。( Ctrl+ V)
  3. 在 Word 中重新选择代码并再次复制。( Ctrl+ A, Ctrl+ C)
  4. 在 PowerPoint 中,将选择性粘贴为“HTML 格式”。( Ctrl+ Alt+ V)
于 2011-08-09T16:57:40.743 回答
13

"Paste Special" (Ctrl+Alt+V) will do it. This option is available in different places depending on your version of PowerPoint.

于 2009-05-05T15:22:11.970 回答
8

Notepad++ 6.9.2 或更高版本中,右键单击文本并选择Plugin CommandsCopy Text with Syntax Highlighting

于 2016-10-25T11:48:59.590 回答
4
  1. 在 PPT 中,点击“插入”->“对象”->“新建”->“Microsoft Word 文档”
  2. 将您的代码复制到 PPT 幻灯片中新创建的对象中,
  3. 您现在将看到格式并突出显示。
于 2012-05-18T02:47:00.237 回答
4

我接受以上所有答案。

我找到了一种更美观的方式来分享 ppt 中的代码,在演示中看起来会很优雅。

使用免费和开源的https://carbon.now.sh/ ,添加您的代码,进行自定义,然后将其导出以添加到 ppt 中。

在此处输入图像描述

于 2021-01-27T07:22:40.190 回答
3

将代码复制并粘贴到写字板,然后从写字板复制到您想要的任何位置并保留原始格式保持原始格式

于 2016-10-28T07:20:16.460 回答
1

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.

于 2009-05-05T15:20:43.563 回答