Sha256: 489cbae8e3041e3b3f740bb8c1ffedd63a64cdd932437acac22678ab9c25338b

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 Bytes

Contents

require 'zip/filesystem'
require 'fileutils'

module Powerpoint
  module Slide
    class Powerpoint::Slide::Textual
      def initialize extract_path, title, content, slide_number
        template_path = "#{TEMPLATE_PATH}/ppt/slides/slide2.xml"
        xml = File.read template_path

        title_xml = '<a:p><a:r><a:rPr lang="en-US" dirty="0" smtClean="0"/><a:t>'+ title.to_s + '</a:t></a:r><a:endParaRPr lang="en-US" dirty="0"/></a:p>'
        xml.gsub!('SLIDE_TITLE_PACEHOLDER', title_xml)

        content_xml = ''
        content.each do |i|
          content_xml += '<a:p><a:r><a:rPr lang="en-US" dirty="0" smtClean="0"/><a:t>' + i.to_s + '</a:t></a:r></a:p>'
        end

        xml.gsub!('CONTENT_PACEHOLDER', content_xml)

        slide_path = "#{extract_path}/ppt/slides/slide#{slide_number}.xml"
        File.open(slide_path, 'w'){ |f| f << xml }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
powerpoint-1.5 lib/powerpoint/slide/textual.rb
powerpoint-1.4 lib/powerpoint/slide/textual.rb