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.
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.
Several of the images in your last few posts seem to be missing.
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 ?
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