Hi,
Cloning repeating section content controls messes up comments in the cloned parts. In the clone appearing in place of the original section comments are ok, but in subsequent clones there are various problems with the comments. I’m attaching original and the output doc (look what comments are attached to), produced by this repro code:
class Program
{
static void Main(string[] args)
{
var licenseWords = new Aspose.Words.License();
licenseWords.SetLicense("Aspose.Words.lic");
var name = @"Repeating content controls test.docx";
var doc = new Document(name);
var sdts = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);
foreach (StructuredDocumentTag sdt in sdts.ToArray())
{
if (sdt.SdtType == SdtType.RepeatingSection)
{
for (var repeat = 2; repeat > 0; repeat--)
{
var clone = sdt.Clone(true) as StructuredDocumentTag;
clone.Range.Replace("{{Repeat}}", repeat.ToString());
sdt.ParentNode.InsertAfter(clone, sdt);
clone.RemoveSelfOnly();
}
sdt.Remove(); // remove section template
}
}
doc.Save(name.Replace(".docx", ".output.docx"));
}
}
Repeating content controls test.docx (25.3 KB)
Repeating content controls test.output.docx (22.8 KB)