SubDocument.InsertDocumentContent(DocumentPosition, Stream, DocumentFormat, InsertOptions) Method
Inserts content from the specified stream in the specified format, at the specified position, in the current document.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
#Declaration
DocumentRange InsertDocumentContent(
DocumentPosition pos,
Stream stream,
DocumentFormat format,
InsertOptions insertOptions
)
#Parameters
Name | Type | Description |
---|---|---|
pos | Document |
A Document |
stream | Stream | A Stream representing a sequence of bytes interpreted as the content to insert. |
format | Document |
A Document |
insert |
Insert |
An Insert |
#Returns
Type | Description |
---|---|
Document |
A Document |
#Remarks
The InsertDocumentContent method loads the specified stream into the internal document model with the help of the specific importer.
After the stream is imported successfully, the new document model is inserted at the specified position of the main document.
Specify the insertOptions parameter to define how formatting is applied to the formatted text inserted into a document. Refer to the InsertOptions enumeration description for information on how formatting is applied to the pasted document elements depending on the property value.
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.
When you pass the DocumentFormat.Undefined value as the format parameter, the inserted content’s format is determined automatically.