我无法找到使用 Google Slides API 更新现有对象文本的正确方法。
目前我正在删除幻灯片并重新创建它。
最佳答案
使用 presentations.batchUpdate
怎么样? ?通过使用它,可以修改图形和幻灯片中的文本。示例脚本如下。使用此功能时,请在 API 控制台和高级 Google 服务中启用 Slide API。
示例脚本:
此示例将 pageObjectIds
幻灯片上的“示例文本”修改为“更新的文本”。
var presentationId = "### presentationId ###";
var resource = {
"requests": [
{
"replaceAllText": {
"containsText": {
"text": "sample text"
},
"replaceText": "updated text",
"pageObjectIds": ["### pageObjectIds ###"] // If this is not defined, the text is searched from all slides.
}
}
]
};
Slides.Presentations.batchUpdate(resource, presentationId);
如果我误解了你的问题,我很抱歉。
关于google-apps-script - 使用Google幻灯片API更新Google幻灯片中对象的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46578375/