Class: OoxmlParser::Presentation
- Inherits:
-
CommonDocumentStructure
- Object
- OOXMLDocumentObject
- CommonDocumentStructure
- OoxmlParser::Presentation
- Includes:
- PresentationHelpers, SlideLayoutsHelper, SlideMastersHelper
- Defined in:
- lib/ooxml_parser/pptx_parser/presentation.rb
Overview
Basic class for all parsed pptx data
Instance Attribute Summary collapse
-
#comment_authors ⇒ CommentAuthors
readonly
Authors of presentation.
-
#comments ⇒ PresentationComments
readonly
Comments of presentation.
-
#relationships ⇒ Relationships
Relationships of presentation.
-
#slide_layouts ⇒ Array<SlideLayout>
readonly
List of slide layouts.
-
#slide_masters ⇒ Array<SlideMasterFile>
readonly
List of slide master.
-
#slide_size ⇒ Object
Returns the value of attribute slide_size.
-
#slides ⇒ Object
Returns the value of attribute slides.
-
#table_styles ⇒ TableStyles
Table styles data.
-
#theme ⇒ Object
Returns the value of attribute theme.
Attributes inherited from CommonDocumentStructure
#content_types, #default_font_size, #default_font_style, #default_font_typeface, #file_path, #root_subfolder, #unpacked_folder, #xmls_stack
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Presentation
constructor
A new instance of Presentation.
-
#parse ⇒ Presentation
Parse data of presentation.
Methods included from SlideMastersHelper
Methods included from SlideLayoutsHelper
Methods included from PresentationHelpers
Methods inherited from CommonDocumentStructure
#add_to_xmls_stack, #current_xml, #get_link_from_rels
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(params = {}) ⇒ Presentation
Returns a new instance of Presentation.
34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 34 def initialize(params = {}) @slides = [] @comments = [] @slide_masters = [] @slide_layouts = [] super end |
Instance Attribute Details
#comment_authors ⇒ CommentAuthors (readonly)
Returns authors of presentation.
26 27 28 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 26 def @comment_authors end |
#comments ⇒ PresentationComments (readonly)
Returns comments of presentation.
28 29 30 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 28 def comments @comments end |
#relationships ⇒ Relationships
Returns relationships of presentation.
22 23 24 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 22 def relationships @relationships end |
#slide_layouts ⇒ Array<SlideLayout> (readonly)
Returns list of slide layouts.
32 33 34 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 32 def @slide_layouts end |
#slide_masters ⇒ Array<SlideMasterFile> (readonly)
Returns list of slide master.
30 31 32 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 30 def @slide_masters end |
#slide_size ⇒ Object
Returns the value of attribute slide_size.
20 21 22 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 20 def @slide_size end |
#slides ⇒ Object
Returns the value of attribute slides.
20 21 22 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 20 def @slides end |
#table_styles ⇒ TableStyles
Returns table styles data.
24 25 26 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 24 def table_styles @table_styles end |
#theme ⇒ Object
Returns the value of attribute theme.
20 21 22 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 20 def theme @theme end |
Instance Method Details
#parse ⇒ Presentation
Parse data of presentation
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ooxml_parser/pptx_parser/presentation.rb', line 44 def parse @content_types = ContentTypes.new(parent: self).parse @root_subfolder = 'ppt/' root_object.add_to_xmls_stack('ppt/presentation.xml') doc = parse_xml(root_object.current_xml) @theme = PresentationTheme.new(parent: self).parse('ppt/theme/theme1.xml') @table_styles = TableStyles.new(parent: self).parse @comment_authors = CommentAuthors.new(parent: self).parse @comments = PresentationComments.new(parent: self).parse presentation_node = doc.search('//p:presentation').first presentation_node.xpath('*').each do |presentation_node_child| case presentation_node_child.name when 'sldSz' @slide_size = SlideSize.new(parent: self).parse(presentation_node_child) when 'sldIdLst' presentation_node_child.xpath('p:sldId').each do |silde_id_node| = silde_id_node.attr('r:id') @slides << Slide.new(parent: self, xml_path: "#{root_object.root_subfolder}/#{root_object.get_link_from_rels()}") .parse end end end root_object.xmls_stack.pop @relationships = Relationships.new(parent: self).parse_file("#{root_object.unpacked_folder}/ppt/_rels/presentation.xml.rels") self end |