Visual Studio Add-Ins: Copy Source as HTML

Our next tool is very handy for those of us who blog, or perhaps just want to share code snippets with friends using HTML enabled e-mail. Copy Source as HTML, available at http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/ does just what it says. It takes the lines of source code you have highlighted in your Visual Studio editor and copies them to the clipboard as HTML.

For an example, I’ve pasted this simple HTML into my blog so you can see what it looks like. This is HTML text, not a picture:

 

    9 namespace WinTest1

   10 {

   11     public partial class Form1 : Form

   12     {

   13         public Form1()

   14         {

   15             InitializeComponent();

   16         }

   17     }

   18 }

 

 

There are several options, as you can see from the dialog below.

[Copy Source as HTML Options Dialog]

You can have line numbers (as I’ve done above), set the line number to start at, or omit them entirely. You can activate word wrap, over ride the default tab size, font and font size. If you’re a CSS guru there are even tabs for entering your own CSS for both the entire section (surrounded in DIV tags) or the individual line.

Another great free add-in, it has both 2005 and 2003 versions. If you ever need to convert your code to HTML this is a great, easy way to do it.

Advertisements

3 thoughts on “Visual Studio Add-Ins: Copy Source as HTML”

  1. Also… it seems that when I copy the code from your page to my clipboard, and then paste it into notepad, I get extra blank lines between each ‘real’ line of code.

    Is there any way to prevent this ?

  2. I had problems for a few days getting WordPress to show all the images. Not sure what the issue was, but today it seems to be working OK and I can see everything. Try again and let me know.

    As to the extra blanks, I imagine you can edit the CSS to not put the blank spacing in, but I haven’t tried it yet. When I get a free moment I fiddle with it, but if someone has done so already fixed this let us know!

    – ArcaneCode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s