powerpoint 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.rdoc +81 -0
- data/Rakefile +7 -0
- data/lib/powerpoint.rb +40 -0
- data/lib/powerpoint/content_type.rb +14 -0
- data/lib/powerpoint/meta.rb +14 -0
- data/lib/powerpoint/presentation.rb +50 -0
- data/lib/powerpoint/relationship.rb +14 -0
- data/lib/powerpoint/slide/intro.rb +22 -0
- data/lib/powerpoint/slide/pictorial.rb +108 -0
- data/lib/powerpoint/slide/relationship.rb +15 -0
- data/lib/powerpoint/slide/textual.rb +26 -0
- data/lib/powerpoint/version.rb +3 -0
- data/powerpoint.gemspec +28 -0
- data/samples/images/sample_gif.gif +0 -0
- data/samples/images/sample_jpg.jpg +0 -0
- data/samples/images/sample_png.png +0 -0
- data/samples/images/sample_svg.svg +69 -0
- data/samples/pptx/sample.pptx +0 -0
- data/spec/test_spec.rb +20 -0
- data/template/[Content_Types].xml +32 -0
- data/template/_rels/.rels +2 -0
- data/template/ppt/_rels/presentation.xml.rels +2 -0
- data/template/ppt/media/README +0 -0
- data/template/ppt/presProps.xml +2 -0
- data/template/ppt/presentation.xml +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout1.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout10.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout11.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout2.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout3.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout4.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout5.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout6.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout7.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout8.xml.rels +2 -0
- data/template/ppt/slideLayouts/_rels/slideLayout9.xml.rels +2 -0
- data/template/ppt/slideLayouts/slideLayout1.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout10.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout11.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout2.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout3.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout4.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout5.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout6.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout7.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout8.xml +2 -0
- data/template/ppt/slideLayouts/slideLayout9.xml +2 -0
- data/template/ppt/slideMasters/_rels/slideMaster1.xml.rels +2 -0
- data/template/ppt/slideMasters/slideMaster1.xml +2 -0
- data/template/ppt/slides/_rels/slide1.xml.rels +2 -0
- data/template/ppt/slides/_rels/slide2.xml.rels +2 -0
- data/template/ppt/slides/slide1.xml +6 -0
- data/template/ppt/slides/slide2.xml +6 -0
- data/template/ppt/tableStyles.xml +2 -0
- data/template/ppt/theme/theme1.xml +2 -0
- data/template/ppt/viewProps.xml +2 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjNkNDQ2MDRjZjlkN2QxZTE3ODMzZDE4NDNlOTYwY2U2NjEzYzA4OA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTNjNjk2MTQ2NjczNTU3NDI3OTRiYjA4ZGE4NDYzNmRiNGQ4YzJiNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTYyY2Q1MTFhNzQ4Y2UzNzQ0NTJiMmYwY2VkZDhlZjZmMTdiNTRhMTc0ODUw
|
10
|
+
NDNmY2YxZmNmMDZjYjJmZGQ0OWExYmQ4MDExZjUxZDE4MWQzNDViOGMyMDU1
|
11
|
+
NjVlMGQxY2ZlM2YzMjNlMGM1ZGVjZTg2NDg2ZTBiZjg5MTU5NWU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTcxNGJkZjVjMzQ4NzQ3YTcxMjQ3OTk5MTk4ODVlMGI1NGVkY2FmZmEyYmI2
|
14
|
+
YmZhZjE2YzViODBjZmI5NmNhYzg2MDM5YWI0OTE5NDkwZTg3MjRlY2MyYzM2
|
15
|
+
M2E3OTNjOGJiNTEwYWNlZGUwMzE1ZDVjNjIyYzM5MjJlMzZmNDc=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
= 'powerpoint' gem -- for creating PowerPoint Slides in Ruby.
|
2
|
+
|
3
|
+
'powerpoint' is a Ruby gem that can generate PowerPoint files(pptx).
|
4
|
+
|
5
|
+
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
'powerpont' can be used from the command line or as part of a Ruby web framework. To install the gem using terminal, run the following command:
|
9
|
+
|
10
|
+
gem install powerpoint
|
11
|
+
|
12
|
+
To use it in Rails, add this line to your Gemfile:
|
13
|
+
|
14
|
+
gem "powerpoint"
|
15
|
+
|
16
|
+
|
17
|
+
== Basic Usage
|
18
|
+
|
19
|
+
'powerpoint' gem can generate a PowerPoint presentaion based on a standard template:
|
20
|
+
|
21
|
+
require 'powerpoint'
|
22
|
+
|
23
|
+
@deck = Powerpoint::Presentation.new
|
24
|
+
|
25
|
+
# Creating an introduction slide:
|
26
|
+
title = 'Bicycle Of the Mind'
|
27
|
+
subtitle = 'created by Steve Jobs'
|
28
|
+
@deck.add_intro title, subtitle
|
29
|
+
|
30
|
+
# Creating a text-only slide:
|
31
|
+
# Title must be a string.
|
32
|
+
# Content must be an array of strings that will be displayed as bullet items.
|
33
|
+
title = 'Why Mac?'
|
34
|
+
content = ['Its cool!', 'Its light.']
|
35
|
+
@deck.add_textual_slide title, content
|
36
|
+
|
37
|
+
# Creating an image Slide:
|
38
|
+
# It will contain a title as string.
|
39
|
+
# and an embeded image
|
40
|
+
title = 'Everyone loves Macs:'
|
41
|
+
image_path = 'samples/images/sample_gif.gif'
|
42
|
+
@deck.add_pictorial_slide title, image_path
|
43
|
+
|
44
|
+
# Specifying coordinates and image size for an embeded image.
|
45
|
+
# x and y values define the position of the image on the slide.
|
46
|
+
# cx and cy define the width and height of the image.
|
47
|
+
# x, y, cx, cy are in points. Each pixel is 12700 points.
|
48
|
+
# coordinates parameter is optional.
|
49
|
+
coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}
|
50
|
+
@deck.add_pictorial_slide title, image_path, coords
|
51
|
+
|
52
|
+
# Saving the pptx file to the current directory.
|
53
|
+
@deck.save('test.pptx')
|
54
|
+
|
55
|
+
== Compatibility
|
56
|
+
|
57
|
+
'powerpoint' gem has been tested with LibreOffice(4.2.1.1) and Apache OpenOffice(4.0.1) on Mac OS X Mavericks, Microsoft PowerPoint 2010 on Windows 7 and Google Docs(latest version as of March 2014).
|
58
|
+
|
59
|
+
== Contributing
|
60
|
+
|
61
|
+
Contributions are welcomed. You can fork a repository, add your code changes to the forked branch, ensure all existing unit tests pass, create new unit tests cover your new changes and finally create a pull request.
|
62
|
+
|
63
|
+
After forking and then cloning the repository locally, install Bundler and then use it
|
64
|
+
to install the development gem dependecies:
|
65
|
+
|
66
|
+
gem install bundler
|
67
|
+
bundle install
|
68
|
+
|
69
|
+
Once this is complete, you should be able to run the test suite:
|
70
|
+
|
71
|
+
rake
|
72
|
+
|
73
|
+
|
74
|
+
== Bug Reporting
|
75
|
+
|
76
|
+
Please use the {Issues}[https://github.com/pythonicrubyist/powerpoint/issues] page to report bugs or suggest new enhancements.
|
77
|
+
|
78
|
+
|
79
|
+
== License
|
80
|
+
|
81
|
+
Powerpoint has been published under {MIT License}[https://github.com/pythonicrubyist/powerpoint/blob/master/LICENSE.txt]
|
data/Rakefile
ADDED
data/lib/powerpoint.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "powerpoint/version"
|
2
|
+
require 'powerpoint/slide/intro'
|
3
|
+
require 'powerpoint/slide/textual'
|
4
|
+
require 'powerpoint/slide/pictorial'
|
5
|
+
require 'powerpoint/relationship'
|
6
|
+
require 'powerpoint/slide/relationship'
|
7
|
+
require 'powerpoint/content_type'
|
8
|
+
require 'powerpoint/meta'
|
9
|
+
require 'powerpoint/presentation'
|
10
|
+
|
11
|
+
module Powerpoint
|
12
|
+
|
13
|
+
spec = Gem::Specification.find_by_name("powerpoint")
|
14
|
+
gem_root = spec.gem_dir
|
15
|
+
TEMPLATE_PATH = "#{gem_root}/template/"
|
16
|
+
|
17
|
+
def self.decompress_pptx in_path, out_path
|
18
|
+
Zip::File.open(in_path) do |zip_file|
|
19
|
+
zip_file.each do |f|
|
20
|
+
f_path = File.join(out_path, f.name)
|
21
|
+
FileUtils.mkdir_p(File.dirname(f_path))
|
22
|
+
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.compress_pptx in_path, out_path
|
28
|
+
Zip::File.open(out_path, Zip::File::CREATE) do |zip_file|
|
29
|
+
Dir.glob("#{in_path}/**/*", ::File::FNM_DOTMATCH).each do |path|
|
30
|
+
zip_path = path.gsub("#{in_path}/","")
|
31
|
+
next if zip_path == "." || zip_path == ".." || zip_path.match(/DS_Store/)
|
32
|
+
begin
|
33
|
+
zip_file.add(zip_path, path)
|
34
|
+
rescue Zip::ZipEntryExistsError
|
35
|
+
raise "#{out_path} allready exists!"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
class Powerpoint::ContentType
|
6
|
+
def initialize extract_path, sllide_number
|
7
|
+
xml = '<Override PartName="/ppt/slides/slide' + sllide_number.to_s + '.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/></Types>'
|
8
|
+
path = "#{extract_path}/[Content_Types].xml"
|
9
|
+
template = File.read path
|
10
|
+
template.gsub!('</Types>', xml)
|
11
|
+
File.open(path, 'w'){ |f| f << template }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
class Powerpoint::Meta
|
6
|
+
def initialize extract_path, sllide_number
|
7
|
+
xml = '<p:sldId id="257" r:id="rId' + (sllide_number+666).to_s + '"/></p:sldIdLst>'
|
8
|
+
path = "#{extract_path}/ppt/presentation.xml"
|
9
|
+
template = File.read path
|
10
|
+
template.gsub!('</p:sldIdLst>', xml)
|
11
|
+
File.open(path, 'w'){ |f| f << template }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
module Powerpoint
|
6
|
+
class Powerpoint::Presentation
|
7
|
+
|
8
|
+
attr_reader :pptx_path, :extract_path
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@slide_count = 0
|
12
|
+
@extract_path = File.join Dir.tmpdir, "extract_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}"
|
13
|
+
FileUtils.copy_entry TEMPLATE_PATH, @extract_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_intro title, subtitile=nil
|
17
|
+
@slide_count += 1
|
18
|
+
Powerpoint::Slide::Intro.new @extract_path, title, subtitile
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_textual_slide title, content=[]
|
22
|
+
@slide_count += 1
|
23
|
+
Powerpoint::Slide::Textual.new @extract_path, title, content, @slide_count
|
24
|
+
Powerpoint::Slide::Relationship.new @extract_path, @slide_count
|
25
|
+
setablish_relationships
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_pictorial_slide title, image_path, coords={}
|
29
|
+
@slide_count += 1
|
30
|
+
Powerpoint::Slide::Pictorial.new @extract_path, title, image_path, @slide_count, coords
|
31
|
+
setablish_relationships
|
32
|
+
end
|
33
|
+
|
34
|
+
def setablish_relationships
|
35
|
+
if @slide_count > 2
|
36
|
+
Powerpoint::ContentType.new @extract_path, @slide_count
|
37
|
+
Powerpoint::Relationship.new @extract_path, @slide_count
|
38
|
+
Powerpoint::Meta.new @extract_path, @slide_count
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def save path
|
43
|
+
@pptx_path = path
|
44
|
+
File.delete(path) if File.exist?(path)
|
45
|
+
Powerpoint.compress_pptx @extract_path, @pptx_path
|
46
|
+
FileUtils.rm_rf(@extract_path)
|
47
|
+
path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
class Powerpoint::Relationship
|
6
|
+
def initialize extract_path, sllide_number
|
7
|
+
xml = '<Relationship Id="rId'+ (sllide_number+666).to_s + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide' + sllide_number.to_s + '.xml"/></Relationships>'
|
8
|
+
path = "#{extract_path}/ppt/_rels/presentation.xml.rels"
|
9
|
+
template = File.read path
|
10
|
+
template.gsub!('</Relationships>', xml)
|
11
|
+
File.open(path, 'w'){ |f| f << template }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
module Slide
|
6
|
+
class Powerpoint::Slide::Intro
|
7
|
+
def initialize extract_path, title, subtitile=nil
|
8
|
+
template_path = "#{TEMPLATE_PATH}/ppt/slides/slide1.xml"
|
9
|
+
xml = File.read template_path
|
10
|
+
|
11
|
+
xml_title = '<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>'
|
12
|
+
xml.gsub!('PRESENTATION_TITLE_PACEHOLDER', xml_title)
|
13
|
+
|
14
|
+
xml_subtitle = '<a:p><a:r><a:rPr lang="en-US" dirty="0" smtClean="0"/><a:t>' + subtitile.to_s+ '</a:t></a:r><a:endParaRPr lang="en-US" dirty="0"/></a:p>'
|
15
|
+
xml.gsub!('PRESENTATION_SUBTITLE_PACEHOLDER', xml_subtitle)
|
16
|
+
|
17
|
+
intro_slide_path = "#{extract_path}/ppt/slides/slide1.xml"
|
18
|
+
File.open(intro_slide_path, 'w'){ |f| f << xml }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
module Slide
|
6
|
+
class Powerpoint::Slide::Pictorial
|
7
|
+
def initialize extract_path, title, image_path, slide_number, coords={}
|
8
|
+
|
9
|
+
image_name = File.basename(image_path)
|
10
|
+
FileUtils.copy_file(image_path, "#{extract_path}/ppt/media/#{image_name}")
|
11
|
+
|
12
|
+
coords_tag = (coords.empty?) ? '' : '<p:spPr>
|
13
|
+
<a:xfrm>
|
14
|
+
<a:off x="' + coords[:x].to_s + '" y="' + coords[:y].to_s + '" />
|
15
|
+
<a:ext cx="' + coords[:cx].to_s + '" cy="' + coords[:cy].to_s + '" />
|
16
|
+
</a:xfrm>
|
17
|
+
</p:spPr>'
|
18
|
+
|
19
|
+
rel_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
20
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
21
|
+
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/' + image_name + '" />
|
22
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout2.xml" />
|
23
|
+
</Relationships>'
|
24
|
+
|
25
|
+
rel_path = "#{extract_path}/ppt/slides/_rels/slide#{slide_number}.xml.rels"
|
26
|
+
File.open(rel_path, 'w'){ |f| f << rel_xml }
|
27
|
+
|
28
|
+
slide_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
29
|
+
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
|
30
|
+
<p:cSld>
|
31
|
+
<p:spTree>
|
32
|
+
<p:nvGrpSpPr>
|
33
|
+
<p:cNvPr id="1" name="" />
|
34
|
+
<p:cNvGrpSpPr />
|
35
|
+
<p:nvPr />
|
36
|
+
</p:nvGrpSpPr>
|
37
|
+
<p:grpSpPr>
|
38
|
+
<a:xfrm>
|
39
|
+
<a:off x="0" y="0" />
|
40
|
+
<a:ext cx="0" cy="0" />
|
41
|
+
<a:chOff x="0" y="0" />
|
42
|
+
<a:chExt cx="0" cy="0" />
|
43
|
+
</a:xfrm>
|
44
|
+
</p:grpSpPr>
|
45
|
+
<p:sp>
|
46
|
+
<p:nvSpPr>
|
47
|
+
<p:cNvPr id="2" name="Title 1" />
|
48
|
+
<p:cNvSpPr>
|
49
|
+
<a:spLocks noGrp="1" />
|
50
|
+
</p:cNvSpPr>
|
51
|
+
<p:nvPr>
|
52
|
+
<p:ph type="title" />
|
53
|
+
</p:nvPr>
|
54
|
+
</p:nvSpPr>
|
55
|
+
<p:spPr />
|
56
|
+
<p:txBody>
|
57
|
+
<a:bodyPr />
|
58
|
+
<a:lstStyle />
|
59
|
+
<a:p>
|
60
|
+
<a:r>
|
61
|
+
<a:rPr lang="en-US" dirty="0" smtClean="0" />
|
62
|
+
<a:t>' + title + '</a:t>
|
63
|
+
</a:r>
|
64
|
+
<a:endParaRPr lang="en-US" dirty="0" />
|
65
|
+
</a:p>
|
66
|
+
</p:txBody>
|
67
|
+
</p:sp>
|
68
|
+
<p:pic>
|
69
|
+
<p:nvPicPr>
|
70
|
+
<p:cNvPr id="4" name="Content Placeholder 3" />
|
71
|
+
<p:cNvPicPr>
|
72
|
+
<a:picLocks noGrp="1" noChangeAspect="1" />
|
73
|
+
</p:cNvPicPr>
|
74
|
+
<p:nvPr>
|
75
|
+
<p:ph idx="1" />
|
76
|
+
</p:nvPr>
|
77
|
+
</p:nvPicPr>
|
78
|
+
<p:blipFill>
|
79
|
+
<a:blip r:embed="rId2">
|
80
|
+
<a:extLst>
|
81
|
+
<a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
|
82
|
+
<a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0" />
|
83
|
+
</a:ext>
|
84
|
+
</a:extLst>
|
85
|
+
</a:blip>
|
86
|
+
<a:stretch>
|
87
|
+
<a:fillRect />
|
88
|
+
</a:stretch>
|
89
|
+
</p:blipFill>' + coords_tag +
|
90
|
+
'</p:pic>
|
91
|
+
</p:spTree>
|
92
|
+
<p:extLst>
|
93
|
+
<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
|
94
|
+
<p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1474098577" />
|
95
|
+
</p:ext>
|
96
|
+
</p:extLst>
|
97
|
+
</p:cSld>
|
98
|
+
<p:clrMapOvr>
|
99
|
+
<a:masterClrMapping />
|
100
|
+
</p:clrMapOvr>
|
101
|
+
</p:sld>'
|
102
|
+
|
103
|
+
slide_path = "#{extract_path}/ppt/slides/slide#{slide_number}.xml"
|
104
|
+
File.open(slide_path, 'w'){ |f| f << slide_xml }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
module Slide
|
6
|
+
class Powerpoint::Slide::Relationship
|
7
|
+
def initialize extract_path, slide_number
|
8
|
+
xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
9
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout2.xml"/></Relationships>'
|
10
|
+
path = "#{extract_path}/ppt/slides/_rels/slide#{slide_number}.xml.rels"
|
11
|
+
File.open(path, 'w'){ |f| f << xml }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Powerpoint
|
5
|
+
module Slide
|
6
|
+
class Powerpoint::Slide::Textual
|
7
|
+
def initialize extract_path, title, content, slide_number
|
8
|
+
template_path = "#{TEMPLATE_PATH}/ppt/slides/slide2.xml"
|
9
|
+
xml = File.read template_path
|
10
|
+
|
11
|
+
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>'
|
12
|
+
xml.gsub!('SLIDE_TITLE_PACEHOLDER', title_xml)
|
13
|
+
|
14
|
+
content_xml = ''
|
15
|
+
content.each do |i|
|
16
|
+
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>'
|
17
|
+
end
|
18
|
+
|
19
|
+
xml.gsub!('CONTENT_PACEHOLDER', content_xml)
|
20
|
+
|
21
|
+
slide_path = "#{extract_path}/ppt/slides/slide#{slide_number}.xml"
|
22
|
+
File.open(slide_path, 'w'){ |f| f << xml }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|