Create a powerpoint presentation with Rails

javascript, powerpoint, ruby, ruby-on-rails, web

Solution

http://tomasvarsavsky.com/2009/04/04/simple-word-document-templating-using-ruby-and-xml/

If you can create the template and populate the values, consider this approach.

Office Open XML file formats

The new Office file formats (.docx, .xlsx, .pptx files) are basically a zipped collection of XML files. We focused on Word files (.docx) but this approach would work with any of the other types of files as well. The specification for the format weighs in at several thousand pages. Producing a file from scratch without a purpose built library that handles all the intricacies of the format would be quite a task. Instead, we drafted the templates in Word and placed markers to tell our templating engine where to insert values. We created document properties which reference data values and added these as fields into the document in the place where the values should be inserted. For example, we could have fields like:

label_tag #{data[:user].name}
label_tag #{data[:user].address}
label_tag #{data[:booking].number}
label_tag #{data[:booking].items.collect{|i| i.name}.join(‘,’)}

Otherwise, there was an attempt (WIP uploaded three years ago, I do not expect it to be completed, but should be benfecial in creating an approach to create slides) on creating PowerPoint slides. Here is a sample of the code

https://github.com/jpoz/rubypoint/blob/master/lib/rubypoint/presentation.rb

def new_slide
  RubyPoint::Slide.new(self)
end

Problem

I'm in a situation in which I have to build a PowerPoint presentation programatically and serve the resulting ppt file through a web application, preferably using Rails, JavaScript or Ruby. Is this possible? If so, how and with which tools? I'm open to any and all suggestions on how to best tackle this problem. Thanks!

Original source