Skip to main content
A newer version of this page is available. .

Paste Formatting

  • 2 minutes to read

ASPxHtmlEditor provides the capability to automatically format pasted HTML content based on the ASPxHtmlEditorHtmlEditingSettings.PasteMode property, which can be set in one of the following values.

  • SourceFormatting - The formatting of the pasted content is retained. A style definition that is associated with the copied text is copied to the destination document.
  • MergeFormatting - The formatting of the pasted content is mostly discarded. However, emphasis formatting, such as bold and italic text, is retained. The content takes on the style characteristics of the paragraph where it is pasted. The content also takes on any direct formatting or style properties of the element that immediately precedes the cursor when the content is pasted.
  • PlainText - The formatting of the pasted content and non-text elements, such as pictures or tables, is discarded. The text takes on the style characteristics of the paragraph where it is pasted and takes on any direct formatting or character style properties of text that immediately precedes the cursor when the text is pasted. Graphical elements are discarded, and tables are converted to a series of paragraphs.

End-users can change formatting of the pasted HTML content using paste options bar buttons, which appear in the top right corner of the design area after content is pasted. By default, this functionality is disabled. Set the ASPxHtmlEditorHtmlEditingSettings.EnablePasteOptions property to true to enable it.

EUD_HtmlEditor_optionsButtons

Additionally, the pasted HTML content can be formatted in code using the client-side ASPxClientHtmlEditor.BeforePaste event. It is raised before an HTML markup is pasted to the editor. The event argument ASPxClientHtmlEditorBeforePasteEventArgs.html property returns the pasted HTML markup and allows you to customize it.

See Also