- 2 minutes to read
ASPxHtmlEditor includes the capability to automatically format pasted HTML content based on the ASPxHtmlEditorHtmlEditingSettings.PasteMode property, which can be set to one of the following values:
- SourceFormatting - The format of the pasted content is retained. The destination document gets a style definition associated with the copied text.
- MergeFormatting - The format of the pasted content is mostly discarded. However, emphasis formatting (such as bold and italic text) is retained. The content adopts the style characteristics of the paragraph where it is pasted. The content also applies any direct format or style properties of the element that precedes the cursor when the content is pasted.
- PlainText - The format of the pasted content and non-text elements (such as pictures or tables) is discarded. The text adopts the style characteristics of the paragraph where it is pasted and applies direct formatting or character style properties of the text that precedes the cursor. Graphical elements are discarded, and tables are converted to a series of paragraphs.
Users can use the paste option bar’s buttons to change the format of the pasted HTML content. These buttons appear in the top-right corner of the design area after content is pasted. This functionality is initially disabled. Set the ASPxHtmlEditorHtmlEditingSettings.EnablePasteOptions property to
true to enable it.
Additionally, you can handle the client-side ASPxClientHtmlEditor.BeforePaste event to format the pasted HTML content. This event fires before HTML markup is pasted to the editor. The event argument’s ASPxClientHtmlEditorBeforePasteEventArgs.html property returns the pasted HTML markup and allows you to customize it.