Ruby Ruportʵ¼ù—Ruport::FormatterÓ¦ÓÃÀ©Õ¹
RuportĿǰ×Ô´øÖ§³ÖPDF,HTML,CSV,TXT¸ñʽÊä³ö£¬Èç¹ûÏë´òÓ¡.xml£¬.bat±¨±íÔõô°ì£¿
±¾Àý½«ÒÔXML¸ñʽΪÀý£¬ÊµÏÖRuport::FormatterµÄÁíÒ»ÖÖ×Ô¶¨ÒåÓ¦Óá£
RuportµÄÓ¦Óòο¼£º Ruby Ruportʵ¼ù—¼òµ¥±¨±íϵͳ
×¢£ºÆäËû¸ñʽµÄ±¨±íÖ»ÐèÒªÐÞ¸Ärenders¶ÔÓ¦µÄÄÚÈÝ£¨ÈçÏ£Íû±£´æÎª.bat¸ñʽ£¬½«renders :xml¸ÄΪrenders :bat£©£¬Ä£°åÊä³öÄÚÈݾùÓÃ
"output<<"·½·¨½øÐÐÊä³ö¼´¿É
Ò»¡¢ÔÚReportOutputControllerÖÐÌí¼Óxml¸ñʽ
class ReportXml < Ruport::Formatter
renders :xml, :for => ReportOutputController
build :data_sheet do
eval(options[:outputContent])
end
end
¶þ¡¢report_templatesÖж¨ÒåΪÈçÏÂÄÚÈݵÄÄ£°å
output<<"<products>"
data.each do |d|
output<<"<product>"
output<<"<title>#{d.title}</title><type>#{d.description}</type><price>#{d.price}</price>"
output<<"</product>"
end
output<<"</products>"
×¢£ºÎªÁ˲âÊÔ·½±ã£¬¿É½« "eval(options[:outputContent])"Ö±½ÓÌæ»»³ÉÄ£°åÄÚÈÝ
ÑÝʾЧ¹û£º
Ïà¹ØÎĵµ£º
%{String} ÓÃÓÚ´´½¨Ò»¸öʹÓÃË«ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û´®
%Q{String} ÓÃÓÚ´´½¨Ò»¸öʹÓÃË«ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û´®
%Q!Some String of “Characters”! <==> ” Some String of \”Characters\” “
%q{String} ÓÃÓÚ´´½¨Ò»¸öʹÓõ¥ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û´®
%q!Som ......
rubyÖе¥ÒýºÅºÍË«ÒýºÅµÄÒâÒåÓÐËù²»Í¬£¬Ë«ÒýºÅ°üΧµÄ×Ö·û×÷±äÁ¿Ìæ»»£¬µ¥ÒýºÅ°üΧµÄ±äÁ¿²»×öÌæ»»
Ò²¿ÉÒÔʹÓà %q ºÍ %Q À´Éú³É×Ö·û´®¶ÔÏó¡£%q Ï൱ÓÚµ¥ÒýºÅ£¬%QÏ൱ÓÚË«ÒýºÅ¡£
¾ÙÀýÈçÏ£º
irb(main):010:0> "show trsult: #{1*3}"
=> "show trsult: 3"
irb(main):011:0> 'show trsult: #{1*3}'
=> "show trs ......
±¾ÎÄת×Ô:
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 ......
FPDFÄÜÖ§³ÖPDFµÄÖÐÎÄ´òÓ¡£¬È»¶øÈ´´æÔÚ²»ÉٵIJ»ÈçÒâÖ®´¦£¬¾ÝÎÒĿǰµÄʹÓã¬×ܽá³ö¼¸µã£º
1£©FPDFÌṩµÄPdf_Chinese×ÖÌ壬½«GBÕâÖÖ×ÖÌåдÈëÁË´úÂëÖУ¬ÈôÎÒÃÇÏ£ÍûÒýÈëÆäËûµÄÖÐÎÄ×ÖÌ壬Ôò²»ÄÜ·½±ãµØÊ¹ÓÃ
2£©FPDFÊä³öµÄÊý×Ö²¢²»ÃÀ¹Û£¬²»ÈçRuport::Formatter::PDF×Ô´øµÄ×ÖÌå
3£©FPDFÌṩµÄ·½·¨²¢²»¶à£¬¶ÔÓÚÒ»°ãµÄ±¨±í´òÓ¡£¬Óõ ......
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 ......