Hi, we’re using Aspose.Words for .NET 20.10.0.0.
Mainly we’re using a Range.Replace for replacing tags in document like your MailMerge or LIQN reporting engine do.
In Table Cells elements we experiencing 3 different behavior of replacing tag with multiline text value.
In word document we got a Table with Cell containing tag {Description} wich will be replaced by value holding multiline text with CRLF line endings.
1] If Cell contains only tag {Description} the line endings CRLF will be replaced by SPACE character.
2] If Cell contains tag {Description} and paragraph (eq. your metacharacter &p) no matter where is placed the line endings will be reaplaced as paragraph (&p). This is behavior we will expect as is done in all other parts of the document with using Range.Raplace.
3] If the document will be created in code by DocumentBuilder and builder Write string tag “{Description}” into the cell and then we use Range.Replace the line endings will be with no change in result document - CRLF.
Here si example console application including docx template to demostrate different behaviors.
TableCellLineBreak.zip (5.7 MB)
So the issue is why the Table Cell Range.Raplce for multiline text works different to other parts of document? (As you can try in example TextArea on inline text). It’s a bug or we just miss something with word document options? Or how we can use a Range.Replace to reach same behavior in all cases?
Thanks in advance