2 回答

TA贡献1863条经验 获得超2个赞
查看他们的文档,您可以看到InsertTextRequest,这可能就是您正在寻找的。
虽然文档没有给你任何Go示例,但API在其他语言中是相似的:https://developers.google.com/docs/api/how-tos/move-text
(我不能评论,这就是为什么这是一个答案)。

TA贡献1951条经验 获得超3个赞
这个答案有点晚了:
go api 现在可以在这里找到:
关于代码的细节,它应该有效。我在下面添加了一个步骤对步骤的方法。您必须首先创建结构,然后将其指针分配给请求结构。
长路代码:
var batchreqs docs.BatchUpdateDocumentRequest
var instxtreq docs.InsertTextRequest
var txtloc docs.Location
var breq docs.Request
txtloc.Index = {your index}
txtloc.SegmentID = "" // a bit superfluous
instxtreq.Location = &txtloc
instxtreq.Text = "your new text"
breq.InsertText =&instxtreq
var breqarray [1](*docs.Request)
breqarray[0].InsertText = instxtreq
breqslice = breqarray[:]
batchreqs.Request = &breqslice
// now you can do the BatchUpdate
_, err = srv.Documents.BatchUpdate("your_document_id", &batchreqs).Do()
// the batch reqs must be a pointer to an existing batchupdaterequest structure
- 2 回答
- 0 关注
- 107 浏览
添加回答
举报