views:

3257

answers:

7

We are looking for a WYSIWYG editor control for our windows application (vb.net or c#) so that users can design HTML emails (to send using the SMTP objects in the dot net framework) before sending.

Currently all the available editors we can find have one of the following issues:

a)They rely on mshtml.dll or the web browser control which as proven for us to be unreliable as the html code and the editor get out of sync under windows 2000 (IE6)

b)They are web based not a windows form control

c)They place styles in the head of the document (see note below).

Unfortunately as this HTML email article descries the only sure way of making HTML emails to work with styles is to use them inline which now seems to be unsupported in many editors.

Does any one have any experience in this or could suggest a solution.

+1  A: 

I also needed a WYSIWYG editor for a Windows Forms project that I was working on. I wrote about the items that I found here. Eventually, I ended up using something that I found on CodeProject: A Windows Forms based text editor with HTML output. This does violate (a) above in that it uses the WebBrowser control. However, I couldn't find anything good that didn't do this (if you don't use the WebBrowser in some way, then you basically have to right your own HTML parser and renderer in order to handle the "What-You-See" part of WYSIWYG). The good thing about this control is that the source is easily customizable, so you can take away and add formatting options as you need (and if you want the styles to all be in-line, you can do this as well).

Yaakov Ellis
+1  A: 

I've been using this one, which goes a little lower than the WebBrowser, but still uses MSHTML, which does spit out some ugly HTML. For my purposes, I am doing a multi-tabbed editor with WYSIWYG and HTML edit mode (using ICSharp.TextEditor) with a Buffer class to update whenever tabs change. As part of that Buffer class, I actually run the HTML through HTML Tidy and a few scrub-n-replace bits to get valid XHTML.

I only offer that as a solution because I, too, failed to find one that wasn't derived from MSHTML in some way and eventually just went ahead with the above solution to keep moving forward.

J Wynia
A: 

The sourcecode by nikhil provides a decent solution. I downloaded this little component sometime back, i think it uses MSHTML. But i am not sure on that. The source can downloaded here. Let me know if it helps :)

vikramjb
A: 

You didn't mention if you're willing to pay for a control, but if you are I recommend Actipro SyntaxEditor.

aphoria
A: 

Hi group, i have used a combination of a) and b)

:-)

I have used a wrapper around mshtml and tinymce in the webeditor...

http://peitor.blogspot.com/2007/12/great-windows-forms-html-control.html

screenshots included.

I think you should give that control a try.

Peter

A: 

Instead of searching for an HTML editor, consider the option of a RichText editor (which can be much easier to create) and then convert the final text into a HTML document.

Provided you are required to use a minimal set of features (bold / italics etc) both the creation of the RT editor and the conversion of the final document into HTML format shouldn't be hard.

If, on the other hand, you need to use more features (such as tables), you need to study the Rich Text Format and implement the features you need.

Additional resources:

Anax
A: 

There is this HTML Edit Control for .NET (disclosure: I wrote it).

It doesn't rely on any web browser; it's a Windows form control; and, it can cope with the style= attribute.

It's not exactly what you want: because it's designed for WYSIWYM, the toolbar doesn't have buttons to edit inline styles (although its rendering engine will render inline styles), the toolbar lets you specify only block-level elements like <p> and <h1> and <ul> and <table>; but if you wanted to, you could ask me about adding functionality (as described in the Developing New Functionality section).

ChrisW
Or instead of needing me to implement new functionality, you could not display my built-in toolbar and implement/display your own instead: use your new toolbar and my existing API to edit the document, and my existing HTML control to render/display the edited document in real time.
ChrisW