Click here to Skip to main content
14,151,118 members
Rate this:
Please Sign up or sign in to vote.
I'm writing a desktop application that uses the WebBrowser control as a WYSIWYG HTML editor. This is done by casting the control's property Document.DomDocument to the interface IHTMLDocument2 and setting the resulting object's designMode to "On". There is a lot of information on how to do this on the web, if anyone is interested.

I have added stylesheets to the source (with the interface's method createStyleSheet) so that the editor's content is rendered the same as it will be rendered on our website. This works perfectly, except for one remaining issue.

All of the master pages on our website use the doctype XHTML 1.1. The editor insists on using the doctype HTML 4.0 Transitional. This is resulting in some annoying differences in how the content is getting rendered between the editor and the website. I have tried various ways to change the doctype of the WebBrowser control, from using the interface's write command to a complete overwrite of the control's DocumentText; the doctype stubbornly remains transitional.

Does anyone have a suggestion on what I can try next?
Could you explain why would you go in for old and ugly COM software while having perfect support of XML in .NET?
Gregory Gadow 1-Mar-12 17:27pm
The project is for a desktop content publisher app, where users unskilled with HTML can compose and edit rich text documents for our website. The app stores the content to a database along with various meta-data, and the content publishing infrastructure on the website picks up from there. This app replaces a much clumsier, less flexible web-based system (not my work) that has been in place for several years. The content database has over 1400 articles that must be backwards supported.

Given the lack of affordable WYSIWYG HTML editor components, I made the decision to use the System.Windows.Forms.WebBrowser component reset into editor mode.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 1 Mar 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100