6

インライン画像の中心が垂直方向のテキストの中心と垂直方向に整列するように、インライン画像を垂直方向に整列させる方法を探しています。現在、インライン画像の下端はテキストの下端と同じ高さになっています。その結果、イメージが本来よりもはるかに高くなったように見えます。Google Apps スクリプト内からこれを制御する方法があるかどうか、または開発の計画があるかどうか、誰か知っていますか? </p>

たとえば、この Google ドキュメントの 1 行目のインライン画像を 2 行目のラップされた画像のようにしたい: 縦に並んだ画像

4

1 に答える 1

1

これを行うには、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)
于 2016-10-21T13:27:07.813 に答える