SubDocument.InsertDocumentContent(DocumentPosition, String, DocumentFormat, String) Method
Inserts content from the file in the current document at the specified position.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.1.Core.dll
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation
Declaration
DocumentRange InsertDocumentContent(
DocumentPosition pos,
string fileName,
DocumentFormat format,
string sourceUri
)
Parameters
Name | Type | Description |
---|---|---|
pos | DocumentPosition | A DocumentPosition specifying the position in the current document, after which content is inserted. |
fileName | String | A string representing a filename of the document whose content is being inserted. |
format | DocumentFormat | A DocumentFormat enumeration specifying the format of the data contained in the file. |
sourceUri | String | A string representing the URI for the document being inserted. Required to import formats with external content, such as HTML. |
Returns
Type | Description |
---|---|
DocumentRange | A DocumentRange representing the document range with inserted content. |
Remarks
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. The sourceUri parameter is passed to the importer, to allow the importer to use it when required. If the HTML-specific importer is created, the sourceUri is used to find pictures and other external content, such as .css files.
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.