We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create Table Repeating Section Content Control in Word Document - C# .NET Code Example

i was looking for an example of using repeating section content control and i have found Repeating section functionality
but the zip file containing the “Repeating Section Content Control.docx” is not available.

Could you sent it to me in order to be able to use the sample ?

thanks in advance.


Please get the requested file from attachment. Repeating Section Content Control.zip (30.7 KB)

thank you for your quick reply


Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.


It is to update you that starting from the 19.9 versions, you can use Aspose.Words for .NET and Aspose.Words for Java APIs to create Structured Document Tag nodes (Content Controls) of the Repeating Section and Repeating Section Item types. The new items have also been added into the SdtType enumeration.

You can use the following C# code example to create a Table Repeating Section and map it to a custom XML part:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

CustomXmlPart xmlPart = doc.CustomXmlParts.Add("Books",
"<books><book><title>Everyday Italian</title><author>Giada De Laurentiis</author></book>" +
"<book><title>Harry Potter</title><author>J K. Rowling</author></book>" +
"<book><title>Learning XML</title><author>Erik T. Ray</author></book></books>");

Table table = builder.StartTable();




StructuredDocumentTag repeatingSectionSdt =
new StructuredDocumentTag(doc, SdtType.RepeatingSection, MarkupLevel.Row);
repeatingSectionSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book", "");

StructuredDocumentTag repeatingSectionItemSdt =
new StructuredDocumentTag(doc, SdtType.RepeatingSectionItem, MarkupLevel.Row);

Row row = new Row(doc);

StructuredDocumentTag titleSdt =
new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Cell);
titleSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book[1]/title[1]", "");

StructuredDocumentTag authorSdt =
new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Cell);
authorSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book[1]/author[1]", "");

doc.Save("E:\\Temp\\Table Repeating Section mapped to a custom XML part.docx");