为什么Comment的参考文本在Interop.Word中返回null

时间:2017-12-19 08:04:47

标签: c# ms-word office-interop

我使用Microsoft.Office.Interop.Word(在C#中)使用word(word 2013)

我对我的文档添加了一些评论,现在我想阅读评论的参考文本(Range.Comments[0].Reference.Text),但它总是为空。

我也期待范围开始&范围结束位置,似乎范围位置在参考的末尾,它始终在步骤位置(如271到272)

如何获得正确的评论参考范围?

代码示例:

var comments = Doc.Comments;
foreach (var comment in comments)
{
    //this variable is always null :(
    var commentRefText = comment.Reference.Text;
}

解决:

使用comment.Scope.Text返回的引用文本。

0 个答案:

没有答案