我正在尝试使用以下代码片段在文档文件中插入图像:
var style = {};
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.CENTER;
doc.insertImage(j, fileBlob).setAttributes(style);
图像已正确插入,但始终保持左对齐。有什么想法吗?
最佳答案
尝试修改后的代码
var style = {};
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT;
doc.insertImage(j, blob).getParent().setAttributes(style);
关于google-apps-script - 文档中内联图像的水平对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13991643/