如何在 MS Word 文档中显示在 StackOverflow 中显示的代码片段(滚动条和灰色背景) [英] How to show code snippets in MS Word document as it shows in StackOverflow (scrollbars and gray background)

查看:25
本文介绍了如何在 MS Word 文档中显示在 StackOverflow 中显示的代码片段(滚动条和灰色背景)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个文档,旨在显示在 C# 项目中所做的代码更改,我正在寻找一种好的格式来显示代码片段.

I am writing a document which intends to show code changes made in C# project, I am looking for a good format to show code snippet.

我喜欢 StackOverflow 网站在其问答(滚动条和背景颜色)中显示代码片段的方式.

I like is the way StackOverflow site shows code snippet in its Questions and Answers (scrollbars and background color).

谁能指导我创建类似的背景/视图以在 Word 文档(主要是滚动条)中显示代码片段.

Can anybody guide me to create similar background/view to show code snippet in word document (mainly scrollbars).

我尝试从 StackOverflow 复制并粘贴它,但背景没有出现.

I tried copying and pasting it from StackOverflow but the background does not appear.

我搜索并找到了这个有用的链接,但它不会改变背景颜色并且没有滚动条如何以 MS Word 保留格式和语法高亮显示代码片段?

I search and found this useful link but it does not change background color and don't have scroll bars How do you display code snippets in MS Word preserving format and syntax highlighting?

推荐答案

这是我所做的,首先是结果:

Here is what I did, first the results:

stackoverflow复制一段代码,粘贴到word文档中,你会得到这个灰框等等

Go to stackoverflow copy some code, paste it in the word doc, you will get this gray box and etc.

标记您的文本并转到:

然后您只需在任何 IDE 中编写代码,然后将其粘贴到单词 doc 中,标记它并将样式设置为代码.:)

Then you just write your code in any IDE, and past it into the word doc, mark it and set the style to code. :)

这篇关于如何在 MS Word 文档中显示在 StackOverflow 中显示的代码片段(滚动条和灰色背景)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆