Author image Colin Newell
and 1 contributors

NAME

OpusVL::AppKit::View::Excel

VERSION

version 2.29

SYNOPSIS

In your controller action setup the data and detach to the view,

        $c->stash->{data} = $customers;
        $c->res->header('Content-Disposition', qq[attachment; filename="$filename"]);
        $c->detach('View::Excel');

In your view, action.xml.tt

    <workbook>
        <worksheet name="Customers">
            <row>
                <cell>Customers</cell>
            </row>
            <row>
                <cell>Created</cell>
                <cell>Name</cell>
                <cell>Channel</cell>
                <cell>Balance</cell>
                <cell>ID Number</cell>
            </row>
            [% FOREACH customer IN data %]
            <row>
                <format num_format="dd/mm/yyyy">
                    <cell type="date_time">[% customer.created.iso8601 %]</cell>
                </format>
                <cell>[% customer.name %]</cell>
                <cell>[% customer.details.channel %]</cell>
                <format num_format="£0.00">
                <cell>[% customer.balance %]</cell>
                </format>
                <cell type="string">332132111111232111</cell>
            </row>
            [% END %]

        </worksheet>
    </workbook>

DESCRIPTION

This is our Catalyst::View::Excel::Template::Plus view that makes use of Excel::Template::Plus Assuming you have used the OpusVL::AppKit::RolesFor::Plugin->add_paths(__PACKAGE__) call in your module the excel templates should pick things up from the same place as all the regular tt templates. It just expects the filenames to end .xml.tt.

NAME

OpusVL::AppKit::View::Excel

SEE ALSO

AUTHOR

OpusVL - www.opusvl.com

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by OpusVL - www.opusvl.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.