Sha256: 564daca806de9983f06191f9c4439042678cddb5487a2b20dccaf47785720e80

Contents?: true

Size: 881 Bytes

Versions: 5

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: false
require 'win32ole'

application = WIN32OLE.new('Excel.Application')

application.visible = true
workbook = application.Workbooks.Add();
worksheet = workbook.Worksheets(1);

=begin
worksheet.Range("A1:D1").value = ["North","South","East","West"];
worksheet.Range("A2:B2").value = [5.2, 10];

worksheet.Range("C2").value = 8;
worksheet.Range("D2").value = 20;
=end

worksheet.Range("A1:B2").value = [["North","South"],
                                  [5.2, 10]];

vals = WIN32OLE_VARIANT.new([["East","West"],
                             [8, 20]],
                            WIN32OLE::VARIANT::VT_ARRAY)
worksheet.Range("C1:D2").value = vals

range = worksheet.Range("A1:D2");
range.Select
chart = workbook.Charts.Add;

workbook.saved = true;

print "Now quit Excel... Please enter."
gets

application.ActiveWorkbook.Close(0);
application.Quit();

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
win32ole-1.9.0 sample/win32ole/excel1.rb
win32ole-1.8.10 ext/win32ole/sample/excel1.rb
win32ole-1.8.9 ext/win32ole/sample/excel1.rb
win32ole-1.8.8 ext/win32ole/sample/excel1.rb
ruby-compiler-0.1.1 vendor/ruby/ext/win32ole/sample/excel1.rb