HTML Editor for Winforms
Zoople HTML Editor .NET for Winforms is a WYSIWYG HTML editor for .NET WinForms, frameworks 2.0 and up and .NET Core 5 (.NET 5).
Features
The component contains all the standard features found in stand-alone WYSIWYG HTML editors.
For example :
- Text modifications - Bold, Italicize, strike-thru, justification, font and color settings, indenting & outdenting
- HTML Tables - Can be inserted and modified, and the properties of rows and cells modified, rows and columns can be added and removed
- Formatted Source Code Editing - More advanced end users may edit the source code of the document.
- Cascading Style Sheets - HTML Elements may be assigned CSS psuedo-classes using a popmenu that displays all the CSS classes associated with a document and element type.
- DOM Toolbar - The editor features a HTML DOM Toolbar that displays and allows selection and modification of any HTML node in a branch of the current document
- Property Grid - allowing for the direct editing of HTML properties in a categorized form
- Access to the HTML DOM via the Document property - allows for iteration and manipulation of elements programmatically
- Fully customisable toolbars and context menus
- Inline spelling checking, highlighting and correction (additional license required - minimum version 1.6.1.0)
Installation
via nuget: Install-Package Zoople.HTMLEditor -Version 1.8.3.241
API
A brief overview of the HTML Editor for Winforms API.
Properties
CurrentElement
- returns IHTMLElement (COM)
The current selected IHTMLElement in the editable area of the control.
The current selected managed HTMLElement in the editable area of the control.
UseRelativeURLs
Enables the control to use URL references that are relative to the BaseURL property.
BaseURL
Returns or sets the base url for the document being editted. All relative paths for images and links placed into the HTML document will use the BaseURL property to resolve the URL
UseParagraphAsDefault
Use P tag as default seperator (Enter Key) otherwise use DIV
FontsList
Semi-colon delimted list of Fonts available to the end-user in WYSIWYG editing mode. Passing null defaults to system fonts.
ImageStorageLocation
Folder to store local images. All images inserted into the editor will be copied to this folder.
CSSText
Returns or sets the Cascading Style Style sheet information for the document being edited. The CSSText property will accept a well formed CSS text string. Class selectors, both global and element specific will appear in the DOM toolbar CSS styles list. Element specific selectors will only be applicable to <p> tags and global selectors to all elements (.test1 - as above). The CSSText value is not persisted in the DocumentHTML property of the control so you must include it with your email template, page snippet, final email etc before using it in you application.
LicenceKey
License Code for the HTML Editor.
InCodeView
Returns a boolean value indicating whether the editor in code view mode or WYSIWYG mode.
DocumentHTML
A string value for the HTML segement currently being edited in the control.
Document
- HTMLDocument (Reads-only)
HTMLDocument Interface for the current edited HTML segment.
A semi-colon seperated list of button names. When included in the list the named toolbar buttons are invisible.
tsbShowCode tsbPrint tsbCut tsbCopy tsbPaste tsbUndo tsbRedo tsbBold tsbItalic tsbUnderline tsbStrikeout tsbSuperscript tsbSubscript tsbRemoveFormatting tsbAlignLeft tsbAlignCentre tsbAlignRight tsbAlignJustify tsbOrderedList tsbUnorderedList tsbOutdent tsbIndent tsbInsertLink tsbRemoveLink InsertImageToolStripButton TableOptionsToolStripMenuItem tsbForeColor tsbBackColor FontToolStripComboBox FontSizeComboBox FormatSelectionCombo tsbElementProperties
UIControlsBackgroundColor
sets the background color of the UI - except the edit window which can controlled by redefining the background color of the BODY using the CSSText property
enables programmatic access to the tool strip items in the upper toolbar of the control.
ShowPropertyGrid
Show or hide the Property Grid for HTML elements.
HideMainToolbar
Show or hide the Main (upper) Toolbar.
Show or hide the DOM (lower) Toolbar.
AlwaysConvertNonASCIIChars
Forces the control to always convert non-ASCII characters to their HTML entity equivelents.
EditorEnabled
Disables/enables editing abilities in the control - combine with HideMainToolbar and HideDOMToolbar properties
Methods
cut_document()
Cuts the active selection in code view or WYSIWYG view to the clipboard.
copy_document()
Copies the active selection in code view or WYSIWYG view to the clipboard.
paste_document()
Pastes the clipboard contents to active selection in code view or WYSIWYG view.
InsertAtCursor(string HTMLText, ed_InsertType insertWhere)
Inserts HTML at the current cursor or selection position.
- ed_InsertAfterSelection - insert after the current selection
- ed_InsertBeforeSelection - insert before the current selection
- ed_InsertReplaceSelection - replace the current selection.
bold_document()
Adds or removes bolding from the current text selection in WYSIWYG view.
Italic_document()
Adds or removes italics from the current text selection in WYSIWYG view.
Underline_document()
Adds or removes underlines from the current text selection in WYSIWYG view.
Strikeout_document()
Adds or removes strikeout from the current text selection in WYSIWYG view.
Superscript_document()
Adds or removes superscript from the current text selection in WYSIWYG view.
Subscript_document()
Adds or removes subscript from the current text selection in WYSIWYG view.
Indent_document()
indents the current selection in WYSIWYG view.
Outdent_document()
Outdents the current selection in WYSIWYG view.
Justify_Left()
justifies left the current selection in WYSIWYG view.
Justify_Right()
justifies right the current selection in WYSIWYG view.
Justify_Center()
justifies center the current selection in WYSIWYG view.
Justify_Full()
justifies full width the current selection in WYSIWYG view.
removes markup specific formatting from the current selection in WYSIWYG view.
Insert_Link()
Opens the insert link dialog in WYSIWYG view.
Remove_Link()
removes hyperlink markup from the current selection in WYSIWYG view.
undo_document()
undoes the most recent change.
redo_document()
redoes the most recent change.
numbered_list()
Creates a ordered list ( <OL> ) containing the current selection if there is one.
unnumbered_list()
Creates a un-ordered list ( <UL> ) containing the current selection if there is one.
print_Document(boolean DontShowDialog)
Opens the standard windows print dialog allowing the currently edited document To be printed.
setFontNameOnSelection(string FontName)
sets the font face to be used on the current selection in WYSIWYG view.
setFontSizeOnSelection(string FontName)
sets the font size (1..7) to be used on the current selection in WYSIWYG view.
Events
AfterChangeEditingViews
- AfterChangeEditingViews(sender As Object, e As EventArgs)
Fires after changing to and from codeview to WYSIWYG editing modes
BeforeGetDocumentHTML
- BeforeGetDocumentHTML(object sender, BeforeGetDocumentHTMLEventsArgs e)
Raised before the retriveal of the DocumentHTML property. Modify BeforeGetDocumentHTMLEventsArgs htmlSource to change the value of DocumentHTML being retrieved
- CommandsToolbarButtonClicked(string ButtonIdentifier, ref Boolean Cancelled)
Used to override the deault actions of the built in toolbar buttons.
ButtonIdentifier = Unique ID of the button
Cancelled = set to true to implement your own code
CancellableUserInteraction
- CancellableUserInteraction(string InteractionType, ref Boolean Cancel)
Used to override the deault actions of the built in user interacxtions like keydown, mousedown, drag drop etc.
InteractionType = type of user interaction ("ondrop", "onkeydown", "onkeypress", "onmousedown", "onmouseup", "ondblclick", "onbeforepaste", "onbeforecopy", "onbeforecut")
Cancel = set to true to implement your own code or prevent the default action
ConfigurationError
- ConfigurationError(string ErrSource, string ErrDesc)
DocumentLoadComplete
- DocumentLoadComplete(object sender, EventArgs e)
Fires when the editor's HTML DOM creation is complete and accessible
OperationError
- OperationError(string ErrSource, string ErrDesc)
HTMLChanged
- HTMLChanged(object sender)