ext/win32ole/sample/excel1.rb


DEFINITIONS

This source file includes following functions.


   1  require 'win32ole'
   2  
   3  #application = WIN32OLE.new('Excel.Application.5')
   4  application = WIN32OLE.new('Excel.Application')
   5  
   6  application.visible = TRUE
   7  workbook = application.Workbooks.Add();
   8  worksheet = workbook.Worksheets(1);
   9  worksheet.Range("A1:D1").value = ["North","South","East","West"];
  10  worksheet.Range("A2:B2").value = [5.2, 10];
  11  worksheet.Range("C2").value = 8;
  12  worksheet.Range("D2").value = 20;
  13  
  14  range = worksheet.Range("A1:D2");
  15  range.Select
  16  chart = workbook.Charts.Add;
  17  
  18  workbook.saved = TRUE;
  19  
  20  application.ActiveWorkbook.Close(0);
  21  application.Quit();
  22