如何:在 PowerPoint 幻灯片上突出显示语法的 C# 源代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/825353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to: C# source with syntax highlighting on PowerPoint slides
提问by
I would like to show some C# source code in a PowerPoint presentation. But how can I copy the code including the syntax highlightingonto the slides? I could make screenshots, but that has some drawbacks (ugly, font size, unmaintainable). Do you have some ideas?
我想在 PowerPoint 演示文稿中展示一些 C# 源代码。但是如何将包括语法突出显示在内的代码复制到幻灯片上?我可以制作屏幕截图,但这有一些缺点(丑陋、字体大小、无法维护)。你有什么想法吗?
回答by sblom
- copy the code from Visual Studio to PowerPoint
- choose "keep original formatting" on the Paste Options icon
- 将代码从 Visual Studio 复制到 PowerPoint
- 在粘贴选项图标上选择“保持原始格式”
回答by Reed Copsey
You can use Windows Live Writer with the Insert Codeplugin 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.
您可以使用带有插入代码插件的Windows Live Writer来“编写”C# 代码并在语法上突出显示它。这应该可以直接复制和粘贴到 PowerPoint 中,因为它使用样式元素内联了所有语法突出显示。
回答by Ishmael
"Paste Special" (Ctrl+Alt+V) will do it. This option is available in different places depending on your version of PowerPoint.
“选择性粘贴”(Ctrl+Alt+V)就可以了。根据您的 PowerPoint 版本,此选项在不同位置可用。
回答by Krogue2
If I copy the code from Visual Studio directly into PowerPoint, using Paste Special (and picking RTF), it only does someof the formatting.
Here is how I got it to do all the formatting.
如果我将代码从 Visual Studio 直接复制到 PowerPoint 中,使用选择性粘贴(并选择 RTF),它只会执行一些格式设置。
这是我如何让它完成所有格式化。
- 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)
- 在 Visual Studio 中复制代码。( Ctrl+ C)
- 打开一个新的 Word 文档并粘贴。( Ctrl+ V)
- 在 Word 中重新选择代码并再次复制。( Ctrl+ A, Ctrl+ C)
- 在 PowerPoint 中,执行选择性粘贴,作为“HTML 格式”。( Ctrl+ Alt+ V)
回答by StevenLee
- 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.
- 在PPT中,点击“插入”->“对象”->“新建”->“Microsoft Word文档”
- 将您的代码复制到 PPT 幻灯片中新创建的对象中,
- 您现在将看到格式并突出显示。