Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Checking in changes prior to tagging of version 2.05.

Changelog diff is:

diff --git a/Changes b/Changes
index 41eb91d..4b4a6bf 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,10 @@ MojoX-Renderer-WriteExcel)

 {{$NEXT}}

+2.05 2015-02-28T06:38:01Z
+        Use reply->exception helper, thanks to Bryan Paxton
+        Bump Mojo requirement to 5.73 per above
+
 2.04 2014-12-10T07:48:21Z
         Require Mojo 4.0 or newer, Closes #2
latest commit 690e8febb1
Zak B. Elep authored

README.md

NAME

Mojolicious::Plugin::WriteExcel - write Excel spreadsheets from Mojolicious

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 plugin for writing 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:

get '/colwidth.xls' => sub {
  shift->render(
    handler  => 'xls',
    result   => [['small'], ['medium'], ['large']],
    settings => {column_width => {'A:A' => 10, 'B:B' => 25, 'C:D' => 40}},
  );
};
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.

AUTHOR

Zak B. Elep zakame@cpan.org

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 Mojolicious!

Inspiration for this renderer came from this mailing list thread: http://www.mail-archive.com/plug@lists.linux.org.ph/msg21881.html

LICENSE

Copyright 2013 Zak B. Elep

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

SEE ALSO

Mojolicious, Spreadsheet::WriteExcel::Simple, http://mojolicious.org.

Something went wrong with that request. Please try again.