I'm such a geek. I
create my own tools if I feel the current tool does not meet my needs or when I'm super-annoyed by it.
Usually I use CopySourceAsHtml to post codes on my blogs. But it just doesn't cut it.
Then I use to Copy from Visual Studio to Microsoft Word, then Copy it back to Community Server blog. Again, the html Word generates is just annoying.
So then I put on my programmer's hat, and I happily code for 2 days, sometimes forgetting to eat, just to create this ultimate tool:
A Visual Studio Addin to Copy Paste your Codes into Community Server Blogs (did u catch that, oh Googlebot?)
** Scroll all the way down to download my Addin from the Post Attachment.
All you have to do is select your codes, right-click and choose "Copy for Community Server":
And then Paste it on your Community Server Blog Post Editor.
Lo and behold, your code will appear as such:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
TextSelection sel = (TextSelection) _applicationOb

ject.ActiveDocument.Selection;
if (sel !=
null)
{
string code = FitToColumns(sel.Text);
StringBuilder sb =
new StringBuilder();
sb.Append(
"<div style=\'background-color:#ffff
ff;font-family:'Courier New', Courier, monospace;f
ont-size:10pt\">");
code = FormatWhitespace(code);
code = FormatKeywords(code);
code = FormatComments(code);
code = FormatString(code);
sb.Append(code);
sb.Append(
"</div>");
code = WrapCodes(sb.ToString());
ZClipboard.CopyAsHtml(code);
}
Installation Steps:
- Download Zeddy-CopyForCS.zip from the Post Attachment below.
- Extract all contents to \My Documents\Visual Studio 2005\Addins
- Open Visual Studio 2005. Go to Tools | Add-in Manager, and enable CopyForCS.
Only works for Visual Studio 2005 Standard and upwards... Visual Studio Express don't support Add-ins, sorry.
Now that it's released, I can eat 3 times a day again...and be reminded that I have a wife 