The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::ExportExcel - The great new Mojolicious::Plugin::ExportExcel!

VERSION

Version 0.01

SYNOPSIS

    # Mojolicious
    $self->plugin('ExportExcel');
 
    # Mojolicious::Lite
    plugin 'ExportExcel';

EXPORT

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.

METHODS

Mojolicious::Plugin::ExportExcel 覆盖了Mojolicious::Plugin中的register方法。

register

å�‘Mojoliciousçš„rendererä¸­æ·»åŠ äº†ä¸€ä¸ªhandler:xls,用于渲染Excel文件。 å�‘Mojoliciousä¸­æ·»åŠ ä¸€ä¸ªhelper:render_excel,用于渲染Excel文件。

export_excel_renderer

执行xls handler时的渲染方法。

PARAMETER

option

    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=>{},                  ## 对应列的样�
      },
      ……
    ];
  

settings

一个存储了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            ## 对应列的宽度
            
    }

data

一个hashref çš„ arrayref ,其中存储的是è¦�渲染æˆ�excelè¡¨æ ¼çš„æ•°æ�®ã€‚

SUPPORT

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:

Around line 200:

Non-ASCII character seen before =encoding in '覆盖了Mojolicious::Plugin中的register方法。'. Assuming CP1252