Everything work as expected replacing all the repeated fields EXCEPT
doc.ApplyFieldData(“@SmpForm”, SmpForm )
For that it only replaces the first instance of @SmpForm in the document.
I tried changing the order of the ApplyFieldData Statements and it made no difference … only one entry is replaced regardless.
Its not a search and replace in the sense that would happen inside word. Since this one goes through the elements, and works on them.
So what can happen is that you could have formatting (without knowing it in the keyword) which splits it into 2 elements, making the search not find it. Thats the most common reason for it not being found.
I think you can turn on show invisible in the Word document to check. (or unzip the word file and look for the keyword and see if it gets split into 2 elements due to formatting)