zoukankan      html  css  js  c++  java
  • Watir: Win32ole对于excel某些指令无法操作的时候有如下解决方案

    Similar Threads
    1. WIN32OLE - failed to create WIN32OLE
    2. WIN32OLE#[] and WIN32OLE#[]= method in Ruby 1.9 (or later) 

    For example, 
      excel = WIN32OLE.excel("Excel.Application")
      excel["Visible"] = true
    is NG.
    Instead, You must write
      excel = WIN32OLE.excel("Excel.Application")
      excel.Visible = true
     
    For more,
       installer = WIN32OLE.new("WindowsInstaller.Installer")
       record = installer.CreateRecord(2)
       record ["StringData", 1] = 'dddd'
     
    is NG. Instead,
       installer = WIN32OLE.new("WindowsInstaller.Installer")
       record = installer.CreateRecord(2)
       record.setproperty("StringData", 1, 'dddd')
     
    By using new featuer, You can write
     
      worksheet.cells[1,2] = 10
     
    in Excel. 
     
    For more, you can write
     
      WIN32OLE.new("WScript.Shell")
      env = sh.Environment("User")
      p env["FOO"]
      env["FOO"] = "BARBAZ"
     
    For more, you can write
     
      ado = WIN32OLE.new("ADODB.Connection")
      ado.Open("...")
      rs = ado.Execute("SELECT * from TABLE01")
      while !rs.EOF
          puts rs.Fields.Item("id").value
          puts rs.Fields("id").value
          puts rs["id"].value # This is new feature!
          rs.MoveNext
      end
  • 相关阅读:
    git 只添加cpp文件
    URI和URL学习
    scanpy中常用函数
    特征去量纲方法
    排列组合数计算公式
    UML图
    行测图形推理笔记-
    nis服务器实现用户帐号管理同步
    rsh配置双方主机免密
    两周实习的总结
  • 原文地址:https://www.cnblogs.com/autotest/p/3262533.html
Copyright © 2011-2022 走看看