Class: RobustExcelOle::Workbook
- Inherits:
-
RangeOwners
- Object
- Base
- VbaObjects
- RangeOwners
- RobustExcelOle::Workbook
- Defined in:
- lib/robust_excel_ole/workbook.rb
Overview
This class essentially wraps a Win32Ole Workbook object. You can apply all VBA methods (starting with a capital letter) that you would apply for a Workbook object. See docs.microsoft.com/en-us/office/vba/api/excel.workbook#methods
Constant Summary collapse
- CORE_DEFAULT_OPEN_OPTS =
{ :default => {:excel => :current}, :force => {}, :update_links => :never }.freeze
- DEFAULT_OPEN_OPTS =
{ :if_unsaved => :raise, :if_obstructed => :raise, :if_absent => :raise, :if_exists => :raise }.merge(CORE_DEFAULT_OPEN_OPTS).freeze
- ABBREVIATIONS =
[ [:default,:d], [:force, :f], [:excel, :e], [:visible, :v], [:if_obstructed, :if_blocked] ].freeze
Instance Attribute Summary collapse
-
#excel ⇒ Object
readonly
Returns the value of attribute excel.
-
#ole_workbook ⇒ Object
readonly
include General.
-
#stored_filename ⇒ Object
readonly
Returns the value of attribute stored_filename.
Class Method Summary collapse
-
.close(file, opts = {:if_unsaved => :raise}) ⇒ Object
closes a given file if it is open.
-
.create(filename, opts = { }) ⇒ Object
creates, i.e., opens a new, empty workbook, and saves it under a given filename.
- .for_modifying(arg, opts = { }, &block) ⇒ Object
- .for_reading(arg, opts = { }, &block) ⇒ Object
-
.new(file_or_workbook, opts = { }) ⇒ Workbook
opens a workbook.
- .process_options(opts, proc_opts = {:use_defaults => true}) ⇒ Object
-
.save(file) ⇒ Object
saves a given file if it is open.
-
.save_as(file, new_file, opts = { }) ⇒ Object
saves a given file under a new name if it is open.
- .set_was_open(hash, value) ⇒ Object
- .translate(opts) ⇒ Object
-
.unobtrusively(file_or_workbook, opts = { }, &block) ⇒ Workbook
allows to read or modify a workbook such that its state remains unchanged state comprises: open, saved, writable, visible, calculation mode, check compatibility.
Instance Method Summary collapse
-
#==(other_book) ⇒ Boolean
True, if the full workbook names and excel Instances are identical, false otherwise.
-
#[](name) ⇒ Object
returns the value of a range.
-
#[]=(name, value) ⇒ Object
sets the value of a range.
-
#add_or_copy_sheet(sheet = nil, opts = { }) ⇒ Worksheet
copies a sheet to another position if a sheet is given, or adds an empty sheet default: copied or empty sheet is appended, i.e.
-
#add_sheet(sheet = nil, opts = { }) ⇒ Object
for compatibility to older versions.
-
#alive? ⇒ Boolean
returns true, if the workbook reacts to methods, false otherwise.
- #calculation ⇒ Object
-
#close(opts = {:if_unsaved => :raise}) ⇒ Object
closes the workbook, if it is alive options: :if_unsaved if the workbook is unsaved :raise -> raises an exception :save -> saves the workbook before it is closed :forget -> closes the workbook :keep_open -> keep the workbook open :alert or :excel -> gives control to excel.
-
#copy_sheet(sheet, opts = { }) ⇒ Object
for compatibility to older versions.
- #each ⇒ Object
- #each_with_index(offset = 0) ⇒ Object
-
#filename ⇒ Object
returns the full file name of the workbook.
- #first_sheet ⇒ Object
-
#focus ⇒ Object
brings workbook to foreground, makes it available for heyboard inputs, makes the Excel instance visible.
- #for_modifying(opts = { }, &block) ⇒ Object
- #for_reading(opts = { }, &block) ⇒ Object
-
#for_this_workbook(opts) ⇒ Object
sets options.
-
#initialize(file_or_workbook, opts) ⇒ Workbook
constructor
creates a new Workbook object, if a file name is given Promotes the win32ole workbook to a Workbook object, if a win32ole-workbook is given.
- #last_sheet ⇒ Object
-
#retain_saved ⇒ Object
keeps the saved-status unchanged.
- #set_was_open(hash, value) ⇒ Object
-
#sheet(name) ⇒ Object
returns a sheet, if a sheet name or a number is given.
- #unobtrusively(opts = { }, &block) ⇒ Object
-
#visible ⇒ Object
returns true, if the workbook is visible, false otherwise.
-
#visible=(visible_value) ⇒ Object
makes both the Excel instance and the window of the workbook visible, or the window invisible does not do anything if geben visible_value is nil.
-
#window_visible ⇒ Object
returns true, if the window of the workbook is set to visible, false otherwise.
-
#window_visible=(visible_value) ⇒ Object
makes the window of the workbook visible or invisible.
- #worksheets ⇒ Object
- #worksheets_count ⇒ Object
Methods inherited from RangeOwners
#add_name, #delete_name, #name2range, #namevalue, #namevalue_glob, #range, #rename_range, #set_name, #set_namevalue, #set_namevalue_glob
Methods inherited from VbaObjects
Constructor Details
#initialize(file_or_workbook, opts) ⇒ Workbook
creates a new Workbook object, if a file name is given Promotes the win32ole workbook to a Workbook object, if a win32ole-workbook is given
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/robust_excel_ole/workbook.rb', line 147 def initialize(file_or_workbook, opts) if file_or_workbook.is_a? WIN32OLE @ole_workbook = file_or_workbook ole_excel = begin @ole_workbook.Application rescue WIN32OLERuntimeError raise ExcelREOError, 'could not determine the Excel instance' end @excel = excel_class.new(ole_excel) filename = @ole_workbook.Fullname.tr('\\','/') else filename = file_or_workbook ensure_workbook(filename, opts) end (filename, opts) store_myself if block_given? begin yield self ensure close end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/robust_excel_ole/workbook.rb', line 1042 def method_missing(name, *args) if name.to_s[0,1] =~ /[A-Z]/ raise ObjectNotAlive, 'method missing: workbook not alive' unless alive? if ::ERRORMESSAGE_JRUBY_BUG begin @ole_workbook.send(name, *args) rescue Java::OrgRacobCom::ComFailException raise VBAMethodMissingError, "unknown VBA property or method #{name.inspect}" end else begin @ole_workbook.send(name, *args) rescue NoMethodError raise VBAMethodMissingError, "unknown VBA property or method #{name.inspect}" end end else super end end |
Instance Attribute Details
#excel ⇒ Object (readonly)
Returns the value of attribute excel
17 18 19 |
# File 'lib/robust_excel_ole/workbook.rb', line 17 def excel @excel end |
#ole_workbook ⇒ Object (readonly)
include General
16 17 18 |
# File 'lib/robust_excel_ole/workbook.rb', line 16 def ole_workbook @ole_workbook end |
#stored_filename ⇒ Object (readonly)
Returns the value of attribute stored_filename
18 19 20 |
# File 'lib/robust_excel_ole/workbook.rb', line 18 def stored_filename @stored_filename end |
Class Method Details
.close(file, opts = {:if_unsaved => :raise}) ⇒ Object
closes a given file if it is open
752 753 754 755 756 757 758 759 |
# File 'lib/robust_excel_ole/workbook.rb', line 752 def self.close(file, opts = {:if_unsaved => :raise}) book = begin bookstore.fetch(file) rescue nil end book.close(opts) if book && book.alive? end |
.create(filename, opts = { }) ⇒ Object
creates, i.e., opens a new, empty workbook, and saves it under a given filename
479 480 481 |
# File 'lib/robust_excel_ole/workbook.rb', line 479 def self.create(filename, opts = { }) open(filename, :if_absent => :create) end |
.for_modifying(arg, opts = { }, &block) ⇒ Object
550 551 552 |
# File 'lib/robust_excel_ole/workbook.rb', line 550 def self.(arg, opts = { }, &block) unobtrusively(arg, {:writable => true}.merge(opts), &block) end |
.for_reading(arg, opts = { }, &block) ⇒ Object
546 547 548 |
# File 'lib/robust_excel_ole/workbook.rb', line 546 def self.for_reading(arg, opts = { }, &block) unobtrusively(arg, {:writable => false}.merge(opts), &block) end |
.new(file_or_workbook, opts = { }) ⇒ Workbook
opens a workbook. options: :default : if the workbook was already open before, then use (unchange) its properties,
otherwise, i.e. if the workbook cannot be reopened, use the properties stated in :default
:force : no matter whether the workbook was already open before, use the properties stated in :force :default and :force contain: :excel
:excel :current (or :active or :reuse)
-> connects to a running (the first opened) Excel instance,
excluding the hidden Excel instance, if it exists,
otherwise opens in a new Excel instance.
:new -> opens in a new Excel instance
<excel-instance> -> opens in the given Excel instance
:visible true, false, or nil (default)
alternatives: :default_excel, :force_excel, :visible, :d, :f, :e, :v
:if_unsaved if an unsaved workbook with the same name is open, then
:raise -> raises an exception
:forget -> close the unsaved workbook, open the new workbook
:accept -> lets the unsaved workbook open
:alert or :excel -> gives control to Excel
:new_excel -> opens the new workbook in a new Excel instance
:if_obstructed if a workbook with the same name in a different path is open, then or :raise -> raises an exception :if_blocked :forget -> closes the old workbook, open the new workbook
:save -> saves the old workbook, close it, open the new workbook
:close_if_saved -> closes the old workbook and open the new workbook, if the old workbook is saved,
otherwise raises an exception.
:new_excel -> opens the new workbook in a new Excel instance
:if_absent :raise -> raises an exception , if the file does not exists
:create -> creates a new Excel file, if it does not exists
:read_only true -> opens in read-only mode :visible true -> makes the workbook visible :check_compatibility true -> check compatibility when saving :update_links true -> user is being asked how to update links, false -> links are never updated
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/robust_excel_ole/workbook.rb', line 88 def self.new(file_or_workbook, opts = { }) (opts) case file_or_workbook when NilClass raise FileNameNotGiven, 'filename is nil' when WIN32OLE file = file_or_workbook.Fullname.tr('\\','/') when Workbook file = file_or_workbook.Fullname.tr('\\','/') when String file = file_or_workbook raise FileNotFound, "file #{General.absolute_path(file).inspect} is a directory" if File.directory?(file) else raise TypeREOError, 'given object is neither a filename, a Win32ole, nor a Workbook object' end # try to fetch the workbook from the bookstore set_was_open opts, file_or_workbook.is_a?(WIN32OLE) book = nil if opts[:force][:excel] != :new # if readonly is true, then prefer a book that is given in force_excel if this option is set forced_excel = begin (opts[:force][:excel].nil? || opts[:force][:excel] == :current) ? (excel_class.new(:reuse => true) if !::CONNECT_JRUBY_BUG) : opts[:force][:excel].to_reo.excel rescue NoMethodError raise TypeREOError, "provided Excel option value is neither an Excel object nor a valid option" end begin book = if File.exists?(file) bookstore.fetch(file, :prefer_writable => !(opts[:read_only]), :prefer_excel => (opts[:read_only] ? forced_excel : nil)) end rescue raise #trace "#{$!.message}" end if book set_was_open opts, book.alive? # drop the fetched workbook if it shall be opened in another Excel instance # or the workbook is an unsaved workbook that should not be accepted if (opts[:force][:excel].nil? || opts[:force][:excel] == :current || forced_excel == book.excel) && !(book.alive? && !book.saved && (opts[:if_unsaved] != :accept)) opts[:force][:excel] = book.excel if book.excel && book.excel.alive? book.ensure_workbook(file,opts) book.send :apply_options, file, opts return book end end end super(file_or_workbook, opts) end |
.process_options(opts, proc_opts = {:use_defaults => true}) ⇒ Object
182 183 184 185 186 187 |
# File 'lib/robust_excel_ole/workbook.rb', line 182 def self.(opts, proc_opts = {:use_defaults => true}) translate(opts) default_opts = (proc_opts[:use_defaults] ? DEFAULT_OPEN_OPTS : CORE_DEFAULT_OPEN_OPTS).dup translate(default_opts) opts.merge!(default_opts) { |key, v1, v2| !v2.is_a?(Hash) ? v1 : v2.merge(v1 || {}) } end |
.save(file) ⇒ Object
saves a given file if it is open
762 763 764 765 |
# File 'lib/robust_excel_ole/workbook.rb', line 762 def self.save(file) book = bookstore.fetch(file) rescue nil book.save if book && book.alive? end |
.save_as(file, new_file, opts = { }) ⇒ Object
saves a given file under a new name if it is open
768 769 770 771 772 773 774 775 |
# File 'lib/robust_excel_ole/workbook.rb', line 768 def self.save_as(file, new_file, opts = { }) book = begin bookstore.fetch(file) rescue nil end book.save_as(new_file, opts) if book && book.alive? end |
.set_was_open(hash, value) ⇒ Object
174 175 176 |
# File 'lib/robust_excel_ole/workbook.rb', line 174 def self.set_was_open(hash, value) hash[:was_open] = value if hash.has_key?(:was_open) end |
.translate(opts) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/robust_excel_ole/workbook.rb', line 189 def self.translate(opts) erg = {} opts.each do |key,value| new_key = key ABBREVIATIONS.each { |long,short| new_key = long if key == short } if value.is_a?(Hash) erg[new_key] = {} value.each do |k,v| new_k = k ABBREVIATIONS.each { |l,s| new_k = l if k == s } erg[new_key][new_k] = v end else erg[new_key] = value end end opts.merge!(erg) opts[:default] ||= {} opts[:force] ||= {} force_list = [:visible, :excel] opts.each { |key,value| opts[:force][key] = value if force_list.include?(key) } opts[:default][:excel] = opts[:default_excel] unless opts[:default_excel].nil? opts[:force][:excel] = opts[:force_excel] unless opts[:force_excel].nil? opts[:default][:excel] = :current if opts[:default][:excel] == :reuse || opts[:default][:excel] == :active opts[:force][:excel] = :current if opts[:force][:excel] == :reuse || opts[:force][:excel] == :active end |
.unobtrusively(file_or_workbook, opts = { }, &block) ⇒ Workbook
allows to read or modify a workbook such that its state remains unchanged state comprises: open, saved, writable, visible, calculation mode, check compatibility
563 564 565 566 |
# File 'lib/robust_excel_ole/workbook.rb', line 563 def self.unobtrusively(file_or_workbook, opts = { }, &block) file = (file_or_workbook.is_a? WIN32OLE) ? file_or_workbook.Fullname.tr('\\','/') : file_or_workbook unobtrusively_opening(file, opts, nil, &block) end |
Instance Method Details
#==(other_book) ⇒ Boolean
Returns true, if the full workbook names and excel Instances are identical, false otherwise.
971 972 973 974 975 |
# File 'lib/robust_excel_ole/workbook.rb', line 971 def == other_book other_book.is_a?(Workbook) && @excel == other_book.excel && self.filename == other_book.filename end |
#[](name) ⇒ Object
returns the value of a range
884 885 886 |
# File 'lib/robust_excel_ole/workbook.rb', line 884 def [] name namevalue_glob(name) end |
#[]=(name, value) ⇒ Object
sets the value of a range
891 892 893 |
# File 'lib/robust_excel_ole/workbook.rb', line 891 def []= (name, value) set_namevalue_glob(name, value, :color => 42) end |
#add_or_copy_sheet(sheet = nil, opts = { }) ⇒ Worksheet
copies a sheet to another position if a sheet is given, or adds an empty sheet default: copied or empty sheet is appended, i.e. added behind the last sheet
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
# File 'lib/robust_excel_ole/workbook.rb', line 818 def add_or_copy_sheet(sheet = nil, opts = { }) if sheet.is_a? Hash opts = sheet sheet = nil end new_sheet_name = opts.delete(:as) last_sheet_local = last_sheet after_or_before, base_sheet = opts.to_a.first || [:after, last_sheet_local] base_sheet_ole = base_sheet.ole_worksheet begin if !::COPYSHEETS_JRUBY_BUG add_or_copy_sheet_simple(sheet, { after_or_before.to_s => base_sheet_ole }) else if after_or_before == :before add_or_copy_sheet_simple(sheet, base_sheet_ole) else if base_sheet.name != last_sheet_local.name add_or_copy_sheet_simple(sheet, base_sheet.Next) else add_or_copy_sheet_simple(sheet, base_sheet_ole) base_sheet.Move(ole_workbook.Worksheets.Item(ole_workbook.Worksheets.Count-1)) ole_workbook.Worksheets.Item(ole_workbook.Worksheets.Count).Activate end end end rescue WIN32OLERuntimeError, NameNotFound, Java::OrgRacobCom::ComFailException raise WorksheetREOError, "could not add given worksheet #{sheet.inspect}" end new_sheet = worksheet_class.new(ole_workbook.Activesheet) new_sheet.name = new_sheet_name if new_sheet_name new_sheet end |
#add_sheet(sheet = nil, opts = { }) ⇒ Object
for compatibility to older versions
864 865 866 |
# File 'lib/robust_excel_ole/workbook.rb', line 864 def add_sheet(sheet = nil, opts = { }) add_or_copy_sheet(sheet, opts) end |
#alive? ⇒ Boolean
returns true, if the workbook reacts to methods, false otherwise
911 912 913 914 915 916 917 |
# File 'lib/robust_excel_ole/workbook.rb', line 911 def alive? @ole_workbook.Name true rescue @ole_workbook = nil # dead object won't be alive again false end |
#calculation ⇒ Object
934 935 936 |
# File 'lib/robust_excel_ole/workbook.rb', line 934 def calculation @excel.properties[:calculation] if @ole_workbook end |
#close(opts = {:if_unsaved => :raise}) ⇒ Object
closes the workbook, if it is alive options:
:if_unsaved if the workbook is unsaved
:raise -> raises an exception
:save -> saves the workbook before it is closed
:forget -> closes the workbook
:keep_open -> keep the workbook open
:alert or :excel -> gives control to excel
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/robust_excel_ole/workbook.rb', line 495 def close(opts = {:if_unsaved => :raise}) if alive? && !@ole_workbook.Saved && writable case opts[:if_unsaved] when :raise raise WorkbookNotSaved, "workbook is unsaved: #{File.basename(self.stored_filename).inspect}" + "\nHint: Use option :save or :forget to close the workbook with or without saving" when :save save close_workbook when :forget @excel.with_displayalerts(false) { close_workbook } when :keep_open # nothing when :alert, :excel @excel.with_displayalerts(true) { close_workbook } else raise OptionInvalid, ":if_unsaved: invalid option: #{opts[:if_unsaved].inspect}" + "\nHint: Valid values are :raise, :save, :keep_open, :alert, :excel" end else close_workbook end end |
#copy_sheet(sheet, opts = { }) ⇒ Object
for compatibility to older versions
869 870 871 |
# File 'lib/robust_excel_ole/workbook.rb', line 869 def copy_sheet(sheet, opts = { }) add_or_copy_sheet(sheet, opts) end |
#each ⇒ Object
790 791 792 793 794 |
# File 'lib/robust_excel_ole/workbook.rb', line 790 def each @ole_workbook.Worksheets.each do |sheet| yield worksheet_class.new(sheet) end end |
#each_with_index(offset = 0) ⇒ Object
802 803 804 805 806 807 808 |
# File 'lib/robust_excel_ole/workbook.rb', line 802 def each_with_index(offset = 0) i = offset @ole_workbook.Worksheets.each do |sheet| yield worksheet_class.new(sheet), i i += 1 end end |
#filename ⇒ Object
returns the full file name of the workbook
920 921 922 |
# File 'lib/robust_excel_ole/workbook.rb', line 920 def filename @ole_workbook.Fullname.tr('\\','/') rescue nil end |
#first_sheet ⇒ Object
877 878 879 |
# File 'lib/robust_excel_ole/workbook.rb', line 877 def first_sheet worksheet_class.new(@ole_workbook.Worksheets.Item(1)) end |
#focus ⇒ Object
brings workbook to foreground, makes it available for heyboard inputs, makes the Excel instance visible
904 905 906 907 908 |
# File 'lib/robust_excel_ole/workbook.rb', line 904 def focus self.visible = true @excel.focus @ole_workbook.Activate end |
#for_modifying(opts = { }, &block) ⇒ Object
542 543 544 |
# File 'lib/robust_excel_ole/workbook.rb', line 542 def (opts = { }, &block) unobtrusively({:writable => true}.merge(opts), &block) end |
#for_reading(opts = { }, &block) ⇒ Object
538 539 540 |
# File 'lib/robust_excel_ole/workbook.rb', line 538 def for_reading(opts = { }, &block) unobtrusively({:writable => false}.merge(opts), &block) end |
#for_this_workbook(opts) ⇒ Object
sets options
897 898 899 900 901 |
# File 'lib/robust_excel_ole/workbook.rb', line 897 def for_this_workbook(opts) return unless alive? self.class.(opts, :use_defaults => false) self.send :apply_options, @stored_filename, opts end |
#last_sheet ⇒ Object
873 874 875 |
# File 'lib/robust_excel_ole/workbook.rb', line 873 def last_sheet worksheet_class.new(@ole_workbook.Worksheets.Item(@ole_workbook.Worksheets.Count)) end |
#retain_saved ⇒ Object
keeps the saved-status unchanged
529 530 531 532 533 534 535 536 |
# File 'lib/robust_excel_ole/workbook.rb', line 529 def retain_saved saved = self.Saved begin yield self ensure self.Saved = saved end end |
#set_was_open(hash, value) ⇒ Object
178 179 180 |
# File 'lib/robust_excel_ole/workbook.rb', line 178 def set_was_open(hash, value) self.class.set_was_open(hash, value) end |
#sheet(name) ⇒ Object
returns a sheet, if a sheet name or a number is given
780 781 782 783 784 |
# File 'lib/robust_excel_ole/workbook.rb', line 780 def sheet(name) worksheet_class.new(@ole_workbook.Worksheets.Item(name)) rescue WIN32OLERuntimeError, Java::OrgRacobCom::ComFailException => msg raise NameNotFound, "could not return a sheet with name #{name.inspect}" end |
#unobtrusively(opts = { }, &block) ⇒ Object
568 569 570 571 |
# File 'lib/robust_excel_ole/workbook.rb', line 568 def unobtrusively(opts = { }, &block) file = @stored_filename self.class.unobtrusively_opening(file, opts, alive?, &block) end |
#visible ⇒ Object
returns true, if the workbook is visible, false otherwise
944 945 946 |
# File 'lib/robust_excel_ole/workbook.rb', line 944 def visible @excel.Visible && @ole_workbook.Windows(@ole_workbook.Name).Visible end |
#visible=(visible_value) ⇒ Object
makes both the Excel instance and the window of the workbook visible, or the window invisible does not do anything if geben visible_value is nil
951 952 953 954 955 |
# File 'lib/robust_excel_ole/workbook.rb', line 951 def visible= visible_value return if visible_value.nil? @excel.visible = true if visible_value self.window_visible = @excel.Visible ? visible_value : true end |
#window_visible ⇒ Object
returns true, if the window of the workbook is set to visible, false otherwise
958 959 960 |
# File 'lib/robust_excel_ole/workbook.rb', line 958 def window_visible @ole_workbook.Windows(@ole_workbook.Name).Visible end |
#window_visible=(visible_value) ⇒ Object
makes the window of the workbook visible or invisible
964 965 966 967 968 |
# File 'lib/robust_excel_ole/workbook.rb', line 964 def window_visible= visible_value retain_saved do @ole_workbook.Windows(@ole_workbook.Name).Visible = visible_value if @ole_workbook.Windows.Count > 0 end end |
#worksheets ⇒ Object
796 797 798 799 800 |
# File 'lib/robust_excel_ole/workbook.rb', line 796 def worksheets result = [] each { |worksheet| result << worksheet } result end |
#worksheets_count ⇒ Object
786 787 788 |
# File 'lib/robust_excel_ole/workbook.rb', line 786 def worksheets_count @ole_workbook.Worksheets.Count end |