2010年4月8日木曜日

ScriptomとPower Pointでスライドの背景にプリセットのグラデーションを設定する

ScriptomとPower Pointでスライドの背景にプリセットのグラデーションを設定するには、以下のコードを実行します。

import org.codehaus.groovy.scriptom.*;
import org.codehaus.groovy.scriptom.tlb.office.*;
import org.codehaus.groovy.scriptom.tlb.office.powerpoint.*;

Scriptom.inApartment
{
ppa = new ActiveXObject("PowerPoint.Application")
ppa.Presentations.Open(new File("test1.pptx").canonicalPath,
Scriptom.MISSING, Scriptom.MISSING, MsoTriState.msoFalse)
// スライド1枚目の背景にプリセットのグラデーションを設定する
slide = ppa.Presentations(1).slides(1)
slide.Background.Fill.PresetGradient(
MsoGradientStyle.msoGradientVertical, 1,
MsoPresetGradientType.msoGradientOcean)

ppa.Presentations(1).saveAs(new File("test6.pptx").canonicalPath)
ppa.Presentations(1).close()
ppa.quit()
}


元プレゼンテーション(test1.pptx)


出力プレゼンテーション(test6.pptx)
ScriptomとPower Pointで背景にプリセットのグラデーションを設定したスライド

動作環境
groovy1.7.0, JDK6 Update18, PowerPoint 2007

0 件のコメント:

コメントを投稿