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

Free Support Forum - aspose.com

Create a Word Table Repeating Section Content Control Mapped to a Custom XML Part using C# or Java

Was this ever accomplished? I too would like to do it.

Hi Sherri,

Thanks for your request. Unfortunately, WORDSNET-12439 is not resolved yet. Your thread has been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,


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");