评论在其相应的Google文档中的位置

问题描述:

给出通过Google文档API检索的Google文档,并使用Drive API检索其注释,

Given a google doc retrieved through the Google docs API and its comments retrived with the Drive API,

您怎么知道注释在文档中的何处?

How do you know where in the document a comment corresponds?

我一直在检查所有字段,除了 quotedFileContent 包含文档中已注释文本的内容外,我找不到任何关系,但是如果该文本重复了,这将导致模棱两可的解决.

I've been inspecting all the fields and couldn't find a relation except the quotedFileContent that contains the commented text in the doc, but this would resolve ambiguously if that text is duplicated.

您无法使用Drive API检索评论的位置.

You cannot retrieve the location of a comment using Drive API.

如您在官方文档中所见,评论资源具有 anchor 字段,该字段提供有关

As you can see in the official documentation, the Comment resource has an anchor field that provides information on the region of the document. Nevertheless, if you use the API to get information about a comment, you will see that the anchor field in the response is actually a string identifier composed of a kix prefix and a certain anchor ID as a suffix, which don't really give you an idea of where the comment is located.

问题不仅仅在于获取评论锚定的位置,还在于使用API​​在所需位置创建锚定的注释,如您所见

The problem is not just about retrieving the locations to which a comment is anchored, but also about creating anchored comments in a desired location using the API, as you can see here.

基本上,当前已实现的此 anchor 工具供第三方集成使用此API指定其自己的自定义锚定数据.

Basically, as it is currently implemented, this anchor tool is meant for third-party integrations to use this API to specify their own custom anchor data.

问题跟踪器中有几个与此相关的未解决案例:

There are several open cases in Issue Tracker related to this:

参考: