Copy-paste code from Visual Studio, but paste UNFORMATTED code

前端 未结 11 1250

Is there any way to force Visual Studio to copy selected code to the clipboard as unformatted text?

When I am copy-pasting code into Word or more often Outlook

相关标签:
11条回答
  • 2021-02-11 15:55

    This Microsoft Office site offers a workaround that involves writing a macro to replace ctrl+v functionality to paste plain text all the time, but that may not be what you want. You can alternatively remap an unused shortcut (ctrl+?) to provide you with this functionality so you don't have to keep enabling / disabling the macro.

    0 讨论(0)
  • 2021-02-11 15:56

    If you press CTRL+Z after pasting, it will reverse to the non-formatting one, because the formatting actually counts as one step after the regular paste.

    0 讨论(0)
  • 2021-02-11 15:59

    If you are comfortable with keyboard shortcuts, Press Ctrl + Alt + V and choose Unformatted Unicode Text will do it for you in Microsoft products.

    0 讨论(0)
  • 2021-02-11 16:00

    For applications that do not have a "paste special" you could use an application like PureText

    0 讨论(0)
  • 2021-02-11 16:08

    From this blog post I got these instructions for getting rid of the black background when copying & pasting out of VS with the 'Dark Theme' activated, but the html in it can be tweaked to alter the rest of the formatting as required (e.g. set all text to black).

    If required, install Productivity Power Tools

    Open Tools → Extensions and Updates

    Select Online (Visual Studio Gallery) and search for Productivity Power Tools 2012/2013

    Download and restart Visual Studio when prompted

    Productivity Power Tools Settings

    Open Tools → Options → Expand Productivity Power Tools select HTML Copy

    Change the BeforeCodeSnippet option to:

    <style type="text/css">.identifier {color:black !important;}</style>
    <pre style="{font-family}{font-size}{font-weight}{font-style}">
    

    Change EmitSpanClass to: True

    Check EmitSpanStyle is: True

    0 讨论(0)
提交回复
热议问题