Hi thank you very much!
That helped.
I have one more question though – when I was testing my code I placed the string to be replaced in the center of an empty line but when it got replaced with the table, the table was positioned as left-aligned on the page. Is there a way to maintain the positioning?
Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. In your case, we suggest you following solution.
Get the position of text using Aspose.Words.Layout API. To get the position of text, you need to bookmark the text. Following code snippet shows how to get the position of bookmark.
Set the left indent of table using Table.LeftIndent property with the position of bookmark.
If you face any issue, please ZIP and attach your input and expected output Word documents here for our reference. We will then provide you more information about your query.