2015-12-16 00:31:54 -05:00
|
|
|
# frozen_string_literal: false
|
2002-06-01 08:34:30 -04:00
|
|
|
require 'win32ole'
|
|
|
|
|
|
|
|
application = WIN32OLE.new('Excel.Application')
|
|
|
|
|
|
|
|
application.visible = TRUE
|
|
|
|
workbook = application.Workbooks.Add();
|
|
|
|
worksheet = workbook.Worksheets(1);
|
2007-02-03 00:41:03 -05:00
|
|
|
|
|
|
|
=begin
|
2002-06-01 08:34:30 -04:00
|
|
|
worksheet.Range("A1:D1").value = ["North","South","East","West"];
|
|
|
|
worksheet.Range("A2:B2").value = [5.2, 10];
|
2007-02-03 00:41:03 -05:00
|
|
|
|
2002-06-01 08:34:30 -04:00
|
|
|
worksheet.Range("C2").value = 8;
|
|
|
|
worksheet.Range("D2").value = 20;
|
2007-02-03 00:41:03 -05:00
|
|
|
=end
|
2002-06-01 08:34:30 -04:00
|
|
|
|
2007-02-03 00:41:03 -05:00
|
|
|
worksheet.Range("A1:B2").value = [["North","South"],
|
|
|
|
[5.2, 10]];
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
vals = WIN32OLE_VARIANT.new([["East","West"],
|
|
|
|
[8, 20]],
|
|
|
|
WIN32OLE::VARIANT::VT_ARRAY)
|
2007-02-03 00:41:03 -05:00
|
|
|
worksheet.Range("C1:D2").value = vals
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2002-06-01 08:34:30 -04:00
|
|
|
range = worksheet.Range("A1:D2");
|
|
|
|
range.Select
|
|
|
|
chart = workbook.Charts.Add;
|
|
|
|
|
|
|
|
workbook.saved = TRUE;
|
2014-10-03 20:13:18 -04:00
|
|
|
|
|
|
|
print "Now quit Excel... Please enter."
|
|
|
|
gets
|
|
|
|
|
2002-06-01 08:34:30 -04:00
|
|
|
application.ActiveWorkbook.Close(0);
|
|
|
|
application.Quit();
|
|
|
|
|