Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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_


Ïà¹ØÎĵµ£º

Ruby ±¨±í¹¤¾ß Ruport

RuportÊÇÒ»¸öÃâ·ÑµÄRuby±¨±í¹¤¾ß£¬Ëü¿ÉÒÔÁîµ½ÖÆ×÷±¨±íÈí¼þ±äµÃ¼òµ¥Ò»Ð©¡£RuportÖ§³Ö´ÓÎļþ»òÕßÊý¾Ý¿â»ñµÃÊý¾Ý£¬Ìṩ¹¤¾ß²Ù×÷Êý¾Ý¡£¶îÍâµØ£¬RuportÖ§³Ö¸ßÀ©Õ¹µÄ¸ñʽ»¯Èí¼þ£¬Ä¿Ç°Äܹ»Ö§Ô®HTML¡¢PDF¡¢CSVºÍÎı¾Êä³ö¡£
Ruport¿ÉÄÜÊÇRubyĿǰΨһµÄ±¨±í¹¤¾ß£¬Ä¿Ç°ÔÚ³ÖÐø¿ª·¢ÖУ¬¸ü¶àµÄÐÂÌØÐÔÕýÔÚÌí¼Ó¡£
°²×°·½·¨£º
gem instal ......

Ruby Ruportʵ¼ù—¼òµ¥±¨±íϵͳ

¿ª·¢»·¾³
OS:WindowsXP
Ruby:Ruby1.8.7
Rails:Rails2.3.5
Mysql:Mysql5.0.9
IDE:Rubymine2.0.1
×¼±¸¹¤×÷£º
°²×°ÒÔÏÂgem°ü
gem install ruport
gem install ruport-util
gem install acts_as_reportable
±¾ÀýÉè¼ÆµÄ±¨±íϵͳ¹¤×÷Ô­ÀíÈçͼ£¨´¿Êô¸öÈËÀí½â£©£¬ÒÔProducts±íΪÀý£º
½ÓÏÂÀ´ÊµÏÖµÄÀý×Ó½«ÀûÓÃeval·½·¨ÊµÏ ......

ruby Óï·¨

±¾ÎÄת×Ô:
http://hi.baidu.com/24xinhui/blog/item/9f52dd34382e11325ab5f553.html
ruby-Óï·¨
2009Äê06ÔÂ20ÈÕ ÐÇÆÚÁù ÉÏÎç 00:21
http://www.blogjava.net/xxllnnn/archive/2009/01/18/251762.html
http://www.cnblogs.com/cnblogsfans/archive/2009/01/24/1380804.html
__setobj__ £¨2009-7-14£©
  &nbs ......

Ruby Ruportʵ¼ù—±¨±í²ÎÊýʵÏÖ

´ËÀý×ÓÔÚ Ruby Ruportʵ¼ù—¼òµ¥±¨±íϵͳ ¼° Ruby Ruportʵ¼ù—ÖÐÎÄPDF±¨±íÖ®PRAWN  µÄ»ù´¡ÉϽøÐÐÍêÉÆ£¬Ìí¼ÓÁ˶Ա¨±í²ÎÊýµÄÉè¼Æ¼°ÊµÏÖ¡£
Ò»¡¢´´½¨Êý¾Ý±íreport_parameters
create table report_parameters
(report_parameter_id integer not null auto_increment,
report_execute_id integer not null, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ