Catalyst-View-XLSX

 view release on metacpan or  search on metacpan

lib/Catalyst/View/XLSX.pm  view on Meta::CPAN

            font_strikeout => 0,
            font_script => 0,
            font_outline => 0,
            font_shadow => 0,
            num_format => '0.00'
        };

        my $xlsx_data = {
            data => [
                {
                    row => 0,
                    col => 0,
                    data => 10,
                    format => $format,
                    value => '10'
                },
                {
                    row => 0,
                    col => 1,
                    data => 20,
                    format => $format,
                    value => '20'
                },
                {
                    row => 0,
                    col => 2,
                    data => '=SUM(A1:B1)',
                    format => $format,
                    value => '30'
                }
            ],
            filename => "ExcelFile.xlsx"
        };
        
        $c->stash(xlsx => $xlsx_data, current_view => 'XLSX');
    }

    1;

=head1 SUMMARY

This Catalyst::View::XLSX provides a Catalyst view that generates Microsoft Excel (.xlsx) files.

=head1 DESCRIPTION

This is a very simple module which uses few methods of L<Excel::Writer::XLSX> and creates an Excel file based on the stashed parameters. It also respond the file that has been readily available.

=head2 STASH PARAMETERS


    $c->stash->{xlsx} = {
        data => [
            { row => 0, col => 0, data => 'Hey! Look at me. I am A1', format => undef, value => undef },
            { row => 0, col => 1, data => 'People call me as  B1',    format => undef, value => undef }
        ],
        filename => 'ExcelFile.xlsx'
    };

    #row,col -> represents the position on the Excel sheet 
    #data    -> represents the content of the field
    #value   -> (OPTIONAL) it will hold the actual value when data has formula
    #format  -> (OPTIONAL) format of the cell, supports the following properties  
 
            #font => 'Times New Roman',
            #size => '15',
            #color => 'Black',
            #bold  => 1,
            #italic => 0,
            #underline => 0,
            #font_strikeout => 0,
            #font_script => 0,
            #font_outline => 0,
            #font_shadow => 0,
            #num_format => '0.00'

            #Please refer L<Excel::Writer::XLSX> for more properties.

or 

    $c->stash->{xlsx} = {
        file => '/opt/git/Files/GeneratedRank.xlsx',
        filename => 'Resulst.xlsx'
    };


=head2 METHODS

=head3 process 

This will respond the Excel file with Content-Type `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
 
=head3 render

This will generate the Excel file based on the stashed parameters using L<Excel::Writer::XLSX> module.
 
=head1 REPOSITORY

L<https://github.com/Virendrabaskar/Catalyst-View-XLSX>

=head1 SEE ALSO

=over 4

=item *

L<Excel::Writer::XLSX>

=item *

L<Catalyst::View> 

=item *

L<Catalyst>

=back

=head1 AUTHOR

Baskar Nallathambi <baskarmusiri@gmail.com>



( run in 0.545 second using v1.01-cache-2.11-cpan-39bf76dae61 )