Avoid Duplicate List Items after Inserting Multiple Paragraph Breaks using Range.Replace() C# .NET

I have encountered a bug. When using Range.Replace() to insert multiple paragraph breaks (&p) into a list item, a duplicate list item is created. Input and output documents are attached. Here is the code to create the output document from the input document to recreate the bug:

var find = ",";
var replace = "&p&p";

var document = new Document(/path/to/input/file);

document.StartTrackRevisions("Author");
document.Range.Replace(find, replace);
document.StopTrackRevisions();

document.Save(/path/to/output/file);

ListsAndLinebreaks2.docx (12.9 KB)
ListsAndLinebreaks2.docx (10.7 KB)

@ssmolkin1,

We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-22311. We will further look into the details of this problem and will keep you updated here on the status. We apologize for any inconvenience.

Thanks. I wanted to add that this seems to occur only when TrackRevisions is enabled. It works correctly if TrackRevisions is disabled.

@ssmolkin1,

We have logged these details in our issue tracking system and will keep you posted here on any further updates.

The issues you have found earlier (filed as WORDSNET-22311) have been fixed in this Aspose.Words for .NET 21.7 update and this Aspose.Words for Java 21.7 update.