Skip to main content

CopyPasteOptions.InsertOptions Property

Gets or sets options specifying how formatting is applied to pasted content.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v23.2.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

[DefaultValue(InsertOptions.MatchDestinationFormatting)]
public InsertOptions InsertOptions { get; set; }

Property Value

Type Default Description
InsertOptions MatchDestinationFormatting

An InsertOptions enumeration member indicating how formatting is applied to the formatted text inserted into a document.

Available values:

Name Description
KeepSourceFormatting

Retains character styles and direct formatting (font size, emphasis, etc.) applied to the inserted text.

MatchDestinationFormatting

Retains direct formatting (font size, emphasis, etc.) applied to the inserted text, but ignores all style properties.

UseDestinationStyles

Retains styles associated with the target document when style definition conflicts occur.

KeepTextOnly

Removes all formatting and non-text elements (pictures, shapes, comments, etc.).

MergeFormatting

Changes the formatting so that it matches the text that surrounds the inserted content.

Property Paths

You can access this nested property as listed below:

Object Type Path to InsertOptions
RichEditControlOptionsBase
.CopyPaste .InsertOptions

Remarks

Important

The InsertOptions property value is ignored when inserting to the document header or footer.

The table below shows how formatting is applied to the pasted document elements depending on the InsertOptions property value:

Enumeration Value

Direct Formatting

Styles (character, paragraph, table)

Non-textual objects (tables, floating objects, comments, etc.)

Page Properties and Tabs

InsertOptions.KeepSourceFormatting

The copied text retains its formatting.

New styles (styles that don’t exist in the target document) are copied. If character or paragraph style conflict occurs, all inserted style’s properties are applied as direct formatting, but the style itself is not transferred. Destination’s styles with default settings are substituted with inserted styles. Conflicted table and numbering list styles are copied to the document. The style name is a combination of conflicted styles’ names (e.g., Normal1 and Normal1 are combined into_Normal11_).

Non-textual elements are retained.

All page properties are retained.

InsertOptions.KeepTextOnly

The inserted text loses its formatting and takes on direct formatting applied to the target text range. Numbering lists are converted to simple text.

All inserted styles are not retained.

Floating objects, shapes and comments are discarded. Tables are converted into a series of paragraphs.

All page properties, including tabs, are lost.

InsertOptions.MergeFormatting

The inserted text retains the following character properties:

Other character properties and all paragraph properties are ignored.

Inserted style’s character properties are applied as direct, but the style itself is not copied to the target document. Style paragraph properties are ignored. Table styles are not retained. Numbering list styles are transferred to the target document.

Non-textual elements are retained.

Page properties are retained. Tabs are ignored.

InsertOptions.UseDestinationStyles

The copied text keeps its format options.

New styles (styles that don’t exist in the target document) are copied. If style conflict occurs, the inserted content’s styles are ignored. Destination’s styles with default settings are substituted with inserted styles.

Non-textual elements are retained.

All page properties are retained.

See Also