powerpoint 1.7 → 1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/powerpoint.rb +2 -0
- data/lib/powerpoint/presentation.rb +10 -1
- data/lib/powerpoint/slide/intro.rb +4 -0
- data/lib/powerpoint/slide/pictorial.rb +1 -6
- data/lib/powerpoint/slide/picture_description.rb +63 -0
- data/lib/powerpoint/slide/text_picture_split.rb +56 -0
- data/lib/powerpoint/util.rb +6 -0
- data/lib/powerpoint/version.rb +1 -1
- data/lib/powerpoint/views/app.xml.erb +51 -0
- data/lib/powerpoint/views/picture_description_rels.xml.erb +5 -0
- data/lib/powerpoint/views/picture_description_slide.xml.erb +115 -0
- data/lib/powerpoint/views/text_picture_split_rel.xml.erb +5 -0
- data/lib/powerpoint/views/text_picture_split_slide.xml.erb +114 -0
- data/samples/pptx/sample.pptx +0 -0
- data/spec/test_spec.rb +4 -1
- metadata +25 -19
- data/template/docProps/app.xml +0 -2
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MGNjNGJmODJlNzI2YTFiYzEyMzVlZGYxZTJhMDVmMTAyY2M5NWY0MQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7a80c6b2960438a7bfd273568aee8700938e7fa0
|
4
|
+
data.tar.gz: 4f93cf34deaed1102e592d65913442fbeef606f4
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YzUxZjBmZDE0YTVhYTMxNjE1OGZlNjg0OGQ1ODhjZTlmM2EzMDk3N2U3MTYz
|
11
|
-
NGY2OGE0ZjRiMjYwNzI1N2EyNzI4NDNkNzA5NTliYjg1MThhYTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MWJkZDI5OTdiYzc5YTBmYmQ4ZTM3NjhiZmJjODk2ODUxNzMwY2E5YTg5YmZi
|
14
|
-
MzlkMjY4ZWZlMmIzNDk0MTAzYTZiYWU1NTUyZmI4YzA4NjViNGMwMWU0MzYw
|
15
|
-
OGNkOThjNmY5OGJhNGUzODRjOTQ0OWVkZjY5ODI4ZDJmMmVmYjE=
|
6
|
+
metadata.gz: b755db84b862f3f3e8a1fa80ed0d76cbaea664c6b6cdda879ba39060b485c31463642854b5c19f64a4603a1e87babde2cbe7bd9b61025ad99653ceccf4bc897d
|
7
|
+
data.tar.gz: e930379e6409787cf768f3011456e60a8eb9382176fa985e04e7f43d0ace1d495a431f080f654dc54ddf8b37ee97c43a52489306e04348290f4488df580896ac
|
data/lib/powerpoint.rb
CHANGED
@@ -3,6 +3,8 @@ require 'powerpoint/util'
|
|
3
3
|
require 'powerpoint/slide/intro'
|
4
4
|
require 'powerpoint/slide/textual'
|
5
5
|
require 'powerpoint/slide/pictorial'
|
6
|
+
require 'powerpoint/slide/text_picture_split'
|
7
|
+
require 'powerpoint/slide/picture_description'
|
6
8
|
require 'powerpoint/compression'
|
7
9
|
require 'powerpoint/presentation'
|
8
10
|
|
@@ -30,6 +30,14 @@ module Powerpoint
|
|
30
30
|
@slides << Powerpoint::Slide::Pictorial.new(presentation: self, title: title, image_path: image_path, coords: coords)
|
31
31
|
end
|
32
32
|
|
33
|
+
def add_text_picture_slide(title, image_path, content = [])
|
34
|
+
@slides << Powerpoint::Slide::TextPicSplit.new(presentation: self, title: title, image_path: image_path, content: content)
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_picture_description_slide(title, image_path, content = [])
|
38
|
+
@slides << Powerpoint::Slide::DescriptionPic.new(presentation: self, title: title, image_path: image_path, content: content)
|
39
|
+
end
|
40
|
+
|
33
41
|
def save(path)
|
34
42
|
Dir.mktmpdir do |dir|
|
35
43
|
extract_path = "#{dir}/extract_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}"
|
@@ -46,6 +54,7 @@ module Powerpoint
|
|
46
54
|
render_view('content_type.xml.erb', "#{extract_path}/[Content_Types].xml")
|
47
55
|
render_view('presentation.xml.rel.erb', "#{extract_path}/ppt/_rels/presentation.xml.rels")
|
48
56
|
render_view('presentation.xml.erb', "#{extract_path}/ppt/presentation.xml")
|
57
|
+
render_view('app.xml.erb', "#{extract_path}/docProps/app.xml")
|
49
58
|
|
50
59
|
# Save slides
|
51
60
|
slides.each_with_index do |slide, index|
|
@@ -61,7 +70,7 @@ module Powerpoint
|
|
61
70
|
end
|
62
71
|
|
63
72
|
def file_types
|
64
|
-
slides.
|
73
|
+
slides.map {|slide| slide.file_type if slide.respond_to? :file_type }.compact.uniq
|
65
74
|
end
|
66
75
|
end
|
67
76
|
end
|
@@ -18,7 +18,7 @@ module Powerpoint
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def save(extract_path, index)
|
21
|
-
copy_media(extract_path)
|
21
|
+
copy_media(extract_path, @image_path)
|
22
22
|
save_rel_xml(extract_path, index)
|
23
23
|
save_slide_xml(extract_path, index)
|
24
24
|
end
|
@@ -40,11 +40,6 @@ module Powerpoint
|
|
40
40
|
end
|
41
41
|
private :default_coords
|
42
42
|
|
43
|
-
def copy_media(extract_path)
|
44
|
-
FileUtils.copy_file(@image_path, "#{extract_path}/ppt/media/#{@image_name}")
|
45
|
-
end
|
46
|
-
private :copy_media
|
47
|
-
|
48
43
|
def save_rel_xml(extract_path, index)
|
49
44
|
render_view('pictorial_rel.xml.erb', "#{extract_path}/ppt/slides/_rels/slide#{index}.xml.rels")
|
50
45
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'fastimage'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
module Powerpoint
|
7
|
+
module Slide
|
8
|
+
class DescriptionPic
|
9
|
+
include Powerpoint::Util
|
10
|
+
|
11
|
+
attr_reader :title, :content, :image_name, :image_path, :coords
|
12
|
+
|
13
|
+
def initialize(options={})
|
14
|
+
require_arguments [:presentation, :title, :image_path, :content], options
|
15
|
+
options.each {|k, v| instance_variable_set("@#{k}", v)}
|
16
|
+
@coords = default_coords
|
17
|
+
@image_name = File.basename(@image_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def save(extract_path, index)
|
21
|
+
copy_media(extract_path, @image_path)
|
22
|
+
save_rel_xml(extract_path, index)
|
23
|
+
save_slide_xml(extract_path, index)
|
24
|
+
end
|
25
|
+
|
26
|
+
def file_type
|
27
|
+
File.extname(image_name).gsub('.', '')
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_coords
|
31
|
+
slide_width = pixle_to_pt(720)
|
32
|
+
default_width = pixle_to_pt(550)
|
33
|
+
default_height = pixle_to_pt(300)
|
34
|
+
|
35
|
+
return {} unless dimensions = FastImage.size(image_path)
|
36
|
+
image_width, image_height = dimensions.map {|d| pixle_to_pt(d)}
|
37
|
+
|
38
|
+
capped_width = [default_width, image_width].min
|
39
|
+
w_ratio = capped_width / image_width.to_f
|
40
|
+
|
41
|
+
capped_height = [default_height, image_height].min
|
42
|
+
h_ratio = capped_height / image_height.to_f
|
43
|
+
|
44
|
+
ratio = [w_ratio, h_ratio].min
|
45
|
+
|
46
|
+
new_width = (image_width.to_f * ratio).round
|
47
|
+
new_height = (image_height.to_f * ratio).round
|
48
|
+
{x: (slide_width / 2) - (new_width/2), y: pixle_to_pt(60), cx: new_width, cy: new_height}
|
49
|
+
end
|
50
|
+
private :default_coords
|
51
|
+
|
52
|
+
def save_rel_xml(extract_path, index)
|
53
|
+
render_view('picture_description_rels.xml.erb', "#{extract_path}/ppt/slides/_rels/slide#{index}.xml.rels")
|
54
|
+
end
|
55
|
+
private :save_rel_xml
|
56
|
+
|
57
|
+
def save_slide_xml(extract_path, index)
|
58
|
+
render_view('picture_description_slide.xml.erb', "#{extract_path}/ppt/slides/slide#{index}.xml")
|
59
|
+
end
|
60
|
+
private :save_slide_xml
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'zip/filesystem'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'fastimage'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
module Powerpoint
|
7
|
+
module Slide
|
8
|
+
class TextPicSplit
|
9
|
+
include Powerpoint::Util
|
10
|
+
|
11
|
+
attr_reader :title, :content, :image_name, :image_path, :coords
|
12
|
+
|
13
|
+
def initialize(options={})
|
14
|
+
require_arguments [:presentation, :title, :image_path, :content], options
|
15
|
+
options.each {|k, v| instance_variable_set("@#{k}", v)}
|
16
|
+
@coords = default_coords
|
17
|
+
@image_name = File.basename(@image_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def save(extract_path, index)
|
21
|
+
copy_media(extract_path, @image_path)
|
22
|
+
save_rel_xml(extract_path, index)
|
23
|
+
save_slide_xml(extract_path, index)
|
24
|
+
end
|
25
|
+
|
26
|
+
def file_type
|
27
|
+
File.extname(image_name).gsub('.', '')
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_coords
|
31
|
+
start_x = pixle_to_pt(360)
|
32
|
+
default_width = pixle_to_pt(300)
|
33
|
+
|
34
|
+
return {} unless dimensions = FastImage.size(image_path)
|
35
|
+
image_width, image_height = dimensions.map {|d| pixle_to_pt(d)}
|
36
|
+
new_width = default_width < image_width ? default_width : image_width
|
37
|
+
ratio = new_width / image_width.to_f
|
38
|
+
new_height = (image_height.to_f * ratio).round
|
39
|
+
{x: start_x, y: pixle_to_pt(120), cx: new_width, cy: new_height}
|
40
|
+
end
|
41
|
+
private :default_coords
|
42
|
+
|
43
|
+
def save_rel_xml(extract_path, index)
|
44
|
+
render_view('text_picture_split_rel.xml.erb', "#{extract_path}/ppt/slides/_rels/slide#{index}.xml.rels")
|
45
|
+
end
|
46
|
+
private :save_rel_xml
|
47
|
+
|
48
|
+
def save_slide_xml(extract_path, index)
|
49
|
+
render_view('text_picture_split_slide.xml.erb', "#{extract_path}/ppt/slides/slide#{index}.xml")
|
50
|
+
end
|
51
|
+
private :save_slide_xml
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
data/lib/powerpoint/util.rb
CHANGED
@@ -20,5 +20,11 @@ module Powerpoint
|
|
20
20
|
def require_arguments(required_argements, argements)
|
21
21
|
raise ArgumentError unless required_argements.all? {|required_key| argements.keys.include? required_key}
|
22
22
|
end
|
23
|
+
|
24
|
+
def copy_media(extract_path, image_path)
|
25
|
+
image_name = File.basename(image_path)
|
26
|
+
dest_path = "#{extract_path}/ppt/media/#{image_name}"
|
27
|
+
FileUtils.copy_file(image_path, dest_path) unless File.exist?(dest_path)
|
28
|
+
end
|
23
29
|
end
|
24
30
|
end
|
data/lib/powerpoint/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
3
|
+
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
4
|
+
<TotalTime>0</TotalTime>
|
5
|
+
<Words>43</Words>
|
6
|
+
<Application>Microsoft Macintosh PowerPoint</Application>
|
7
|
+
<PresentationFormat>On-screen Show (4:3)</PresentationFormat>
|
8
|
+
<Paragraphs>15</Paragraphs>
|
9
|
+
<Slides><%= slides.length %></Slides>
|
10
|
+
<Notes>0</Notes>
|
11
|
+
<HiddenSlides>0</HiddenSlides>
|
12
|
+
<MMClips>0</MMClips>
|
13
|
+
<ScaleCrop>false</ScaleCrop>
|
14
|
+
<HeadingPairs>
|
15
|
+
<vt:vector size="6" baseType="variant">
|
16
|
+
<vt:variant>
|
17
|
+
<vt:lpstr>Fonts Used</vt:lpstr>
|
18
|
+
</vt:variant>
|
19
|
+
<vt:variant>
|
20
|
+
<vt:i4>2</vt:i4>
|
21
|
+
</vt:variant>
|
22
|
+
<vt:variant>
|
23
|
+
<vt:lpstr>Theme</vt:lpstr>
|
24
|
+
</vt:variant>
|
25
|
+
<vt:variant>
|
26
|
+
<vt:i4>1</vt:i4>
|
27
|
+
</vt:variant>
|
28
|
+
<vt:variant>
|
29
|
+
<vt:lpstr>Slide Titles</vt:lpstr>
|
30
|
+
</vt:variant>
|
31
|
+
<vt:variant>
|
32
|
+
<vt:i4><%= slides.length %></vt:i4>
|
33
|
+
</vt:variant>
|
34
|
+
</vt:vector>
|
35
|
+
</HeadingPairs>
|
36
|
+
<TitlesOfParts>
|
37
|
+
<vt:vector size="<%= slides.length + 3 %>" baseType="lpstr">
|
38
|
+
<vt:lpstr>Arial</vt:lpstr>
|
39
|
+
<vt:lpstr>Calibri</vt:lpstr>
|
40
|
+
<vt:lpstr>Office Theme</vt:lpstr>
|
41
|
+
<% slides.each do |slide| %>
|
42
|
+
<vt:lpstr><%= slide.title %></vt:lpstr>
|
43
|
+
<% end %>
|
44
|
+
</vt:vector>
|
45
|
+
</TitlesOfParts>
|
46
|
+
<Company></Company>
|
47
|
+
<LinksUpToDate>false</LinksUpToDate>
|
48
|
+
<SharedDoc>false</SharedDoc>
|
49
|
+
<HyperlinksChanged>false</HyperlinksChanged>
|
50
|
+
<AppVersion>15.0000</AppVersion>
|
51
|
+
</Properties>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
3
|
+
<Relationship Id="rId1" Target="../slideLayouts/slideLayout9.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"/>
|
4
|
+
<Relationship Id="rId2" Target="../media/<%= image_name %>" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"/>
|
5
|
+
</Relationships>
|
@@ -0,0 +1,115 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<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">
|
3
|
+
<p:cSld>
|
4
|
+
<p:spTree>
|
5
|
+
<p:nvGrpSpPr>
|
6
|
+
<p:cNvPr id="1" name=""/>
|
7
|
+
<p:cNvGrpSpPr/>
|
8
|
+
<p:nvPr/>
|
9
|
+
</p:nvGrpSpPr>
|
10
|
+
<p:grpSpPr>
|
11
|
+
<a:xfrm>
|
12
|
+
<a:off x="0" y="0"/>
|
13
|
+
<a:ext cx="0" cy="0"/>
|
14
|
+
<a:chOff x="0" y="0"/>
|
15
|
+
<a:chExt cx="0" cy="0"/>
|
16
|
+
</a:xfrm>
|
17
|
+
</p:grpSpPr>
|
18
|
+
<p:sp>
|
19
|
+
<p:nvSpPr>
|
20
|
+
<p:cNvPr id="2" name="Title 1"/>
|
21
|
+
<p:cNvSpPr>
|
22
|
+
<a:spLocks noGrp="1"/>
|
23
|
+
</p:cNvSpPr>
|
24
|
+
<p:nvPr>
|
25
|
+
<p:ph type="title"/>
|
26
|
+
</p:nvPr>
|
27
|
+
</p:nvSpPr>
|
28
|
+
<p:spPr/>
|
29
|
+
<p:txBody>
|
30
|
+
<a:bodyPr/>
|
31
|
+
<a:lstStyle/>
|
32
|
+
<a:p>
|
33
|
+
<a:r>
|
34
|
+
<a:rPr lang="en-US" dirty="0" smtClean="0"/>
|
35
|
+
<a:t><%= title %></a:t>
|
36
|
+
</a:r>
|
37
|
+
<a:endParaRPr lang="en-US" dirty="0"/>
|
38
|
+
</a:p>
|
39
|
+
</p:txBody>
|
40
|
+
</p:sp>
|
41
|
+
<p:pic>
|
42
|
+
<p:nvPicPr>
|
43
|
+
<p:cNvPr id="5" name="Picture Placeholder 4"/>
|
44
|
+
<p:cNvPicPr>
|
45
|
+
<a:picLocks noGrp="1" noChangeAspect="1"/>
|
46
|
+
</p:cNvPicPr>
|
47
|
+
<p:nvPr>
|
48
|
+
<p:ph type="pic" idx="1"/>
|
49
|
+
</p:nvPr>
|
50
|
+
</p:nvPicPr>
|
51
|
+
<p:blipFill>
|
52
|
+
<a:blip r:embed="rId2">
|
53
|
+
<a:extLst>
|
54
|
+
<a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
|
55
|
+
<a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
|
56
|
+
</a:ext>
|
57
|
+
</a:extLst>
|
58
|
+
</a:blip>
|
59
|
+
<a:stretch>
|
60
|
+
<a:fillRect/>
|
61
|
+
</a:stretch>
|
62
|
+
</p:blipFill>
|
63
|
+
<% if coords.any? %>
|
64
|
+
<p:spPr>
|
65
|
+
<a:xfrm>
|
66
|
+
<a:off x="<%= coords[:x].to_s %>" y="<%= coords[:y].to_s %>"/>
|
67
|
+
<a:ext cx="<%= coords[:cx].to_s %>" cy="<%= coords[:cy].to_s %>"/>
|
68
|
+
</a:xfrm>
|
69
|
+
<a:prstGeom prst="rect">
|
70
|
+
<a:avLst/>
|
71
|
+
</a:prstGeom>
|
72
|
+
</p:spPr>
|
73
|
+
<% else %>
|
74
|
+
<p:spPr/>
|
75
|
+
<% end %>
|
76
|
+
</p:pic>
|
77
|
+
<p:sp>
|
78
|
+
<p:nvSpPr>
|
79
|
+
<p:cNvPr id="4" name="Text Placeholder 4"/>
|
80
|
+
<p:cNvSpPr>
|
81
|
+
<a:spLocks noGrp="1"/>
|
82
|
+
</p:cNvSpPr>
|
83
|
+
<p:nvPr>
|
84
|
+
<p:ph type="body" sz="half" idx="2"/>
|
85
|
+
</p:nvPr>
|
86
|
+
</p:nvSpPr>
|
87
|
+
<p:spPr/>
|
88
|
+
<p:txBody>
|
89
|
+
<a:bodyPr/>
|
90
|
+
<a:lstStyle/>
|
91
|
+
<% content.each_with_index do |c, index| %>
|
92
|
+
<a:p>
|
93
|
+
<a:r>
|
94
|
+
<a:rPr lang="en-US" dirty="0" smtClean="0"/>
|
95
|
+
<a:t><%= c %></a:t>
|
96
|
+
</a:r>
|
97
|
+
<% if content.length == (index + 1) %>
|
98
|
+
<a:endParaRPr lang="en-US"/>
|
99
|
+
<% end %>
|
100
|
+
</a:p>
|
101
|
+
<% end %>
|
102
|
+
</p:txBody>
|
103
|
+
</p:sp>
|
104
|
+
|
105
|
+
</p:spTree>
|
106
|
+
<p:extLst>
|
107
|
+
<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
|
108
|
+
<p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1435759726"/>
|
109
|
+
</p:ext>
|
110
|
+
</p:extLst>
|
111
|
+
</p:cSld>
|
112
|
+
<p:clrMapOvr>
|
113
|
+
<a:masterClrMapping/>
|
114
|
+
</p:clrMapOvr>
|
115
|
+
</p:sld>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
3
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout4.xml" />
|
4
|
+
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/<%= image_name %>" />
|
5
|
+
</Relationships>
|
@@ -0,0 +1,114 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<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">
|
3
|
+
<p:cSld>
|
4
|
+
<p:spTree>
|
5
|
+
<p:nvGrpSpPr>
|
6
|
+
<p:cNvPr id="1" name=""/>
|
7
|
+
<p:cNvGrpSpPr/>
|
8
|
+
<p:nvPr/>
|
9
|
+
</p:nvGrpSpPr>
|
10
|
+
<p:grpSpPr>
|
11
|
+
<a:xfrm>
|
12
|
+
<a:off x="0" y="0"/>
|
13
|
+
<a:ext cx="0" cy="0"/>
|
14
|
+
<a:chOff x="0" y="0"/>
|
15
|
+
<a:chExt cx="0" cy="0"/>
|
16
|
+
</a:xfrm>
|
17
|
+
</p:grpSpPr>
|
18
|
+
<p:sp>
|
19
|
+
<p:nvSpPr>
|
20
|
+
<p:cNvPr id="2" name="Title 1"/>
|
21
|
+
<p:cNvSpPr>
|
22
|
+
<a:spLocks noGrp="1"/>
|
23
|
+
</p:cNvSpPr>
|
24
|
+
<p:nvPr>
|
25
|
+
<p:ph type="title"/>
|
26
|
+
</p:nvPr>
|
27
|
+
</p:nvSpPr>
|
28
|
+
<p:spPr/>
|
29
|
+
<p:txBody>
|
30
|
+
<a:bodyPr/>
|
31
|
+
<a:lstStyle/>
|
32
|
+
<a:p>
|
33
|
+
<a:r>
|
34
|
+
<a:rPr lang="en-US" dirty="0" smtClean="0"/>
|
35
|
+
<a:t><%= title %></a:t>
|
36
|
+
</a:r>
|
37
|
+
<a:endParaRPr lang="en-US" dirty="0"/>
|
38
|
+
</a:p>
|
39
|
+
</p:txBody>
|
40
|
+
</p:sp>
|
41
|
+
<p:sp>
|
42
|
+
<p:nvSpPr>
|
43
|
+
<p:cNvPr id="3" name="Content Placeholder 2"/>
|
44
|
+
<p:cNvSpPr>
|
45
|
+
<a:spLocks noGrp="1"/>
|
46
|
+
</p:cNvSpPr>
|
47
|
+
<p:nvPr>
|
48
|
+
<p:ph sz="half" idx="1"/>
|
49
|
+
</p:nvPr>
|
50
|
+
</p:nvSpPr>
|
51
|
+
<p:spPr/>
|
52
|
+
<p:txBody>
|
53
|
+
<a:bodyPr/>
|
54
|
+
<a:lstStyle/>
|
55
|
+
<% content.each_with_index do |c, index| %>
|
56
|
+
<a:p>
|
57
|
+
<a:r>
|
58
|
+
<a:rPr lang="en-US" dirty="0" smtClean="0"/>
|
59
|
+
<a:t><%= c %></a:t>
|
60
|
+
</a:r>
|
61
|
+
<% if content.length == (index + 1) %>
|
62
|
+
<a:endParaRPr lang="en-US"/>
|
63
|
+
<% end %>
|
64
|
+
</a:p>
|
65
|
+
<% end %>
|
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 sz="half" idx="2"/>
|
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>
|
90
|
+
<% if coords.any? %>
|
91
|
+
<p:spPr>
|
92
|
+
<a:xfrm>
|
93
|
+
<a:off x="<%= coords[:x].to_s %>" y="<%= coords[:y].to_s %>"/>
|
94
|
+
<a:ext cx="<%= coords[:cx].to_s %>" cy="<%= coords[:cy].to_s %>"/>
|
95
|
+
</a:xfrm>
|
96
|
+
<a:prstGeom prst="rect">
|
97
|
+
<a:avLst/>
|
98
|
+
</a:prstGeom>
|
99
|
+
</p:spPr>
|
100
|
+
<% else %>
|
101
|
+
<p:spPr/>
|
102
|
+
<% end %>
|
103
|
+
</p:pic>
|
104
|
+
</p:spTree>
|
105
|
+
<p:extLst>
|
106
|
+
<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
|
107
|
+
<p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1435759726"/>
|
108
|
+
</p:ext>
|
109
|
+
</p:extLst>
|
110
|
+
</p:cSld>
|
111
|
+
<p:clrMapOvr>
|
112
|
+
<a:masterClrMapping/>
|
113
|
+
</p:clrMapOvr>
|
114
|
+
</p:sld>
|
data/samples/pptx/sample.pptx
CHANGED
Binary file
|
data/spec/test_spec.rb
CHANGED
@@ -6,8 +6,11 @@ describe 'Powerpoint parsing a sample PPTX file' do
|
|
6
6
|
@deck.add_intro 'Bicycle Of the Mind', 'created by Steve Jobs'
|
7
7
|
@deck.add_textual_slide 'Why Mac?', ['Its cool!', 'Its light!']
|
8
8
|
@deck.add_textual_slide 'Why Iphone?', ['Its fast!', 'Its cheap!']
|
9
|
-
@deck.add_pictorial_slide 'JPG Logo', 'samples/images/
|
9
|
+
@deck.add_pictorial_slide 'JPG Logo', 'samples/images/sample_png.png'
|
10
|
+
@deck.add_text_picture_slide('Text Pic Split', 'samples/images/sample_png.png', content = ['Here is a string', 'here is another'])
|
10
11
|
@deck.add_pictorial_slide 'PNG Logo', 'samples/images/sample_png.png'
|
12
|
+
@deck.add_picture_description_slide('Pic Desc', 'samples/images/sample_png.png', content = ['Here is a string', 'here is another'])
|
13
|
+
@deck.add_picture_description_slide('JPG Logo', 'samples/images/sample_jpg.jpg', content = ['descriptions'])
|
11
14
|
@deck.add_pictorial_slide 'GIF Logo', 'samples/images/sample_gif.gif', {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}
|
12
15
|
@deck.add_textual_slide 'Why Android?', ['Its great!', 'Its sweet!']
|
13
16
|
@deck.save 'samples/pptx/sample.pptx' # Examine the PPTX file
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: powerpoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pythonicrubyist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.13.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.13.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubyzip
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: fastimage
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1'
|
97
97
|
description: A Ruby gem that can create a PowerPoint presentation.
|
@@ -101,8 +101,8 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- .codeclimate.yml
|
105
|
-
- .gitignore
|
104
|
+
- ".codeclimate.yml"
|
105
|
+
- ".gitignore"
|
106
106
|
- Gemfile
|
107
107
|
- LICENSE.txt
|
108
108
|
- README.rdoc
|
@@ -112,15 +112,22 @@ files:
|
|
112
112
|
- lib/powerpoint/presentation.rb
|
113
113
|
- lib/powerpoint/slide/intro.rb
|
114
114
|
- lib/powerpoint/slide/pictorial.rb
|
115
|
+
- lib/powerpoint/slide/picture_description.rb
|
116
|
+
- lib/powerpoint/slide/text_picture_split.rb
|
115
117
|
- lib/powerpoint/slide/textual.rb
|
116
118
|
- lib/powerpoint/util.rb
|
117
119
|
- lib/powerpoint/version.rb
|
120
|
+
- lib/powerpoint/views/app.xml.erb
|
118
121
|
- lib/powerpoint/views/content_type.xml.erb
|
119
122
|
- lib/powerpoint/views/intro_slide.xml.erb
|
120
123
|
- lib/powerpoint/views/pictorial_rel.xml.erb
|
121
124
|
- lib/powerpoint/views/pictorial_slide.xml.erb
|
125
|
+
- lib/powerpoint/views/picture_description_rels.xml.erb
|
126
|
+
- lib/powerpoint/views/picture_description_slide.xml.erb
|
122
127
|
- lib/powerpoint/views/presentation.xml.erb
|
123
128
|
- lib/powerpoint/views/presentation.xml.rel.erb
|
129
|
+
- lib/powerpoint/views/text_picture_split_rel.xml.erb
|
130
|
+
- lib/powerpoint/views/text_picture_split_slide.xml.erb
|
124
131
|
- lib/powerpoint/views/textual_rel.xml.erb
|
125
132
|
- lib/powerpoint/views/textual_slide.xml.erb
|
126
133
|
- powerpoint.gemspec
|
@@ -130,7 +137,6 @@ files:
|
|
130
137
|
- samples/pptx/sample.pptx
|
131
138
|
- spec/test_spec.rb
|
132
139
|
- template/_rels/.rels
|
133
|
-
- template/docProps/app.xml
|
134
140
|
- template/docProps/core.xml
|
135
141
|
- template/ppt/_rels/.keep
|
136
142
|
- template/ppt/media/.keep
|
@@ -173,12 +179,12 @@ require_paths:
|
|
173
179
|
- lib
|
174
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
175
181
|
requirements:
|
176
|
-
- -
|
182
|
+
- - ">="
|
177
183
|
- !ruby/object:Gem::Version
|
178
184
|
version: 1.9.2
|
179
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
186
|
requirements:
|
181
|
-
- -
|
187
|
+
- - ">="
|
182
188
|
- !ruby/object:Gem::Version
|
183
189
|
version: '0'
|
184
190
|
requirements: []
|
data/template/docProps/app.xml
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
-
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><TotalTime>0</TotalTime><Words>43</Words><Application>Microsoft Macintosh PowerPoint</Application><PresentationFormat>On-screen Show (4:3)</PresentationFormat><Paragraphs>15</Paragraphs><Slides>8</Slides><Notes>0</Notes><HiddenSlides>0</HiddenSlides><MMClips>0</MMClips><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="6" baseType="variant"><vt:variant><vt:lpstr>Fonts Used</vt:lpstr></vt:variant><vt:variant><vt:i4>2</vt:i4></vt:variant><vt:variant><vt:lpstr>Theme</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant><vt:variant><vt:lpstr>Slide Titles</vt:lpstr></vt:variant><vt:variant><vt:i4>8</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="11" baseType="lpstr"><vt:lpstr>Arial</vt:lpstr><vt:lpstr>Calibri</vt:lpstr><vt:lpstr>Office Theme</vt:lpstr><vt:lpstr>Bicycle Of the Mind</vt:lpstr><vt:lpstr>Why Mac?</vt:lpstr><vt:lpstr>Why Iphone?</vt:lpstr><vt:lpstr>JPG Logo</vt:lpstr><vt:lpstr>PNG Logo</vt:lpstr><vt:lpstr>GIF Logo</vt:lpstr><vt:lpstr>SVG Logo</vt:lpstr><vt:lpstr>Why Android?</vt:lpstr></vt:vector></TitlesOfParts><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>15.0000</AppVersion></Properties>
|