Class: Rasta::Spreadsheet::Excel
- Inherits:
-
Object
- Object
- Rasta::Spreadsheet::Excel
- Includes:
- Singleton
- Defined in:
- lib/rasta/spreadsheet.rb
Overview
Singleton Class to store Excel Instance
:visible Make the Excel Spreadsheet visible when processing :continue Continue from a bookmark :pagecount Continue for n pages after a bookmark
Instance Attribute Summary collapse
-
#continue ⇒ Object
Returns the value of attribute continue.
-
#currentpage ⇒ Object
Returns the value of attribute currentpage.
-
#currentrecord ⇒ Object
Returns the value of attribute currentrecord.
-
#excel ⇒ Object
readonly
Returns the value of attribute excel.
-
#pagecount ⇒ Object
Returns the value of attribute pagecount.
-
#recordcount ⇒ Object
Returns the value of attribute recordcount.
-
#visible ⇒ Object
Returns the value of attribute visible.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize ⇒ Excel
constructor
A new instance of Excel.
- #open(filename) ⇒ Object
Constructor Details
#initialize ⇒ Excel
Returns a new instance of Excel.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rasta/spreadsheet.rb', line 26 def initialize @visible = false @continue = false @currentrecord = 0 @currentpage = 0 @pagecount = 0 @recordcount = 0 @open_workbooks = [] @excel = WIN32OLE::new('excel.Application') WIN32OLE.const_load(@excel, ExcelConst) if ExcelConst.constants == [] # load Excel constants end |
Instance Attribute Details
#continue ⇒ Object
Returns the value of attribute continue.
25 26 27 |
# File 'lib/rasta/spreadsheet.rb', line 25 def continue @continue end |
#currentpage ⇒ Object
Returns the value of attribute currentpage.
25 26 27 |
# File 'lib/rasta/spreadsheet.rb', line 25 def currentpage @currentpage end |
#currentrecord ⇒ Object
Returns the value of attribute currentrecord.
25 26 27 |
# File 'lib/rasta/spreadsheet.rb', line 25 def currentrecord @currentrecord end |
#excel ⇒ Object (readonly)
Returns the value of attribute excel.
24 25 26 |
# File 'lib/rasta/spreadsheet.rb', line 24 def excel @excel end |
#pagecount ⇒ Object
Returns the value of attribute pagecount.
25 26 27 |
# File 'lib/rasta/spreadsheet.rb', line 25 def pagecount @pagecount end |
#recordcount ⇒ Object
Returns the value of attribute recordcount.
25 26 27 |
# File 'lib/rasta/spreadsheet.rb', line 25 def recordcount @recordcount end |
#visible ⇒ Object
Returns the value of attribute visible.
24 25 26 |
# File 'lib/rasta/spreadsheet.rb', line 24 def visible @visible end |
Instance Method Details
#cleanup ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/rasta/spreadsheet.rb', line 42 def cleanup if !@excel.visible while @excel.ActiveWorkbook @excel.ActiveWorkbook.Close(0) end @excel.Quit end end |
#open(filename) ⇒ Object
38 39 40 |
# File 'lib/rasta/spreadsheet.rb', line 38 def open(filename) @excel.Workbooks.Open(File.(filename)) end |