NAME
MojoX::Renderer::WriteExcel - emit Excel spreadsheets from Mojo
SYNOPSIS
use MojoX::Renderer::WriteExcel;
sub startup {
my $self = shift;
$self->types->type(xls => 'application/vnd.ms-excel');
my $self->renderer->add_handler(
xls => MojoX::Renderer::WriteExcel->new
);
}
DESCRIPTION
This renderer converts the result
element in the stash to an Excel spreadsheet. If the stash also has a heading
element, the renderer will also write headings in bold type for the columns in the spreadsheet.
heading
is an arrayref, while result
is an array of arrayrefs.
Optionally, a settings
parameter can be provided to set additional attributes in the Excel spreadsheet. Currently 'column_width' is the only working attribute. settings
is a hashref. Column widths could be set by passing the settings to render such as:
settings => {column_width => {'A:A' => 10, 'B:B' => 25, 'C:D' => 40}}
METHODS
new
This method returns a handler for the Mojo renderer.
AUTHOR
Zak B. Elep <zakame@cpan.org>
BUGS
Please report any bugs or feature requests to bug-mojox-renderer-writeexcel at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MojoX-Renderer-WriteExcel. 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 MojoX::Renderer::WriteExcel
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MojoX-Renderer-WriteExcel
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
Thanks to Graham Barr and his MojoX::Renderer::YAML module, and Sebastian Riedel's core Mojolicious::Plugin::EpRenderer for showing how to write renderers for Mojo!
Inspiration for this renderer came from this mailing list thread: http://archives.free.net.ph/thread/20100625.092704.ed777265.en.html
LICENSE AND COPYRIGHT
Copyright 2010 Zak B. Elep.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.