易截截图软件、单文件、免安装、纯绿色、仅160KB

ruby的Excel操作

require 'win32ole'
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.Open('E:\RubyApp\bmk.xls')
worksheet = workbook.Worksheets(1) #get hold of the first worksheet
worksheet.Select #bring it to the front -need sometimes to run macros, not for working with a worksheet from ruby
#excel['Visible'] = true #make visible, set to false to make invisible again. Don't need it to be visible for script to work
#value1=worksheet.Range('a12')['Value'] #get value of single cell
#puts value1
#data = worksheet.Range('a1:c12')['Value'] #read into 2D array
#data.each do |data1|
#data1.each do |data2|
#puts data2
#end
#end
line = '1'
while worksheet.Range("c#{line}")['Value']
line.succ!
end #line now holds row number of first empty row
puts line
#i=3
#puts worksheet.cells(i-1,1).text[8,16].to_i+1
#处理准考证号,让它自动增加
#while i < line.to_i
for i in 3...line.to_i
worksheet.cells(i,1).value="00320501"+(worksheet.cells(i-1,1).text[8,15].to_i + 1).to_s
worksheet.cells(i,2).value="320501"+(worksheet.cells(i-1,2).text[6,13].to_i + 1).to_s
if worksheet.cells(i,7).text.length==18
worksheet.cells(i,5).value=worksheet.cells(i,7).text[6,8]
else
worksheet.cells(i,5).value="19"+worksheet.cells(i,7).text[6,6]
end

worksheet.range("h#{i}").value=worksheet.range("h#{i-1}").value.to_s
worksheet.range("i#{i}").value=worksheet.range("i#{i-1}").value.to_s
worksheet.range("k#{i}").value=worksheet.range("k#{i-1}").value.to_s
worksheet.range("l#{i}").value=worksheet.range("l#{i-1}").value.to_s
worksheet.range("o#{i}").value=worksheet.range("o#{i-1}").value.to_s
worksheet.range("p#{i}").value=worksheet.range("p#{i-1}").value.to_s
worksheet.range("q#{i}").value=worksheet.range(&


相关文档:

Ruby 101:对象和方法


Ruby 101:对象和方法
Written by Allen Lee
从静态方法说起
      在上一篇文章末尾,我们提到了受保护的静态方法……受保护的静态方法??Ruby的protected不是用来向相同类型的不同实例开放受限方法的访问的吗(忘记protected的用法了?不要紧,回去上一篇文章复习一下吧。) ......

删除工程中svn文件的脚本(Ruby版和Python版)

两种不同的语言,不同的表达!
Python脚本实现.
""
"
    File Name : clean.py
    File Date : 2009/11/5 14:22:56
    Author     : DannyLai
    Purpose     : Cle ......

ubuntu下搭建ruby on rails

 一 安装ruby
$sudo apt-get install ruby irb rdoc
二 安装gem
1.到这里下载 ,最好是最新版本,我的1.3.5
解压,切换到当前目录,执行$sudo ruby setup.rb
或者这样:
$ tar xzvf rubygems-1.3.5.tgz   (解压)
$ cd rubygems-1.3.5     (切换到此目录)
$ sudo ruby setup ......

ruby c++

While looking for information on the subject, I looked into the ONLamp article Extending Ruby with C by Garrett Rooney, the Extending Ruby chapter in the Pickaxe, README.EXT (located at /usr/share/doc/ruby1.8-dev/README.EXT.gz on my Ubuntu system) and got some help from Kjetil.
The resulting file c ......

代码高亮,Ruby代码


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
{font-family:"Cambria Mat ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号