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

后端 未结 12 1681
时光说笑
时光说笑 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:28

    I just figured out a workaround to do this without any plugins.

    1. Insert a table to OneNote with only one cell
    2. Change the shading color of this table to vscode background color, you can use the color picker to pick the bg color of vscode
    3. Choose the code block you want to copy and convert the indent to tab(otherwise the indent will be lost when pasting) reference: https://github.com/Microsoft/vscode/issues/35954
    4. Copy the selected code and paste it into the cell
    5. Change back the code indent of source code to space.

    PS: I have tried in macOS it works fine

提交回复
热议问题