Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ruby xml excel

require 'win32ole'
fns = Dir.glob("*.xls")
application = WIN32OLE.new("excel.application") 
application.visible = TRUE
f = File.new('errorCauseEN.xml','w')
f.puts('<?xml version="1.0" encoding="utf-8"?>')
f.puts('<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by et8 (et8) -->')
f.puts('<Category>')
fns.each do |file|
 workbook = application.WorkBooks.Open(Dir.pwd + '/' + file)
 sheet = workbook.WorkSheets(2)
 sheet.Activate
 i = 2
 
 loop do
  break if !sheet.Range('A'+ i.to_s).Value
  
  break if !sheet.Range('C'+ i.to_s).Value
  
  errname = sheet.Range('A'+ i.to_s).Value.to_s.hex.to_i.to_s.strip
  
  valuename = sheet.Range('C'+ i.to_s).Value.strip
  
  valuename.gsub!(/\"/,'\'')
  
  f.puts(' '*4 + '<ErrorCode name="' + errname + '" value="' + valuename +'"/>')
   
  i = i + 1
 end
 
 puts file.to_s + ' is OK!'
 workbook.close(0)
end
f.puts('</Category>')
f.close
application.Quit()
#workbook = application.WorkBooks.Open('D:/ErrorCase/TR_ErrCode.xls')
--------------------------------------------------------------------------
require 'win32ole'
require 'rexml/document'
include REXML
include REXML::
#fns = Dir.glob("*.xls")
#
application = WIN32OLE.new("excel.application") 
#
application.visible = TRUE
#
#fns.each do |file|
# workbook = application.WorkBooks.Open(Dir.pwd + '/' + file)

#end
#
f = File.new('errorC.xml','w')
doc = Document.new('<Category />')
workbook = application.WorkBooks.Open('D:/ErrorCase/TR_ErrCode.xls')
sheet = workbook.WorkSheets(2)
sheet.Activate
i = 2
loop do
 break if !sheet.Range('A'+ i.to_s).Value
 
 ec = Element.new('ErrorCode')
 
 ec.add_attribute('name',sheet.Range('A'+ i.to_s).Value.to_s.hex.to_


Ïà¹ØÎĵµ£º

¼Ç¼ÏÂ×Ô¼ºUbunt 10.04 ´î½¨ruby on rails»·¾³

1¡¢°²×°ubuntu
һ·next£¬¼Çס°²×°Ó¢ÎÄ°æ¡£´ý°²×°Íê±Ïºó£¬Ê×ÏÈÑ¡Ôñ“Èí¼þÔ´”£¬ÏµÍ³--ϵͳ¹ÜÀí-Èí¼þÔ´£¬¹úÄÚÒ»°ãÑ¡ÔñµÄÊÇ£ºhttp://ubuntu.cn99.com/ubuntu;½Ó×Å°²×°ÖÐÎÄ°ü£¬Ñ¡ÔñÈí¼þÔ´¾ÍÊÇΪÁËÏÂÔØÈí¼þµÄËٶȸü¿ì£¬°²×°Íê³ÉºóÖØÆôubuntu£¬ÖØÆôºó»áÌáʾÊÇ·ñ¸Ä±äijЩÎļþ¼ÐÃû³Æ£¬Ñ¡Ôñ“·ñ”£¬·Àֹϵͳ¶Ô ......

Installing Ruby 1.8.6 from Source on Ubuntu

Installing Ruby from source is my preferred method, although in Ubuntu Feisty you can supposedly install it with apt-get install ruby
now. Here’s the essential packages needed to get a source build working right though and the process I just went through:
sudo apt-get install build-essentia ......

Ruby Ruportʵ¼ù—±¨±í²ÎÊýʵÏÖ£¨¶þ£©

±¾ÀýÔÚ  Ruby Ruportʵ¼ù—±¨±í²ÎÊýʵÏÖ µÄ»ù´¡ÉϽøÐиÄÔ죬ʵÏÖ±¨±íÖ´Ðж¨Òåʱ±¨±í²ÎÊýµÄÔö¡¢É¾¡¢¸Ä²Ù×÷
Ò»¡¢ÐÞ¸Äviews/report_executions/edit.html.erb
²»½öÏÔʾÔÚн¨±¨±íÖ´ÐÐʱ±£´æµÄ±¨±í²ÎÊý£¬»¹¿É¶¯Ì¬ÏÔʾʣÓàµÄ²ÎÊý£¨ÕâÀï¿ØÖƲÎÊý×î¶à¿É¶¨Òå5¸ö£©£¬ÕâÑù¿É±ÜÃâÒÅÍü¶¨Ò屨±í²ÎÊý»òÐèÒªÔö¼Ó±¨±í²ÎÊýµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ