Is it possible to copy code from Visual Studio and paste formatted code to OneNote?

后端 未结 12 1682
时光说笑
时光说笑 2021-01-31 07:53

Is there a way to copy code from visual studio (C#) and paste it into OneNote, without losing the formatting?

I was able to do this, but only if I copy from VS, paste

12条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 08:22

    This is an option that seems to be disabled by default.

    To enable (in VS 2019):

    1. Go to Tools -> Options

    2. type copy in the search box

    3. Under Text Editor -> Advanced...

    4. Check Copy rich text on copy/cut

    Top copy as formatted

    Once the feature is enabled, depending on the target, this may be a two-step process. If, after copying and pasting code, it still appears as unformatted (e.g. if pasting into a web browser), use the approach suggested by marcus, by first pasting into wordpad.exe (start -> run -> type wordpad), then copying the text from within Wordpad again, and pasting into the target application/browser.

提交回复
热议问题