Back to Devexpress

GroupShapeCollection.Ungroup() Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-groupshapecollection.md

latest2.2 KB
Original Source

GroupShapeCollection.Ungroup() Method

Splits a group into individual shapes.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
IEnumerable<DrawingObject> Ungroup()
vb
Function Ungroup As IEnumerable(Of DrawingObject)

Returns

TypeDescription
IEnumerable<DrawingObject>

A collection of shapes retrieved from the group.

|

Remarks

The Ungroup method does not split nested groups into separate shapes. Call this method for each group individually.

The example below shows how to split all shape groups in the document (including nested groups):

csharp
using System.Linq;
// ...

Document document = wordProcessor.Document;
List<DrawingObject> groups = document.Shapes.Flatten()
    .Where(x => x.Type == ShapeType.Group)
    .ToList();
for (int i = groups.Count - 1; i >= 0; i--)
{
    groups[i].GroupItems.Ungroup();
}
vb
Imports System.Linq
' ...

Private document As Document = wordProcessor.Document
Private groups As List(Of DrawingObject) = document.Shapes.Flatten() _
        .Where(Function(x) x.Type = ShapeType.Group) _
        .ToList()
For i As Integer = groups.Count - 1 To 0 Step -1
    groups(i).GroupItems.Ungroup()
Next i

See Also

GroupShapeCollection Interface

GroupShapeCollection Members

DevExpress.XtraRichEdit.API.Native Namespace