SubDocument.InsertDocumentContent(DocumentPosition, String, DocumentFormat) Method
Inserts content from the file in the current document at the specified position.
NuGet Package: DevExpress.RichEdit.Core
A DocumentPosition specifying the position in the current document, after which content is inserted.
A string representing a filename of the document whose content is being inserted.
A DocumentFormat enumeration specifying the format of the data contained in the file.
A DocumentRange representing the document range with inserted content.
The InsertDocumentContent method imports the specified file into the internal document model. If the format parameter is set to DocumentFormat.Undefined, the importer attempts to auto detect the format of the specified file.
If the format auto detect fails, a fallback format is used. Currently the fallback format is plain text.
After the file is successfully imported, the new document model is inserted at the specified position of the main document.
The inserted text starts with a new paragraph and preserves formatting. It is inserted into an existing section and gets all section details (header, footer, page and print layout).
If the text being inserted contains document styles which are not present in the current document, the styles are copied to the resulting document.
If the document whose content is being inserted contains floating objects, such as pictures or text boxes, they are inserted into the corresponding positions in a newly created range.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the InsertDocumentContent(DocumentPosition, String, DocumentFormat) method.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.