いくつかのCSSドキュメントを使用setStyleAttribute()
および参照できます
たとえば、このようにしてみてください(私は、CSSの専門家ではないので、エレガントでない場合でも私を責めないでください;-)
function testImage(){
var app = UiApp.createApplication().setTitle("My Simple App").setHeight('700').setWidth('900');
mainImage = app.createImage("https://dl.dropbox.com/u/211279/Time-change-clock_animated_TR80.gif")
.setStyleAttribute('position','relative').setStyleAttribute('left','50%').setStyleAttribute('top','50%')
app.add(mainImage);
ss=SpreadsheetApp.getActive()
ss.show(app)
}
注:%の代わりにPX(ピクセル)を使用して画像を配置することもできます。お気づきのとおり、これをスプレッドシートUIでテストしました。
編集:そしてこれは、ピクセルとブライアンのCSSスタイリングの提案を使用したバージョンで、よりコンパクトで、元のCSSメソッドに近い構文を使用しています(再びthx):
var _imgCSS = {'position':'relative', 'left':'200PX', 'top':'200PX'}
function testImage(){
var app = UiApp.createApplication().setTitle("My Simple App").setHeight('500').setWidth('500');
var mainImage = app.createImage("https://dl.dropbox.com/u/211279/Time-change-clock_animated_TR80.gif")
.setStyleAttributes(_imgCSS)
app.add(mainImage);
ss=SpreadsheetApp.getActive()
ss.show(app)
}