如何在word中插入漂亮的代码
Stack Overflow上高赞回答
Here is the best way, for me, to add code inside word:
- go to Insert tab, Text section, click object button (it’s on the right)
- choose OpenDocument Text which will open a new embedded word document
- copy and paste your code from Visual Studio / Eclipse inside this embedded word page
- save and close
The result looks very nice.
图示如下
Here are the advantages of this method:
- the code keeps its original layout and colors.
- the code is separated from the rest of the document, as if it was a picture or a chart.
- spelling errors won’t be highlighted in the code (this is cool !)
And it takes only few seconds.
来自 *