Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ContentControlRepeatingSection Interface

Repeating section content control.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

public interface ContentControlRepeatingSection :
    ContentControlBase

#Remarks

Note

The ContentControlCollection does not contain methods to create a repeating section content control in code.

The SubDocument.ContentControls property returns all content controls in a document. Use the ContentControlBase.ControlType property to determine the content control type.

The code sample below retrieves all building block galleries in a document:

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

using (var wordProcessor = new RichEditDocumentServer()) {

    wordProcessor.LoadDocument("Content Controls.docx");
    Document document = wordProcessor.Document;
    var contentControls = document.ContentControls;
    var firstParagraph = document.Paragraphs[0];
    for (var i = 0; i < contentControls.Count; i++)
    {
        if (firstParagraph.Range.Contains(contentControls[i].Range.Start) && contentControls[i].ControlType == ContentControlType.RepeatingSection)
        {
            ContentControlRepeatingSection repeatingSection = (ContentControlRepeatingSection)contentControls[i];
            repeatingSection.Color = Color.Crimson;
            break;
        }
        wordProcessor.SaveDocument("Content Controls.docx", DocumentFormat.OpenXml);
    }
}

The ContentControlCollection.Remove method allows you to remove specific content control. You can also specify whether to keep control’s contents when the controls is removed.

The code sample below removes all building block galleries from the document:

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

using (var wordProcessor = new RichEditDocumentServer()) {
    Document document = wordProcessor.Document;
    var contentControls = document.ContentControls;

    for (var i = 0; i < contentControls.Count; i++)
    {
        if (contentControls[i].ControlType == ContentControlType.RepeatingSection)
        {
            contentControls.Remove(contentControls[i], true);
        }
    }
}
See Also