Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

How to: Change settings in CopySourceAsHtml for use with Community Server

I've been using CopySourceAsHTML for some time now to add source code to my blog posts. Until recently, you could find it on GotDotNet.Com. But that site has now shut-down. Fortunately, the author sent me the new link for a download of this excellent tool.

I know a lot of you have trouble setting it up when using it to copy source code to your Community Server blog. I therefor updated this blog post with the correct URL's and moved it back to the top of my blog posts. This blogpost describes the settings I currently have and that allow me to quickly paste code into my blog.

After installing CopySourceAsHTML, you get the option "Copy as HTML.." when you right-click on a selection in your code. When you choose that option, you get the following window:

CopySourceAsHtml.JPG

Here you see my current default settings. When you change your settings to match these you can use my CSS code. In the File Style Tab, add the following css overrides:

border-top: windowtext 1pt solid;
border-top-color: #CCCCCC;
padding-top: 1pt;
border-left: windowtext 1pt solid;
border-left-color: #CCCCCC;
padding-left: 1pt;
border-right: windowtext 1pt solid;
border-right-color: #CCCCCC;
padding-right: 1pt;
border-bottom: windowtext 1pt solid;
border-bottom-color: #CCCCCC;
padding-bottom: 1pt;
width: 100%;
overflow: auto;
background-color: #F5F5F5;

Click OK and you're ready. You have the HTML for the code you selected in your clipboard and you can paste it directly in your blog post.That's all. Your code looks great, as you can see in this example, you get scroll bars when it doesn't fit the browser window width and, of course, syntax highlighting.

These settings work for both VS 2003 and VS 2005. Since it relies completely on the CSS information above, it will not interfere with other stuff.

If you want to limit the height of your <div> section, then this is of course no problem. Simply change the HTML for the blogpost and do something like this:

<div style="HEIGHT: 150px">

Comments

Community Server Daily News said:

news of the day a grab bag for what&#39;s happening in Community Server ASPnix goes All Community Server
# July 31, 2006 1:01 PM

Dennis van der Stelt said:

Community Server just keeps getting better and better, providing more features then I could even imagine
# August 14, 2006 5:56 AM

Mike's Blog said:

Introduction CopySourceAsHTML will give you an error while using it in a Microsoft Virtual PC (I'm probably
# November 6, 2006 12:16 PM

Daily News Faq List said:

Jan Schreuder on changing the settings in CopySourceAsHtml for best use with Community Server.
# November 22, 2006 8:38 AM

Community Server Bits said:

Jan Schreuder on changing the settings in CopySourceAsHtml for best use with Community Server.

# March 12, 2007 8:47 AM