Remove CR Character in Cell with Nested Table from Word DOCX Document during Find & Replace using Regex "&p" C# .NET

I am using RegEx to remove a marker followed by a CR. It works except in the case where the CR is in a table cell with a nested table. In this case the marker is removed but the CR remained. This method succeeds in the other cases included in the attached file. Please advise.

Brian

Regex.zip (30.1 KB)

@bstuba,

Please open “Test.docx” with MS Word and press Ctrl+H to bring up the ‘Find and Replace’ box. Enter REMOVE_CR^p in ‘Find what:’ text box and leave the ‘Replace with:’ text box empty. Click ‘Replace All’ button. You will notice that MS Word also does not replace the marker in Table.

Please ZIP and upload your expected DOCX file showing the desired output here for our reference. You can create expected document manually by using MS Word. Also, list the complete steps that you performed in MS Word to create the expected document on your end. We will then investigate the scenario further on our end and provide you more information.

Please find expected output attached.

I replicated your result with Find and Replace. How interesting.

Test_Expected.zip (22.0 KB)

@bstuba,

We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-21329. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.

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