Click here to Skip to main content
Click here to Skip to main content

WYSIWYG HTML Editor

By , 6 Jan 2006
 

Sample Image

Introduction

I have found different code samples showing how to create a visual HTML editor in ASP using a text area. However, I needed a good editor for my WinForms application, but I couldn’t find a good example. Eventually, I wrote one from scratch after I converted some MFC code I found on the net. Based on the IE Browser control, you can create a powerful editor that allows you to manipulate HTML tags visually and add any tags you want.

Using the code

The code is a simple form, and very easy to understand. In order to make it work, you first need to include two COM libraries:

  1. The Microsoft Web Control found in: c:\windows\system32\shdocvw.dll (add as a COM control).
  2. MSHTML: c:\windows\system32\MSHTML.tlb (add as a COM reference).

The reason for the tlb is that the mshtml.dll is used by the Windows system, and therefore is not accessible.

You don't need to worry about deployment: all Windows users will have these DLLs in their system directory.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Shlomo Schwarcz
Web Developer
Israel Israel
Shlomo had worked for several years as a software engineer and project manager, developing software for the enterprise market, in Microsoft.NET and Java J2EE environment. Before establishing Shefer’s SAP department, Shlomo worked at SAP Labs and took part of the NetWeaver and Enterprise Portal development team.
 
Shlomo has many years of experience with SAP customers and has also teaches official SAP courses around the world.
 

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 1memberSkySoftHelper9-May-11 19:01 
GeneralCongratulations on the good workmemberRene.DH18-Apr-09 10:43 
Question[BR /] instead of [P/]?memberaj3212-Jun-08 14:18 
AnswerRe: [BR /] instead of [P/]?memberraiserle21-Dec-11 10:34 
QuestionCan I insert tables?memberDrucik_20-Apr-08 13:02 
Hello,
 
Can I insert tables? If yes, how can I do it? D'Oh! | :doh:
 
----------------------------------------------
When the sorrow takes me
I'm embracing the darkness alone
Please - take me home
 
[Embraced By Darkness - Saturnus]

AnswerRe: Can I insert tables?memberBITS_UK26-May-08 23:13 
Generalcopied imaged from ms word doesn't showmembernetJP12L23-Jan-08 11:21 
GeneralImages dont apprear when copied from Ms wordmembernetJP12L23-Jan-08 11:15 
GeneralThanks, just what I neededmembervictorbos1-Nov-07 3:21 
QuestionProblem with Deploy Different Version shdocvw.dllmembersebandres20-Feb-07 5:31 
QuestionHow can i insert a text in a given position?memberrespiratory10126-Sep-06 11:56 
AnswerRe: How can i insert a text in a given position?memberHenrik Thulin28-Jun-11 10:06 
Questionhow to change the language of the textmemberalihammad28-Aug-06 4:22 
QuestionWYSIWYG WORDmember123456uio9-Aug-06 3:16 
Questionwhere are html, title, head, meta tags ?memberRobcast229-Jun-06 0:38 
AnswerRe: where are html, title, head, meta tags ?memberRobcast229-Jun-06 4:00 
QuestionAdding EventsmemberAbhiTheGenius13-May-06 21:50 
AnswerRe: Adding EventsmemberShlomo Schwarcz13-May-06 22:33 
GeneralReferencememberDeathJester_26-Mar-06 9:50 
QuestionInvalidCastException Unhandledmemberpjrinaldi18-Feb-06 18:45 
AnswerI think I know the problemmemberShlomo Schwarcz18-Feb-06 20:46 
QuestionRe: I think I know the problemmemberpjrinaldi19-Feb-06 4:05 
AnswerRe: I think I know the problemmemberShlomo Schwarcz19-Feb-06 4:08 
QuestionRe: I think I know the problemmemberpjrinaldi19-Feb-06 5:03 
AnswerRe: I think I know the problemmemberpjrinaldi20-Feb-06 17:23 
GeneralRe: I think I know the problemmemberbrb55485-Feb-09 10:43 
GeneralBuild errormemberpietro7711-Jan-06 4:35 
GeneralRe: Build errormemberShlomo Schwarcz11-Jan-06 19:23 
GeneralRe: Build errormemberpietro7711-Jan-06 22:24 
GeneralRe: Build errormemberMulga24-Sep-09 19:14 
Generalasp.netmembermattraffel10-Jan-06 7:38 
GeneralRe: asp.netmembercadred10-Jan-06 11:51 
Generaldoc.execCommandmembersides_dale6-Jan-06 18:10 
GeneralRe: doc.execCommandmemberfwsouthern7-Jan-06 18:31 
GeneralRe: doc.execCommandmemberShlomo Schwarcz7-Jan-06 19:37 
GeneralFYI: HTMLEditor by Tim AndersonmemberMarc Sommer6-Jan-06 8:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130617.1 | Last Updated 6 Jan 2006
Article Copyright 2006 by Shlomo Schwarcz
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid