Glutton for punishment!
Although I liked the ease at which I could get my source code highlighted with the squishyWARE Syntax Highlighter component, I didn't like that is was VS.NET 2003 coloring. So I got the crazy idea of just pulling the RTF off the clipboard and converting that to HTML.
I spent a few hours last night and a couple of hours this afternoon writing a rudimentary RTF parser. It's ugly and doesn't support most of the RTF syntax, but it gets me some nicely formatted HTML from the RTF on the clipboard. Here's a sample:
private void Notify(RTFState current)
{
if (current.IsEmpty())
return;
switch (current.GroupType)
{
case GroupType.None:
if (ReadControlTag != null)
ReadControlTag(this, new ControlTagEventArgs(current));
break;
case GroupType.Start:
if (BeginGroup != null)
BeginGroup(this, new ControlTagEventArgs(current));
break;
case GroupType.End:
if (EndGroup != null)
EndGroup(this, new ControlTagEventArgs(current));
break;
}
}
But that's just using the default VS.NET 2005 fonts. Although I'm reading and parsing the RTF font table (\fonttbl), I'm not storing it or using it. I'm just lucky the default font is the same font used by the HTML <pre> tag! :)