2014-03-31 46 views
0

我有一个单词插件,它可以创建可放置在word文档中的字段列表。当您通过拖放或双击来选择一个字段时,它会将该字段放置在文档上,并在文档内部创建一个xml部分。这工作正常。我想要做的是将word中的选择位置移动到刚插入的xml部分之后。所以如果该字段表示“创建日期”,我想在“创建日期”之后将选择点移动到以下行。任何想法如何做到这一点?谢谢。在Word Interop App中插入xml文本后更改选择

回答

0

我假设你正在使用一个范围来插入字段? 如果是这样你可以折叠到范围的末尾,然后添加你想要的。例如:

// Move to the end 
myRange.Collapse(Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseEnd); 
// Now add something behind the table to prevent word from joining tables into one 
myRange.InsertParagraphAfter(); 
//to move to the end again 
myRange.Collapse(Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseEnd); 
相关问题