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 關注
- 127 瀏覽
添加回答
舉報