0

我有这段代码可以将字段和单词插入一个范围;

Application app = new Microsoft.Office.Interop.Word.Application();
Document doc = app.Open("FILE PATH HERE");
Range targetRange = doc.Range;
doc.MailMerge.Fields.Add(targetRange, "field1");
targetRange.InsertAfter("between");
doc.MailMerge.Fields.Add(targetRange, "field2");
Debug.WriteLine(targetRange.Text);

上面代码的输出是;

<<field2>><<field1>>between

我想要的输出是;

<<field1>>between<<field2>>

如何使第二个字段插入到范围的末尾而不是开头?

4

0 回答 0