NAME
Mojolicious::Plugin::WriteExcel - Spreadsheet::WriteExcel plugin
SYNOPSIS
# Mojolicious
$self->plugin('write_excel');
# Mojolicious::Lite
plugin 'write_excel';
# Render a spreadsheet
get '/example.xls' => sub {
shift->render(
handler => 'xls',
result => [[qw(foo bar baz)], [qw(lol wut bbq)], [qw(kick ass module)],],
);
};
DESCRIPTION
Mojolicious::Plugin::WriteExcel is a renderer for Excel spreadsheets.
This plugin 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
Mojolicious::Plugin::WriteExcel inherits all methods from Mojolicious::Plugin and implements the following new ones.
xls_renderer
$app->renderer->add_handler(xls => \&xls_renderer);
Internal sub talking to Spreadsheet::WriteExcel::Simple to render spreadsheets.
register
$plugin->register;
Register renderer in Mojolicious application.
SEE ALSO
Mojolicious, Spreadsheet::WriteExcel::Simple, http://mojolicious.org.