officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-dot-appenddocumentcontent-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-documentrange-x29.md
Appends content from the specified range.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
DocumentRange AppendDocumentContent(
DocumentRange range
)
Function AppendDocumentContent(
range As DocumentRange
) As DocumentRange
| Name | Type | Description |
|---|---|---|
| range | DocumentRange |
A DocumentRange to append.
|
| Type | Description |
|---|---|
| DocumentRange |
A DocumentRange representing a range with the appended content.
|
The AppendDocumentContent method inserts the specified document range at the end of the main document.
The appended text starts with a new paragraph and preserves formatting. It is appended to an existing section and gets all section details (header, footer, page and print layout).
When the content being inserted is divided into sections, the inserted and destination sections interact as follows:
If the content is copied without section properties (the last section’s paragraph is not included), the destination section’s settings stay intact after insertion.
If the text being inserted contains document styles which are not present in the current document, the styles are copied to the resulting document.
The content’s floating objects, such as pictures or text boxes, are inserted into the corresponding positions in a newly created range. The Shape.Range property of a floating object determines whether it falls within the range being inserted and will therefore be added to the resulting document.
The following code snippets (auto-collected from DevExpress Examples) contain references to the AppendDocumentContent(DocumentRange) method.
Note
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.
winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L283
documentServer.LoadDocument(fs, DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
richEdit.Document.AppendDocumentContent(documentServer.Document.Range);
}
word-document-api-examples/CS/CodeExamples/BasicActions.cs#L62
// Insert the page content to the instance.
tempWordProcessor.Document.AppendDocumentContent(mainBodyRange);
// Delete the first empty paragraph.
winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/CS/Form1.cs#L41
richEditControl1.CreateNewDocument();
richEditControl1.Document.AppendDocumentContent(server.Document.Range);
}
winforms-richedit-layout-api/CS/Form1.cs#L102
srv.CreateNewDocument();
srv.Document.AppendDocumentContent(richEditControl1.Document.Selection);
int pageCount = srv.DocumentLayout.GetPageCount();
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Shapes.cs#L83
// Append the second paragraph of the main document to the boxed text.
DocumentRange newRange = boxedDocument.AppendDocumentContent(document.Paragraphs[1].Range);
boxedDocument.Paragraphs.Insert(newRange.Start);
winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L290
documentServer.LoadDocument(fs, DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
richEdit.Document.AppendDocumentContent(documentServer.Document.Range)
End Using
word-document-api-examples/VB/CodeExamples/BasicActions.vb#L59
' Insert the page content to the instance.
tempWordProcessor.Document.AppendDocumentContent(mainBodyRange)
' Delete the first empty paragraph.
winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/VB/Form1.vb#L32
richEditControl1.CreateNewDocument()
richEditControl1.Document.AppendDocumentContent(server.Document.Range)
End Sub
winforms-richedit-layout-api/VB/Form1.vb#L84
srv.CreateNewDocument()
srv.Document.AppendDocumentContent(richEditControl1.Document.Selection)
Dim pageCount As Integer = srv.DocumentLayout.GetPageCount()
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Shapes.vb#L75
' Append the second paragraph of the main document to the boxed text.
Dim newRange As DevExpress.XtraRichEdit.API.Native.DocumentRange = boxedDocument.AppendDocumentContent(document.Paragraphs(CInt((1))).Range)
boxedDocument.Paragraphs.Insert(newRange.Start)
See Also