使用Google Apps脚本获取Google文档中元素的范围 [英] Get the ranges of the elements in a google doc using Google Apps Script
问题描述
继此{"startIndex": xx, "endIndex": xx},以便可以使用它们在批量更新中?
我有一种感觉,我想念这里很明显的东西.
使用Google Docs API和文档ID,您可以创建文档资源,其中body
字段具有content
字段,其中所有
Following on from this question - I am now unsure how I might be able to target certain paragraphs or elements within the document when using Google Apps Scripts in order to use the batch update method outlined one would need to find the range of the element that required styling.
If there were 10 empty paragraphs (with content of "\n",) in a document - how would it be possible to target the 8th paragraph and get the range values {"startIndex": xx, "endIndex": xx}
relative to the document so they could be used in the batch update?
I have a feeling I am missing something very obvious here.
Using Google Docs API and the document ID you can make a documents.get request, which will return you a document resource with a body
field which has a content
field with all the elements in the document, where you can see the "startIndex" and "endIndex".
这篇关于使用Google Apps脚本获取Google文档中元素的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!