ruby_excel

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
quannum = quannum + 1
end
end
end
workbook.close(1)
excel.Quit
worksheet.range("g1:g14").insert
worksheet.range("g1:g14").insert
end
if worksheet.range("h5").value.to_s == ""
sbi = "RMB"
end
#??è?è??ú
stime = []
stime << worksheet.range("e4")['value'] << worksheet.range("f4")['value'] << worksheet.range("g4")['value'] << worksheet.range("h4")['value'] << worksheet.range("i4")['value']
shuilv = ""
else
r1 = /\((\w+)\)/
sbi = worksheet.range("h5").value.scan(r1).to_s
shuilv = worksheet.range("i7").value.to_s
sdollar1 << worksheet.range(e)['value']
end
sdollar1 = pact.to_s
sdollar2 = []
["t#{i}","u#{i}","v#{i}","w#{i}","x#{i}","y#{i}","z#{i}","aa#{i}","ab#{i}","ac#{i}"].each do |e|
$mzhi = "\322\370\312\325"
when mword.include?("\317\326\312\325")
$mzhi = "\317\326\312\325"
end
return $mzhi
end
#??μ??·??2?êy
raise "2?êy′í?ó" unless ARGV.size == 1
end
llparray1 = llparray + llparray1
worksheet = workbook.worksheets( "Sheet1")
worksheet.select
worksheet.range("a#{quannum}:m#{quannum}")['value'] = llparray1
when d.include?("\345")
d.gsub!(/(\345)/,"")
$dz = d[0..3] + "-" + d[4..5] + "-" + d[d.length-1,1]
else
$dz = d[0..3] + "-" + d[4..5] + "-" + d[6..7]
end
return $dz
end
def reg_zhi(mword)
case
when mword.include?("\327\252")
$mzhi = "\327\252"
when mword.include?("\322\370\312\325")
sdollar2 << worksheet.range(e)['value']
end
sdollar2 = pact.to_s
if sdollar1 == ""
sdollar2 = sdollar2.gsub!(/(\.0)/,"").to_i
pingzh = sword.scan(r2).flatten!.to_s
reg_zhi(sword)
#??μ?1ì?¨μ?×êá?
llparray << $dz << $mzhi << pingzh << sbi << shuilv
#??μ?aáD?úèYDDêy
line = 7
while worksheet.range("a#{line}")['value']
line = line + 1
end
#??μ?dáD?úèYDDêy
line1 = 7
while worksheet.range("d#{line1}")['value']
d.gsub!(/(\345)/,"")
$dz = d[0..3] + "-" + d[4...d.length]
when d.include?("\346")
d.gsub!(/(\346)/,"-")
$dz = d[0..3] + "-" + d[4..d.length]
#?D???è·?ó?′?·?
sdollar1 = []
["j#{i}","k#{i}","l#{i}","m#{i}","n#{i}","o#{i}","p#{i}","q#{i}","r#{i}","s#{i}"].each do |e|
sdollar2 = (sdollar2/100.00).to_s
llparray1 << "" << "" << worksheet.range("h#{i}").value.to_s << sdollar2
else
sdollar1 = sdollar1.gsub!(/(\.0)/,"").to_i
sdollar1 = (sdollar1/100.00).to_s
llparray1 << worksheet.range("h#{i}").value.to_s << sdollar1 << "" << ""
file_path = File.expand_path(ARGV[0])
p filedir = Dir.entries(file_path) - [".",".."]
for j in filedir
excel = WIN32OLE.new("excel.application")
excel.Visible = false
require 'win32ole'
def get_rtime(mtime)
d = mtime.pack("a4a2a2")
case
when d.include?("\346") && d.include?("\345")
d.gsub!(/(\346)/,"-")
pact
get_rtime(pact)
#??è?×?oí???¤o?
sword = []
sword = worksheet.range("k4")['value']
r2 = /\332(\d+)\272/
#??μ?excel?D1¤×÷±íμ???×?êy×é
shtname = [];num =0
workbook.worksheets.each { |sheetname| shtname << ;num += 1}
p shtname = shtname - ["Sheet1"]
line1 = line1 + 1
end
if line >= line1
line = line
else
line = line1
end
#??μ??è′??e??
Байду номын сангаас for i in 7...line
llparray1 = []
worksheet = workbook.worksheets(name)
worksheet.select
llparray1 << worksheet.range("a#{i}").value << worksheet.range("d#{i}").value << worksheet.range("f#{i}").value << ""
quannum = 2
for name in shtname
llparray = []
worksheet = workbook.worksheets(name)
worksheet.select
if worksheet.range("h5")['value'] == "?è·??e??"
workbook = excel.workbooks.open("#{file_path}/#{j}")
# ìí?óD?μ?1¤×÷±í
worksheet = workbook.worksheets.add
worksheet.Range('a1:m1')['Value'] = ["è??ú","×?","???¤o?","±ò??","???ê","?aòa","×ü??????","?÷??????","?t??????","?è·??-±ò","?è·??e??","′?·??-±ò","′?·??e??"]
相关文档
最新文档