【问题标题】:Copy/paste from Visual Studio to browser with formatting intact从 Visual Studio 复制/粘贴到浏览器,格式保持不变
【发布时间】:2013-11-10 10:05:05
【问题描述】:

我经常在 WordPress 博客和网络论坛 (phpbb) 上分享代码 sn-ps。

我使用带有Productivity Power Tools 的Visual Studio 2010。

通过使用此扩展 (Ctrl+Alt+]) 的 Align Assignment 选项,我得到了很好的格式:

static void Main()
{
     int firstInt              = 20;
     int secondInt             = 50;
     int thisWillBeTheThirdInt = 100;
}

但是,如果我使用 FireFox、Chrome 复制粘贴(或不带格式的复制粘贴)到网站表单,或粘贴到 Notepadd++,格式将恢复为:

static void Main()
{
    int firstInt       = 20;
    int secondInt         = 50;
    int thisWillBeTheThirdInt = 100;
}

问题:如何复制代码对齐的分配?

到目前为止没有什么效果:

使用Better Fixed Mixed tabs 确实有所帮助,因为大多数空格都被制表符替换(确实可以正确复制/粘贴)。但是,在复制粘贴时,剩余的空格仍然会导致格式混乱。

【问题讨论】:

  • 在您的博客或论坛中,您需要使用等宽字体
  • @Alberto,你是对的,谢谢。事后看来,这很明显,但我没有考虑过这种选择。感谢您指出。您能否将您的评论变成答案,然后我可以将此问题标记为已解决。

标签: c# visual-studio-2010 visual-studio


【解决方案1】:

在您的博客或论坛中,您需要使用等宽字体

【讨论】:

    猜你喜欢
    • 2016-02-20
    • 2018-02-16
    • 2021-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多