Skip to content

IImportContent

Dustin Horne edited this page Mar 5, 2026 · 1 revision

IImportContent

Namespace: ParentElement.RichText.Core.Abstractions.IO

Contract for importing external content into a document. Implemented by ImporterBase and its concrete subclass RtfImporter.

public interface IImportContent

Methods

Method Returns Description
ImportAsync(IDocumentController, Stream) Task Read content from a stream and load it into the document
ImportAsync(IDocumentController, string) Task Read content from a file path and load it into the document

Usage

IImportContent importer = new RtfImporter();

// Import from a file
await importer.ImportAsync(editor, @"C:\Documents\report.rtf");

// Import from a stream
using var fs = File.OpenRead("report.rtf");
await importer.ImportAsync(editor, fs);

Note: Import replaces the current document content. Call editor.ClearDocument() first if you want to start from a clean state, or let the importer handle it.


See also: IExportContent · IO · IDocumentController

Clone this wiki locally