Class: OoxmlParser::Presentation
- Inherits:
-
CommonDocumentStructure
- Object
- OOXMLDocumentObject
- CommonDocumentStructure
- OoxmlParser::Presentation
- Includes:
- PresentationHelpers
- Defined in:
- lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#relationships ⇒ Relationships
Relationships of presentation.
-
#slide_size ⇒ Object
Returns the value of attribute slide_size.
-
#slides ⇒ Object
Returns the value of attribute slides.
-
#theme ⇒ Object
Returns the value of attribute theme.
Attributes inherited from CommonDocumentStructure
Attributes inherited from OOXMLDocumentObject
Class Method Summary collapse
-
.default_font_size ⇒ FixNum
Default_font_typeface.
-
.default_font_typeface ⇒ String
Default_font_typeface.
- .parse ⇒ Object
Instance Method Summary collapse
-
#initialize(slides = [], theme = nil, comments = []) ⇒ Presentation
constructor
A new instance of Presentation.
Methods included from PresentationHelpers
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(slides = [], theme = nil, comments = []) ⇒ Presentation
Returns a new instance of Presentation.
13 14 15 16 17 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 13 def initialize( = [], theme = nil, comments = []) @slides = @theme = theme @comments = comments end |
Class Attribute Details
Instance Attribute Details
#comments ⇒ Object
Returns the value of attribute comments.
9 10 11 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 9 def comments @comments end |
#relationships ⇒ Relationships
Returns relationships of presentation.
11 12 13 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 11 def relationships @relationships end |
#slide_size ⇒ Object
Returns the value of attribute slide_size.
9 10 11 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 9 def @slide_size end |
#slides ⇒ Object
Returns the value of attribute slides.
9 10 11 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 9 def @slides end |
#theme ⇒ Object
Returns the value of attribute theme.
9 10 11 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 9 def theme @theme end |
Class Method Details
.default_font_size ⇒ FixNum
Returns default_font_typeface.
62 63 64 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 62 def default_font_size 18 end |
.default_font_typeface ⇒ String
Returns default_font_typeface.
57 58 59 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 57 def default_font_typeface 'Arial' end |
.parse ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb', line 19 def self.parse OOXMLDocumentObject.root_subfolder = 'ppt/' OOXMLDocumentObject.xmls_stack = [] OOXMLDocumentObject.add_to_xmls_stack('ppt/presentation.xml') doc = Nokogiri::XML(File.open(OOXMLDocumentObject.current_xml)) presentation = Presentation.new presentation.theme = PresentationTheme.parse('ppt/theme/theme1.xml') presentation_node = doc.search('//p:presentation').first presentation_node.xpath('*').each do |presentation_node_child| case presentation_node_child.name when 'sldSz' presentation. = SlideSize.new(parent: presentation).parse(presentation_node_child) when 'sldIdLst' presentation_node_child.xpath('p:sldId').each do |silde_id_node| id = nil silde_id_node.attribute_nodes.select { |node| id = node.to_s if node.namespace && node.namespace.prefix == 'r' } presentation. << Slide.new(parent: presentation, xml_path: "#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(id)}") .parse end end end presentation.comments = PresentationComment.parse_list OOXMLDocumentObject.xmls_stack.pop presentation.relationships = Relationships.parse_rels("#{OOXMLDocumentObject.path_to_folder}/ppt/_rels/presentation.xml.rels") presentation end |