2 回答

TA貢獻(xiàn)1863條經(jīng)驗(yàn) 獲得超2個(gè)贊
查看他們的文檔,您可以看到InsertTextRequest,這可能就是您正在尋找的。
雖然文檔沒有給你任何Go示例,但API在其他語(yǔ)言中是相似的:https://developers.google.com/docs/api/how-tos/move-text
(我不能評(píng)論,這就是為什么這是一個(gè)答案)。

TA貢獻(xiàn)1951條經(jīng)驗(yàn) 獲得超3個(gè)贊
這個(gè)答案有點(diǎn)晚了:
go api 現(xiàn)在可以在這里找到:
關(guān)于代碼的細(xì)節(jié),它應(yīng)該有效。我在下面添加了一個(gè)步驟對(duì)步驟的方法。您必須首先創(chuàng)建結(jié)構(gòu),然后將其指針分配給請(qǐng)求結(jié)構(gòu)。
長(zhǎng)路代碼:
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 關(guān)注
- 121 瀏覽
添加回答
舉報(bào)