Mojolicious::Plugin::ExportExcel - The great new Mojolicious::Plugin::ExportExcel!
Version 0.01
# Mojolicious $self->plugin('ExportExcel'); # Mojolicious::Lite plugin 'ExportExcel';
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.
Mojolicious::Plugin::ExportExcel 覆盖了Mojolicious::Pluginä¸çš„register方法。
å�‘Mojoliciousçš„rendererä¸æ·»åŠ 了一个handler:xls,用于渲染Excel文件。 å�‘Mojoliciousä¸æ·»åŠ 一个helper:render_excel,用于渲染Excel文件。
执行xls handler时的渲染方法。
my $option = [ { key => "recharge_status", ## 从 data的当å‰�hashä¸å�–哪个键的值放入对应å�•å…ƒæ ¼ header => "状æ€�", ## 对应列的表头 map => { ## 需è¦�对用key从dataå�–出的当å‰�值å�šæ˜ 射转æ�¢çš„规则 0 => "待支付", 2 => "待付款", 3 => "完æˆ�", 4 => "å�–消" }, action=>sub{ ## action 与 map å�ªæœ‰ä¸€ä¸ªå·¥ä½œï¼Œä¸”map优先级高 ## 接收两个å�‚数, ## 第一个为 当å‰�å�•å…ƒæ ¼çš„值 ## 第二个为 当å‰�行的hash对象 ## 返回的值会被作为当å‰�å�•å…ƒæ ¼çš„最值写入excelè¡¨ä¸ ## 其实功能与 map 类似 } type=>"string", ## æ•°æ�®ç±»åž‹ï¼Œstring,number,url format=>{}, ## å¯¹åº”åˆ—çš„æ ·å¼� }, …… ];
一个å˜å‚¨äº†excelè¡¨æ ¼é…�置信æ�¯çš„ hashref。
my $settings=>{ sheet_name => "", ## è¡¨æ ¼å��称 默认为空 header_format => {}, ## è¡¨å¤´æ ¼å¼� é»˜è®¤ä¸ºåŠ ç²— data_format => {}, ## æ•°æ�®æ ¼å¼� é»˜è®¤ä¸ºæ— æ ¼å¼� header_height => {}, ## 表头高度 默认为20 data_height => {}, ## æ•°æ�®é«˜åº¦ 默认为20 condition_format=>{ ## æ ¹æ�®æ�¡ä»¶è®¾ç½®æ ·å¼� row=>[ ## æ ¹æ�®æ�¡ä»¶è®¾ç½®ä¸€è¡Œçš„æ ¼å¼� { key=>"", ## è¦�判æ–çš„æ•°æ�®è¡Œ condition=>sub{}, ## 判æ–æ�¡ä»¶ format=>{} ## 满足æ�¡ä»¶æ—¶çš„æ ·å¼� }, …… ], cell=>{ ## æ ¹æ�®æ�¡ä»¶è®¾ç½®ä¸€ä¸ªå�•å…ƒæ ¼çš„æ ·å¼� key=>{ ## key è¦�判æ–æ•°æ�®çš„é”®å�� condition=>sub{}, ## 判æ–æ�¡ä»¶ format=>{} ## 满足æ�¡ä»¶æ—¶çš„æ ·å¼� }, …… } }, ‘A:A'=>100 ## 对应列的宽度 }
一个hashref çš„ arrayref ,其ä¸å˜å‚¨çš„是è¦�渲染æˆ�excelè¡¨æ ¼çš„æ•°æ�®ã€‚
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::ExportExcel
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '覆盖了Mojolicious::Pluginä¸çš„register方法。'. Assuming CP1252
To install Mojolicious::Plugin::ExportExcel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::ExportExcel
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::ExportExcel
For more information on module installation, please visit the detailed CPAN module installation guide.