I’ve been busy at work lately one of the projects assigned to me is to create an application to redact and edit emails that will be sent to customers. This provided a great opportunity for me to get familiar with creating a custom control in C#. I needed a way to create rich content and although C# has the rich text control it provides everything in RTF which is difficult to work with and hard to embed. So I got to work on my very own WYSIWYG control that produces HTML. So I am making it open source and available to anyone have fun and enjoy if you make any cool modifications to it let me know. I would love to include spell check ability but I don’t have much time to work on it right now.

Download Here HTMLWYSIWYG
wysiwyg

Sample Uses

 private void button1_Click_1(object sender, EventArgs e)
 {
 //Gets the HTML Code generated by the control
 Console.WriteLine( htmlwysiwyg1.getHTML())
 //Getts the PLain Tex code generated by the control.
 Console.WriteLine(htmlwysiwyg1.getPlainText());
 }
 
 private void frm_main_Load(object sender, EventArgs e)
 {
 //Sets the control to allow edits
 htmlwysiwyg1.allowEdit(true)
 //Loads the HTML into the control
 htmlwysiwyg1.setHTML("<B>BOLD</B>");
 //Loads aditional fonts into the control
 htmlwysiwyg1.addFont("Cambria");
 }
 
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Slashdot

3 Responses to “VS 2008 C# WYSIWYG HTML Editor”

  1. alan328 says:

    Nice work !

    I like it !

    But the AssemblyInfo.cs and Resources.resx are missing !

    Can you email them to me? Thanks a lot !

  2. Jose C Gomez says:

    Alan,
    Thanks for the heads up I have fixed it and uploaded a new one.

  3. Jeff Williams says:

    I have downloaded your html editor but cannot get it to work. It has and error as below. Do you have any ideas why.

    System.NullReferenceException: Object reference not set to an instance of an object.
    at HTMLWYSIWYG.htmlwysiwyg.setHTML(String html) in d:\Projects\CSharp\Third Party\HTMLWYSIWYG\HTMLWYSIWYG\htmlwysiwyg.cs:line 48

    public void setHTML(String html)
    {
    doc.body.innerHTML = html;
    }

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>