Created
August 1, 2009 22:40
-
-
Save jschementi/159829 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
# Creates OLE object to Excel | |
excel = WIN32OLE.new("excel.application") | |
# Create the chart | |
excel['Visible'] = true | |
workbook = excel.Workbooks.Add | |
excel.Range("a1")['Value'] = 3 | |
excel.Range("a2")['Value'] = 2 | |
excel.Range("a3")['Value'] = 1 | |
excel.Range("a1:a3").Select | |
excelchart = workbook.Charts.Add | |
# -4100 is the value for the Excel constant xl3DColumn. | |
excelchart['Type'] = -4100; | |
# This is the cool part! Rotate the chart ... | |
30.step(180, 10) do |rot| | |
excelchart['Rotation'] = rot | |
end | |
excel.ActiveWorkbook.Close(0) | |
excel.Quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment