I guess you already have the controller to get the data for presentation
in a website, so what this really is is another view of the data.
Consequently, I would write a View class that spits out an Excel file
for the browser to download. In fact, there already is a View module on
CPAN called Catalyst::View::Excel::Template::Plus but I haven't used it,
so can't comment on it. Your Controller action could then simply take an
argument that decides whether to return HTML or an Excel file, i.e. to
set the correct View.
Frank
On 02/07/12 20:08, Kenneth S Mclane wrote:
I already have some rough code for Spreadsheet::WriteExcel. I just
need to figure out how to pass it the data. I created a new controller
just to do the Excel piece, I think I should be able to pass the same
resultset to the export routine as I do to the stash for the template
code. Just not sure of the logistics, but I need to do this for
multiple pages.
I'm thinking I can pass the same $rs I place in the stash to the
export function, have it stuff it into an excel file and return a uri
which I can redirect the browser to.
Maybe.
Len Jaffe <[email protected]> wrote on 07/02/2012 01:54:28 PM:
> From:
>
> Len Jaffe <[email protected]>
>
> To:
>
> The elegant MVC web framework <[email protected]>
>
> Date:
>
> 07/02/2012 01:56 PM
>
> Subject:
>
> Re: [Catalyst] Data export question
>
>
> On Mon, Jul 2, 2012 at 1:45 PM, Kenneth S Mclane
<[email protected]> wrote:
> It will just be a dump of the current query results, possibly a
> whole table, so It will need to create new tabs when they reach 65K
> since most of my users are still on office 2003. I guess I could use
> Spreadsheet::WriteExcel, I just need to figure out the mechanics of
> getting the data into the sheetand something to keep track of the
> number of rows and create new tabs as needed.
>
> # psuedocode
>
> $ss = open_spreadsheet()
> $i = 0;
> $tab = undef;
> foreach $row (@rows) {
> if ($i % 65000 == 0) {
> $tab = $ss.new_tab()
> }
> add_to_spreadsheet($row, $tab)
> $i += 1
> }
> close_spreadsheet()
>
>
> L.
> --
> [email protected] 614-404-4214 www.volunteerable.net
> Proprietor: http://www.theycomewithcheese.com/- An Homage to Fromage
> Greenbar: Grubmaster: 2012-2009, Grub Asst: 2008, Trained: 2007.
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/