Table of Contents

Method GetElementsRecursively

Namespace
MigraDoc.DocumentObjectModel.Visitors
Assembly
MigraDoc.DocumentObjectModel.dll

GetElementsRecursively(DocumentObject, bool)

Gets the elements/sections/rows/cells of a DocumentObject recursively.

public static IEnumerable<DocumentObject?> GetElementsRecursively(this DocumentObject documentObject, bool includeHeaderFooter = false)

Parameters

documentObject DocumentObject

The DocumentObject.

includeHeaderFooter bool

Shall headers and footers also be returned. No effect for DocumentObjects that neither are nor contain Sections.

Returns

IEnumerable<DocumentObject>

GetElementsRecursively(DocumentObject, List<Type>, bool, bool)

Gets the elements/sections/rows/cells of a DocumentObject recursively, stopping recursion at elements of the Types listed in stopAtItems.

public static IEnumerable<DocumentObject?> GetElementsRecursively(this DocumentObject documentObject, List<Type> stopAtElements, bool includeStoppingElements = false, bool includeHeaderFooter = false)

Parameters

documentObject DocumentObject

The DocumentObject.

stopAtElements List<Type>

A list with types the recursion shall stop at.

includeStoppingElements bool

If false, the stopping element and its children are not returned. If true, the stopping element is returned, but its children are not.

includeHeaderFooter bool

Shall headers and footers also be returned. No effect for DocumentObjects that neither are nor contain Sections.

Returns

IEnumerable<DocumentObject>

GetElementsRecursively<T>(DocumentObject, bool)

Gets the elements/sections/rows/cells of Type T of a DocumentObject recursively.

public static IEnumerable<T> GetElementsRecursively<T>(this DocumentObject documentObject, bool includeHeaderFooter = false) where T : DocumentObject

Parameters

documentObject DocumentObject

The DocumentObject.

includeHeaderFooter bool

Shall headers and footers also be returned. No effect for DocumentObjects that neither are nor contain Sections.

Returns

IEnumerable<T>

Type Parameters

T