Joh*_*yen 6 inline-images google-apps-script
我正在寻找一种使内嵌图像垂直对齐的方法,以便内嵌图像的垂直中心与文本的中心垂直对齐。目前,内嵌图像的底部边缘与文本底部齐平。结果,图像似乎比应有的要高得多。有谁知道是否有办法从 Google 应用程序脚本或任何开发计划中控制它?
您可以使用 PositionedImage 类来执行此操作。WRAP_TEXT 格式应该将图像内联,但您仍然可以使用各种偏移方法进一步微调。 https://developers.google.com/apps-script/reference/document/positioned-image
//EXAMPLE Modified from Apps Script Documentation
var body = DocumentApp.getActiveDocument().getBody();
// Append a new paragraph.
var paragraph = body.appendParagraph("New paragraph to anchor the image to.");
// Get an image in Drive from its ID.
var image = DriveApp.getFileById('ENTER_IMAGE_FILE_ID_HERE').getBlob();
// Add the PositionedImage with WRAP_TEXT Layout
var posImage = paragraph.addPositionedImage(image)
.setLayout(DocumentApp.PositionedLayout.WRAP_TEXT)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4609 次 |
| 最近记录: |