ext/win32ole/sample/excel2.rb


DEFINITIONS

This source file includes following functions.


   1  require 'win32ole'
   2  
   3  #   -4100 is the value for the Excel constant xl3DColumn.
   4  ChartTypeVal = -4100;
   5  
   6  #   Creates OLE object to Excel
   7  #excel = WIN32OLE.new("excel.application.5")
   8  excel = WIN32OLE.new("excel.application")
   9  
  10  # Create and rotate the chart
  11  
  12  excel['Visible'] = TRUE;
  13  excel.Workbooks.Add();
  14  excel.Range("a1")['Value'] = 3;
  15  excel.Range("a2")['Value'] = 2;
  16  excel.Range("a3")['Value'] = 1;
  17  excel.Range("a1:a3").Select();
  18  excelchart = excel.Charts.Add();
  19  excelchart['Type'] = ChartTypeVal;
  20  
  21  i = 30
  22  i.step(180, 10) do |rot|
  23  #    excelchart['Rotation'] = rot;
  24      excelchart.rotation=rot;
  25  end
  26  # Done, bye
  27  
  28  excel.ActiveWorkbook.Close(0);
  29  excel.Quit();
  30