Class: Konjac::Office::Mac::PowerPoint

Inherits:
Shared
  • Object
show all
Defined in:
lib/konjac/office/mac/power_point.rb

Overview

PowerPoint for Mac

Instance Attribute Summary

Attributes inherited from Base

#document

Instance Method Summary collapse

Methods inherited from Shared

#close, #open, #path

Methods inherited from Base

#[], #[]=, #export, #import, #read, #shape_at, #tags, #write

Constructor Details

#initialize(path = nil) ⇒ PowerPoint

Creates a new PowerPoint object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/konjac/office/mac/power_point.rb', line 8

def initialize(path = nil)
  super "Microsoft PowerPoint", path
  @strippable = //
  @parse_order = [:slide, :shape]
  @item_opts.merge!({
    :ref_path     => [:slide, :shape],
    :content_path => [:text_frame, :text_range, :content],
    :strippable   => //
  })
  @shape_opts = @item_opts
end

Instance Method Details

#active_documentObject

Retrieves the active document and caches it



21
22
23
# File 'lib/konjac/office/mac/power_point.rb', line 21

def active_document
  @active_document ||= @application.active_presentation
end

#dataObject

Creates a dump of the spreadsheet’s data in Tag form



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/konjac/office/mac/power_point.rb', line 26

def data
  tags = []
  @document.slides.get.each_with_index do |slide, sl|
    slide.shapes.get.each_with_index do |shape, sh|
      temp = Tag.new
      temp.indices = [sl + 1, sh + 1]
      temp.removed = temp.added = read(sl + 1, sh + 1)
      tags << temp unless temp.blank?
    end
  end
  tags
end

#sizeObject Also known as: length

Retrieves the number of cells in the document. Note that this method fetches all row and column elements and can thus be very expensive for large spreadsheets.



42
43
# File 'lib/konjac/office/mac/power_point.rb', line 42

def size
end