summaryrefslogtreecommitdiff
path: root/ext/win32ole/sample
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-03 05:41:03 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-03 05:41:03 +0000
commitd4b866914bc76958f956eeb36c441968440668ee (patch)
treec3b644727c709698db8a8ea9dc5e1f71eb6e8633 /ext/win32ole/sample
parente22d0bf7238edc56f0486a2241b42d906dad90cc (diff)
* ext/win32ole/win32ole.c (ole_val2olevariantdata, ole_val2variant):
fix the bug of WIN32OLE_VARIANT.new when variant type is VT_ARRAY. * ext/win32ole/sample/excel1.rb: rewrite using WIN32OLE_VARIANT. * test/win32ole/test_win32ole.rb: add some test. * test/win32ole/test_win32ole_variant.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole/sample')
-rw-r--r--ext/win32ole/sample/excel1.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/win32ole/sample/excel1.rb b/ext/win32ole/sample/excel1.rb
index e366a52..2cad84a 100644
--- a/ext/win32ole/sample/excel1.rb
+++ b/ext/win32ole/sample/excel1.rb
@@ -1,22 +1,33 @@
require 'win32ole'
-#application = WIN32OLE.new('Excel.Application.5')
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;
-
+sleep 0.5
application.ActiveWorkbook.Close(0);
application.Quit();