Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Box

DocumentLayout.GetElement<T>(DocumentPosition) Method

Returns the layout element of the type designated by the specified generic type parameter which relates to the specified position in the document model.

Namespace: DevExpress.XtraRichEdit.API.Layout

Assembly: DevExpress.RichEdit.v19.1.Core.dll

Declaration

public T GetElement<T>(
    DocumentPosition position
)
    where T : RangedLayoutElement

Parameters

Name Type Description
position DocumentPosition

A DocumentPosition object that specifies the position in the document model.

Type Parameters

Name
T

Returns

Type Description
T

The layout element of the type designated by the specified generic type parameter.

Example

This code snippet checks whether the first table in the document is located on the second page.

Dim table As DevExpress.XtraRichEdit.API.Native.Table = richEditControl1.Document.Tables.First
If table IsNot Nothing Then
    ' Obtain the layout element related to the table.
    Dim ltable As LayoutTable = richEditControl1.DocumentLayout.GetElement(Of LayoutTable)(table.Range.Start)
    ' Obtain zero-based page index of the page containing the layout element.
    Dim pageIndex As Integer = Me.richEditControl1.DocumentLayout.GetPageIndex(ltable)
    ' Check whether the layout element is located at the second page.
    Dim s As String = "Layout verified."
    If pageIndex <> 1 Then
        s = "The first table is not on the page 2. Review pagination."
    End If
    MessageBox.Show(s, "Check Layout", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetElement<T>(DocumentPosition) 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.

See Also