滚动条和灰色背景

滚动条和灰色背景

本文介绍了如何在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.

我搜索并找到了此有用的链接,但它不会更改背景颜色并且没有滚动条

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复制一些代码,将其粘贴到doc单词中,您将看到此灰色框,等等.

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

标记您的文字并转到:

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

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中显示的代码片段(滚动条和灰色背景)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 17:32