Class: Excel::App

Inherits:
Object
  • Object
show all
Defined in:
lib/Excel/app.rb

Class Method Summary collapse

Class Method Details

.app_objectObject



14
15
16
# File 'lib/Excel/app.rb', line 14

def self.app_object
  @app_object
end

.closeObject



43
44
45
46
47
48
49
# File 'lib/Excel/app.rb', line 43

def self.close
  app_object.run
  app_object.activate
  app_object.workbooks.saved.set(true)
  app_object.workbooks.close
  app_object.quit
end

.open(params) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/Excel/app.rb', line 18

def self.open(params)
  file_path = MacTypes::Alias.path(params[:path])
  app_object.run
  app_object.activate

  app_object.open file_path

  File.basename(file_path.path)
end

.save_allObject



51
52
53
# File 'lib/Excel/app.rb', line 51

def self.save_all
  app_object.save
end

.workbook(wb) ⇒ Object



38
39
40
41
# File 'lib/Excel/app.rb', line 38

def self.workbook wb
  # raise "Workbook not found" if !(workbooks.include? wb)
  WorkBook.new(self, wb)
end

.workbooksObject



28
29
30
31
# File 'lib/Excel/app.rb', line 28

def self.workbooks
  return [] if app_object.workbooks.get == :missing_value
  app_object.workbooks.get.collect {|wb| wb.name.get }
end

.workbooks_pathsObject



33
34
35
36
# File 'lib/Excel/app.rb', line 33

def self.workbooks_paths
  return [] if app_object.workbooks.get == :missing_value
  app_object.workbooks.get.collect {|wb| "#{MacTypes::FileURL.hfs_path(wb.path.get).path}/#{wb.name.get}" }
end