class Excelgrip::Workbook
¶ ↑
Workbook
Class =================¶ ↑
¶ ↑
Public Instance Methods
[](sheet_name)
click to toggle source
# File lib/excelgrip.rb, line 104 def [](sheet_name) raw_worksheet = @raw_object.Worksheets(sheet_name) raw_worksheet.Activate Worksheet.new(raw_worksheet) end
Also aliased as: open_sheet
add_sheet(source_sheet)
click to toggle source
# File lib/excelgrip.rb, line 122 def add_sheet(source_sheet) last_sheet_no = @raw_object.worksheets.count source_sheet.copy({'after' => @raw_object.worksheets(last_sheet_no)}) raw_worksheet = @raw_object.sheets(last_sheet_no + 1) Worksheet.new(raw_worksheet) end
close()
click to toggle source
# File lib/excelgrip.rb, line 145 def close @raw_object.Close @raw_object = nil end
each_sheet() { |worksheet| ... }
click to toggle source
# File lib/excelgrip.rb, line 134 def each_sheet @raw_object.worksheets.each {|raw_worksheet| raw_worksheet.Activate yield Worksheet.new(raw_worksheet) } end
parent()
click to toggle source
# File lib/excelgrip.rb, line 141 def parent @raw_object.parent end
save(filename)
click to toggle source
# File lib/excelgrip.rb, line 129 def save(filename) fullpath = FileSystemObject.instance.fullpath(filename) @raw_object.saveAs({'filename'=>fullpath}) end
worksheets(index=nil)
click to toggle source
# File lib/excelgrip.rb, line 112 def worksheets(index=nil) if index self[index] else Worksheets.new(@raw_object.worksheets) end end
Also aliased as: sheets