Version

Serialization Providers Overview (xamRichTextEditor)

Topic Overview

Purpose

This topic explains the xamRichTextEditor ™ control’s serialization providers.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides an overview of the features supported by the xamRichTextEditor control.

This topic explains the document’s content logical structure you can use to edit the contents in the xamRichTextEditor programmatically.

This topic provides detailed instructions to help you get up and running as quickly as possible with the xamRichTextEditor .

Introduction

Serialization Providers summary

The xamRichTextEditor control supports a flexible architecture based on serialization providers, which allows the import and export of different rich content formats. These are the abilities the xamRichTextEditor gains when a new serialization provider is added:

  • You can use the RichTextDocument control’s Load or Save methods for importing and exporting rich content by specifying a particular serialization provider. The external serialization providers supplied by Infragistics also define extension methods for RichTextDocument to load and save documents in specific formats. More information about this is available later in the Related Content section.

  • The clipboard cut or copy operations adds the content to the clipboard in all internal content formats supported by the xamRichTextEditor (various plain text formats) plus the format(s) provided by the external serialization providers.

  • The clipboard paste operation is using external serialization providers to obtain and deserialize the clipboard’s content. A description of how to define a format’s priority as the one chosen for deserialization appears later in this topic.

The following table lists the internal serialization providers of the Infragistics.WPF.RichTextDocument NuGet package and their supported content formats used by the xamRichTextEditor when reading or writing data to the clipboard:

Serialization Provider Format Description

System.String

Text content in ANSI format

UnicodeText

Text content in Unicode format

Text

Text content in ANSI format

DIB

Device Independent Bitmap

Note
Note

The ImageSerializationProvider only supports loading of the Device Independent Bitmap format for images from the clipboard. It cannot load or save documents or save content to the clipboard.

The following table lists the serialization providers located in additional NuGet packages and their respective formats:

NuGet Package / Serialization Provider Format Description

Infragistics.WPF.RichTextDocument.Rtf

Rich Text Format

Rich content in Rich Text Format

Infragistics.WPF.RichTextDocument.Word

Embed Source

Rich content in MS Word (docx) format

Serialization Providers Configuration Summary

Serialization providers configuration summary chart

The following table briefly explains the configurable aspects of the xamRichTextEditor control and maps them to their respective properties.

Configurable aspect Details Properties

Add external serialization providers to the xamRichTextEditor .

Set a formats priority to be used when obtaining data from the clipboard.

Add Serialization Providers

Overview

You can add external serialization providers in the xamRichTextEditor control’s ClipboardSerializationProviders property that allows the xamRichTextEditor to support additional formats for adding and obtaining content on the clipboard.

Property settings

The following table maps the desired configuration to its respective property settings.

In order to: Use this property: And:

Add external serialization provider

ClipboardSerializationProviders

Add the external serialization provider

Example

The code snippet below demonstrates how to add the RTF and Word external serialization providers:

In XAML:

<ig:XamRichTextEditor>
    <ig:XamRichTextEditor.ClipboardSerializationProviders>
        <ig:PlainTextSerializationProvider />
        <ig:ImageSerializationProvider />
        <ig:RtfSerializationProvider />
        <ig:WordSerializationProvider />
    </ig:XamRichTextEditor.ClipboardSerializationProviders>
</ig:XamRichTextEditor>

In C#:

this.xamRichTextEditor1.ClipboardSerializationProviders.Add(
    PlainTextSerializationProvider.Instance);
this.xamRichTextEditor1.ClipboardSerializationProviders.Add(
    ImageSerializationProvider.Instance);
this.xamRichTextEditor1.ClipboardSerializationProviders.Add(
    RtfSerializationProvider.Instance);
this.xamRichTextEditor1.ClipboardSerializationProviders.Add(
    WordSerializationProvider.Instance);

In Visual Basic:

Me.xamRichTextEditor1.ClipboardSerializationProviders.Add(PlainTextSerializationProvider.Instance)
Me.xamRichTextEditor1.ClipboardSerializationProviders.Add(ImageSerializationProvider.Instance)
Me.xamRichTextEditor1.ClipboardSerializationProviders.Add(RtfSerializationProvider.Instance)
Me.xamRichTextEditor1.ClipboardSerializationProviders.Add(WordSerializationProvider.Instance)

Set Formats Priority

Overview

Use the ClipboardFormats property for setting the order in which to apply the various formats, from the list of supported formats, to use when importing data from the clipboard. The formats are considered in the order they are specified on this property. Obtain the exact format name using the SupportedClipboardFormats properties of each serialization provider. Only the formats listed in the ClipboardFormats property are used to save or load content on the clipboard. By default, the clipboard contains all formats supported by the internal and external serialization providers supplied by Infragistics in a default preferred order.

Property settings

The following table maps the desired configuration to its respective property settings.

In order to: Use this property: And set it to:

Set formats priority

ClipboardFormats

A comma separated list of formats in the preferred loading order.

Example

The code snippets below demonstrate how to set a format priority:

In XAML:

<ig:XamRichTextEditor ClipboardFormats="Rich Text Format, Text">
    <ig:XamRichTextEditor.ClipboardSerializationProviders>
        <ig:RtfSerializationProvider />
        <ig:WordSerializationProvider />
    </ig:XamRichTextEditor.ClipboardSerializationProviders>
</ig:XamRichTextEditor>

In C#:

this.xamRichTextEditor1.ClipboardSerializationProviders.ClipboardFormats =
    "Rich Text Format, Text";

In Visual Basic:

Me.xamRichTextEditor1.ClipboardSerializationProviders.ClipboardFormats = _
    "Rich Text Format, Text"

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to import and export plain text data using the xamRichTextEditor control.

This topic explains how to use the xamRichTextEditor control for importing and exporting RTF data.

This topic explains how to use the xamRichTextEditor control for importing and exporting DOCX formatted data.