CopySourceAsHtml (Updated)
I've released CopySourceAsHtml version 1.2.1 with a change suggested by Jonathan Greensted and with a lot of little fixes for myself.
CopySourceAsHtml 1.2.1 Installer (284 KB) (built and tested on VS.NET 2003)
CopySourceAsHtml 1.2.1 Source (33 KB)
CSAH now has a "Remove Indentation" checkbox on the "General" tab. If it's checked, CSAH will remove unnecessary indentation from the copied code, leaving it flush against the left border. CSAH now also:
- adds itself to the Edit menu. This is configurable through the "Add-In" tab.
- adds itself to the Edit and context menus underneath the Copy command.
- generates cleaner, lighter HTML in a few common cases, saving bandwidth.
- handles invalid VS.NET-produced RTF without crashing.
- handles background colors correctly.
- has hotkeys on most items in the dialog.
- has cleaner code.
Besides "Remove Indentation", I'm most excited about fixing the problems with background colors, because it means I can stop testing with these colors and change my settings back to the defaults:
Visual Studio .NET:

HTML:
32 #region Configuration Class Definitions
33 #region Enum Definitions
34 /// <summary>
35 /// Enum containing the mode options for the exceptionManagement tag.
36 /// </summary>
37 public enum ExceptionManagementMode
38 {
39 /// <summary>The ExceptionManager should not process exceptions.</summary>
40 Off,
41 /// <summary>The ExceptionManager should process exceptions. This is the default.</summary>
42 On
43 }
Ugh! :)
Colin
10:38 PM | Colin

Comments
# RE: CopySourceAsHtml (Updated)
Another quick and dirty way is to copy first in Word and then in HTML editor. It works!!
09:52 AM | Shital Shah
# RE: CopySourceAsHtml (Updated)
Shital:
The two solutions are actually very similar. CSAH and Word both convert Visual Studio .NET's RTF to HTML. CSAH just does a better job of it because:
- it only needs to understand a small subset of the RTF standard (Word presumably understands the whole thing),
- it only needs to generate simple HTML (Word has to be able to save all sorts of complicated style and layout information as HTML),
- it can work around invalid RTF from VS.NET,
- it can get style information from VS.NET's font and color settings,
- it can get line numbers from the active document,
- with everything parsed into objects in memory, it can do all sorts of postprocessing, like adding line numbers, removing indentation, hyperlinking URLs, highlighting breakpoints, etc,
- it doesn't need to open Word. :)
10:25 AM | Colin