2010年5月9日日曜日

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)
// ラベルを描画する
slide = ppa.Presentations(1).slides(1)
shape = slide.Shapes.AddLabel(
MsoTextOrientation.msoTextOrientationHorizontal,
100/* =left */, 100/* =top*/, 400/* =width*/, 100/* height */)
shape.TextFrame.TextRange.Font.Size = 48
shape.TextFrame.TextRange.Text = "追加したラベル"
// フォントに影を設定
shape.TextFrame.TextRange.Font.Shadow = MsoTriState.msoTrue
shape.TextFrame.TextRange.Font.Color.RGB = 0x00ffff /*=BGR*/

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


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


出力プレゼンテーション(test37.pptx)


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

0 件のコメント:

コメントを投稿