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

Free Support Forum - aspose.com

Clone and Insert Content Control Messes Up Comments using .NET

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)

@FluentDocs

Could you please ZIP and attach your expected Word document here for our reference? We will then investigate the issue and provide you more information on it.

Hi @tahir.manzoor, I don’t see a point in me spending time fiddling with the doc.
Just compare first repetitions of the Parent or Child section with their respective second repetitions in the output doc. They should be the same with the exception of the replaced repeat number.
Both first repetitions are correct and both second repetitions have problems with how the comments are attached.

@FluentDocs

We have logged this problem in our issue tracking system as WORDSNET-22564. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor, thank you.
What’s the typical time frame for resolving issues like this - days/weeks/months?

@FluentDocs

We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

We will inform you via this forum thread once there is an update available on this issue.

Hi Tahir,

Just wondering if you’ve had a chance to look at this bug again since we last spoke?

Kind regards,

Ben.

@FluentDocs

Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.

Understood. Thank you for the update.

Hi Tahir,

Could you please give me an update on this issue? Even if it’s just an assessment of whether this is a bug on your side or an implementation error on our side would be very helpful.

Kind regards,

Ben.

@FluentDocs

The issue you are facing is a bug in Aspose.Words. Currently, your issue is under In Review phase. You will be notified via this forum thread once this issue is resolved.

Hi Tahir,

Could we please have an update on this issue? It’s been some months now so it would be great if we could either have the fix expedited or a workaround for it. This bug is having a direct impact on existing code and preventing us from creating additional features.

Please let me know if there’s anything we can do to help move the process along.

Kind regards,

Ben

@FluentDocs The reviewer returned the code to rework. I asked the responsible developer and the reviewer for the details. Once I get an answer, I will provide you more information.

@FluentDocs The issue was fixed and integrated. The fix will be available in the next version of Aspose.Words. It will be release in a couple of weeks.

Fantastic! Thank you very much @alexey.noskov!

The issues you have found earlier (filed as WORDSNET-22564) have been fixed in this Aspose.Words for .NET 21.12 update also available on NuGet.