blah blah

Automating Powerpoint with ruby

크롬에서 첫번째 써보는 글.
Automating Powerpoint with ruby 에 소개된 루비로 파워포인트 다루는 예제 소스를 살짝 수정해보았다. 

require ‘win32ole’

ppt_file = ARGV[0]
exp_file = ppt_file.sub(/\.ppt$/i, ”)
# open powerpoint
ppt = WIN32OLE.new(‘Powerpoint.Application’)
# make sure it is visible
ppt.Visible = true
# open the presentation to be exported
pre = ppt.Presentations.Open(ppt_file)
# export the file
(1..pre.Slides.count).each do |i|
     pre.Slides(i).Export(“#{exp_file}_#{i}.png”, “png”)
end
# close powerpoint, will close all the currently open files
ppt.Quit()

Ruby + Powerpoint 관련해서는 아래 블로그도 볼만하다.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s