makewebpivot
use SpreadSheet::WriteExcel::WebPivot; my $xml = SpreadSheet::WriteExcel::WebPivot->new(); $xml->makewebpivot(db handle,query,query keys, summary type, file name, title); this method creates an MS Excel Web Pivot which when viewed on a Windows machine with MS Office XP and IE gives you a fully functional embedded spreadsheet object in the browser. This should be able to run and produce output anywhere perl is installed but the output will only be useful to those running Windows and IE. The pivot table gives a high level summary of the numbers that can be rearranged in different ways. The parameters it takes are a database handle, a query string or array ref (see below), the query keys which is a reference to an array of the names of fields in the query listed in the order you want them diplayed in the web pivot, the summary type which is the type of summary to be used in the pivot, the file name to save the generated web pivot under and the last parameter is the title of the pivot table Note the query parameter can also be a reference to an array of query strings. makewebpivot will detect whether query is a string or array of strings. If it is an array of strings it execute each query in order and add their results to the pivot. Note that if you use multiple queries, all queries must return the same results in the same format as the first query. This restriction is inherent in Excel pivot tables. This module can also be used in the absense of a database connection by passing in a reference to an array of hash references. When called this way whatever query you pass in will be ignored and the module will instead present the data in the data structure you passed in. For a trivial sample: use SpreadSheet::WriteExcel::WebPivot; my @array; for(my $i=0; $i < 20; $i++) { push @array, { Name => "a$i", Number => $i }; } my @fields = qw(Name Number); my $xml = SpreadSheet::WriteExcel::WebPivot->new(); $xml->makewebpivot(\@array, '', \@fields, 'Count', 'exceltest', 'Test Pivot'); Nathan Lewis, <nathanlewis42@yahoo.co.uk<gt> Copyright (C) 2005 by Nathan Lewis This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.