使用API通过nodejs使用batchupdate()使用API更改Google文档中所有内容的行高 [英] Change the line height of all content in a Google doc using the API via nodejs using batchupdate()
本文介绍了使用API通过nodejs使用batchupdate()使用API更改Google文档中所有内容的行高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用方法:documents.get 可以检索文档.结果的结构如资源:文档所述.但是,我需要选择整个文档并将行高更改为1.5,但是我找不到解决方法.
Using Method: documents.get I can retrieve a document. The result is structured as described at Resource: documents. However, I need to select the whole document and change the line-height to 1.5, but I am unable to find a way to do it.
var updateObject = {
documentId: documentId,
resource: {
requests: [{
'updateTextStyle': {
'range': {
'startIndex': 1,
'endIndex': 0
},
'textStyle': {
'line-height': 1.5
},
'fields': 'line-height'
}
}],
},
};
docs.documents.batchUpdate(updateObject)
.then(function(res) { // Modified
console.log(res);
}, function(err) {
console.error(err);
});
推荐答案
-
获取您的文档和计算所有
段落的开始索引和结束索引
内的body
.问题
updateParagraphStyle
请求使用Issue
updateParagraphStyle
request for each of the aboveparagraphs
withlinespacing
as150
for 1.5 times the normal space.这篇关于使用API通过nodejs使用batchupdate()使用API更改Google文档中所有内容的行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文