我正在尝试更新文档以添加其中包含文本的图形,但是我无法弄清“批处理更新”方法的工作原理,我一直在搜索,但没有找到任何有帮助的方法我。
这是我的代码:
function onMouseClicked(text)
{
var docId = "CommentSystem";
var element_id = 'MyTextBox_01'
var pt350 = {
'magnitude': 350,
'unit': 'PT'
}
var requests = {
"resource": [
{
"createShape": {
"objectId": element_id,
"shapeType": "TEXT_BOX",
"elementProperties": {
"pageObjectId": 1,
"size": {
"height": pt350,
"width": pt350
},
"transform": {
"scaleX": 1,
"scaleY": 1,
"translateX": 350,
"translateY": 100,
"unit": "PT"
}
}
}
},
{
"insertText": {
"objectId": element_id,
"insertionIndex": 0,
"text": "New Box Text Inserted!"
}
}
]};
docs.documents.batchUpdate(requests, docId);
最后一行给我两个错误:
Uncaught at onMouseClicked (main:119) (CommentSystem) a1c55c91-19c4-4d22-bdff-96e08f948614
并且:
获取https://docs.google.com/document/d/1HnyPU6Ypwgqx6aVO5Sl9hWFk1Yt4uxaeHL0bfKZGP-g/bind?id=1HnyPU6Ypwgqx6aVO5Sl9hWFk1Yt4uxaeHL0bfKZGP-g&sid=26fc6797079da875&token=AC4w5VgzqQFSlKcJK5U00PukFZT12lJGjQ%3A1556388013156&ouid=103166849151740109958&includes_info_params=true&VER=8&lsq=1556382560405&u=12574476218373263741&vc=1&c=1&w=1&gsi=0&ssfi=321&smv=5&cimpl=1&RID=rpc&SID=575C168A09D449BC&CI=0&AID=29&TYPE=xmlhttp&zx=m7bjvtet1so&t=1净值:: ERR_QUIC_PROTOCOL_ERROR.QUIC_TOO_MANY_RTOS 200