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
  • 相关阅读:
    LeetCode "Median of Two Sorted Arrays"
    LeetCode "Distinct Subsequences"
    LeetCode "Permutation Sequence"

    LeetCode "Linked List Cycle II"
    LeetCode "Best Time to Buy and Sell Stock III"
    LeetCode "4Sum"
    LeetCode "3Sum closest"
    LeetCode "3Sum"
    LeetCode "Container With Most Water"
  • 原文地址:https://www.cnblogs.com/autotest/p/3262533.html
Copyright © 2011-2022 走看看