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

NAME

CatalystX::CRUD::View::Excel - view CRUD search/list results in Excel format

SYNOPSIS

 package MyApp::View::Excel;
 use base qw( CatalystX::CRUD::View::Excel );
 
 __PACKAGE__->config(
    TEMPLATE_EXTENSION => 'tt',
    etp_config => {
        INCLUDE_PATH => [ 'my/tt/path', __PACKAGE__->path_to('root') ],
    }
 );
 
 1;
 

DESCRIPTION

CatalystX::CRUD::View::Excel makes it easy to export your search results as an Excel document. If you are using the other CatalystX::CRUD Controller and Model classes, your default end() method might look something like this:

 sub end : ActionClass('RenderView') {
    my ( $self, $c ) = @_;
    if ( $c->req->param('as_xls') ) {
        $c->stash->{current_view} = 'Excel';
    }
 }

and get a .xls document for any search or list by simply adding a as_xls=1 param pair to your url query.

NOTE: If you are paging results, then you will need to turn off paging in order to get all your results in a single .xls file. You can do this with the standard _no_page param as defined in the CatalystX::CRUD::Model API.

METHODS

new

Overrides base new() method to set default INCLUDE and TEMPLATE_EXTENSION config values.

process

Overrides base process() method to call get_filename() and create template from results_template if a template file does not exist.

template_exists( path )

Search the TT include path to see if path really exists.

get_template_filename( context )

Overrides base method to change the default naming convention. If template is not set in stash(), then the default template path is:

 $c->action . '.xls.' . $self->config->{TEMPLATE_EXTENSION}

TEMPLATE_EXTENSION by default is tt. You can alter that with the config() method.

get_filename( context )

Returns the name of the file to return in the response header Content-Disposition.

results_template( context )

Returns results-specific template.

AUTHOR

Peter Karman, <karman at cpan dot org>

BUGS

Please report any bugs or feature requests to bug-catalystx-crud-view-excel at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-CRUD-View-Excel. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc CatalystX::CRUD::View::Excel

You can also look for information at:

ACKNOWLEDGEMENTS

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE

Copyright 2007 by the Regents of the University of Minnesota.

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

SEE ALSO

Catalyst::View::Excel::Template::Plus, CatalystX::CRUD