代码语言:javascript复制
gapi.client.request({
method: 'POST',
path: `https://docs.googleapis.com/v1/documents/${docId}:batchUpdate`,
body: {
requests: [
{
replaceAllText: {
replaceText: '蓑笠翁',
containsText: {
text: '${oldMan}',
matchCase:true
}
}
},
{
replaceAllText: {
replaceText: '雪',
containsText: {
text: '${snow}',
matchCase:true
}
}
}
]
}
}).then(res => {
printLog(`更新文档成功`, 'text-success')
console.log(res)
downLoadDocFile(res.result.documentId)
})