简体   繁体   English

Visual Studio 2019 深色主题:如何使用默认语法突出显示将代码复制并粘贴到 MS Word?

[英]Visual Studio 2019 dark theme: How to copy and paste code to MS Word with default syntax highlighting?

I want to copy the code portion from Visual Studio 2019 Community, with Dark Theme set, and paste it to MS Word with preserving the copied text styles as it was done in Visual Studio 2017 - with the default code styling.我想从 Visual Studio 2019 社区复制代码部分,设置深色主题,然后将其粘贴到 MS Word,同时保留复制的文本样式,就像在 Visual Studio 2017 中所做的一样 - 使用默认代码样式。

Visual Studio 2017 with Dark Theme - copy result (that is what I want):带有深色主题的 Visual Studio 2017 - 复制结果(这就是我想要的): 在此处输入图片说明

Visual Studio 2019 with Dark Theme - copy result (unwanted):带有深色主题的 Visual Studio 2019 - 复制结果(不需要): 在此处输入图片说明

How to preserve that behaviour in VS 2019?如何在 VS 2019 中保留这种行为?

I tested Copy As Html extension but it didn't seem to solve the issue (or I am missing something).我测试了Copy As Html扩展,但它似乎没有解决问题(或者我遗漏了一些东西)。

  1. Install Productivity Power Tools From Extensions.从扩展安装生产力电动工具。
  2. Restart Visual Studio.重新启动 Visual Studio。
  3. Go to Tools -> Options -> Protectivity Power Tools -> HTML Copy and:-转到工具 -> 选项 -> 保护性电动工具 -> HTML 复制和:-

a.一种。 Change BeforeCodeSnippet to:-将 BeforeCodeSnippet 更改为:-

<style type='text/css'> .user{color:#006600 !important} .identifier{color: black !important;} .keyword{color: blue !important;} .literal{color: black !important;} .operator{color: black !important;} .string{color: #A31515 !important;} .number{color: black !important;} .Types{color: #2B91AF !important;} .Class{color: #2B91AF !important;} .delegate{color: #2B91AF !important;} .Interface{color: #79B351 !important;} .Interface.name{color: #79B351 !important;} .enum{color: #79B351 !important;} .enum.name{color: #79B351 !important;} .enum.member.name{color: black !important;} .comment{color: #008000 !important;} </style> <pre>

b.Change EmitSpanClass to true .将 EmitSpanClass 更改为true

c. C。 Check if EmitSpanStyle is true.检查 EmitSpanStyle 是否为真。

  1. Restart Visual Studio.重新启动 Visual Studio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Visual Studio 2019 切换到 Resharper Dark 主题 - How to switch to Resharper Dark theme with Visual Studio 2019 创建 Visual Studio 主题特定语法突出显示 - Create Visual Studio Theme Specific Syntax Highlighting 如何在 Visual Studio 上使用新的深色主题 - How to use the new dark theme on visual Studio Visual Studio 2019中Python的语法突出显示/着色不起作用 - Syntax Highlighting/Coloring for Python in Visual Studio 2019 is not working Visual Studio Code 中的 Java 语法高亮显示 - Java Syntax Highlighting in Visual Studio Code 如何在不缩进的情况下将代码复制并粘贴到 Visual Studio 监视窗口中? - How to copy and paste code into Visual Studio watch window without indent? Visual Studio Code One Dark Pro Theme常用颜色 - Visual Studio Code One Dark Pro Theme Commnent color Visual Studio 2015黑暗主题突然使代码消失 - Visual Studio 2015 Dark Theme suddenly makes code disappear 从 Visual Studio 2019 中的 Word 文件复制代码时 C# 出现意外字符错误 - Unexpected character error in C# while copy code from word file in visual studio 2019 在 Visual Studio Dark Theme 中,如何去掉活动代码行周围的白色矩形? - In Visual Studio Dark Theme how to get rid of white rectangle surrounding active line of code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM