Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > win32oleライブラリ > WIN32OLE_TYPEクラス

class WIN32OLE_TYPE

クラスの継承リスト: WIN32OLE_TYPE < Object < Kernel < BasicObject

Abstract

WIN32OLE_TYPE objects represent OLE type libarary information.

WIN32OLE_TYPE.new(typelib, ole_class) -> WIN32OLE_TYPE object

Returns a new WIN32OLE_TYPE object. The first argument <i>typelib</i> specifies OLE type library name. The second argument specifies OLE class name.

WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
    # => WIN32OLE_TYPE object of Application class of Excel.

特異メソッド

new(typelib, ole_class) -> WIN32OLE_TYPE object

Returns a new WIN32OLE_TYPE object. The first argument typelib specifies OLE type library name. The second argument specifies OLE class name.

WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
    # => WIN32OLE_TYPE object of Application class of Excel.
ole_classes(typelib)

Returns array of WIN32OLE_TYPE objects defined by the typelib type library.

progids

Returns array of ProgID.

typelibs

Returns array of type libraries.

インスタンスメソッド

guid -> GUID

Returns GUID.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.guid  # => {00024500-0000-0000-C000-000000000046}
helpcontext

Returns helpcontext. If helpcontext is not found, then returns nil.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.helpfile # => 131185
helpfile

Returns helpfile path. If helpfile is not found, then returns nil.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.helpfile # => C:\...\VBAXL9.CHM
helpstring -> String

Returns help string.

tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
p tobj.helpstring   # => "Web Browser interface"
implemented_ole_types

Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE object.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
p tobj.implemented_ole_types # => [_Worksheet, DocEvents]
major_version

Returns major version.

tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
p tobj.major_version   # => 8
minor_version -> Integer

Returns minor version.

tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
p tobj.minor_version   # => 2
name -> String

alias to_s

Returns OLE type name.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
p tobj.name   # => "Application"
ole_methods -> [WIN32OLE_METHOD]

Returns array of WIN32OLE_METHOD objects which represent OLE method defined in OLE type library.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
methods = tobj.ole_methods.collect{|m|
  m.name
}
# => ['Activate', 'Copy', 'Delete',....]
ole_type -> Class

returns type of OLE class.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
p tobj.ole_type  # => Class
ole_typelib

Returns the WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE object. If it is not found, then returns nil.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library'
progid -> String

Returns ProgID if it exists. If not found, then returns nil.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
p tobj.progid   # => "Excel.Application.9"
src_type -> Class

Returns source class when the OLE class is 'Alias'.

tobj =  WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType')
p tobj.src_type   # => I4
typekind -> Integer

Returns number which represents type.

tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
p tobj.typekind   # => 4
variables

Returns array of WIN32OLE_VARIABLE objects which represent variables defined in OLE class.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
vars = tobj.variables
vars.each do |v|
  puts "#{v.name} = #{v.value}"
end

The result of above sample script is follows:
  xlChart = -4109
  xlDialogSheet = -4116
  xlExcel4IntlMacroSheet = 4
  xlExcel4MacroSheet = 3
  xlWorksheet = -4167
visible -> bool

Returns true if the OLE class is public.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.visible  # => true
visible? -> bool

Returns true if the OLE class is public.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.visible  # => true

Methods

Classes