projects
/
manu
/
RT-Extension-SearchResults-XLS.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e8d47bc
)
Apply back XLS patch
author
Emmanuel Lacour
<elacour@easter-eggs.com>
Wed, 12 Mar 2014 16:43:16 +0000
(17:43 +0100)
committer
Emmanuel Lacour
<elacour@easter-eggs.com>
Wed, 12 Mar 2014 16:43:16 +0000
(17:43 +0100)
html/Search/Results.xls
patch
|
blob
|
history
diff --git
a/html/Search/Results.xls
b/html/Search/Results.xls
index
123392a
..
8074692
100644
(file)
--- a/
html/Search/Results.xls
+++ b/
html/Search/Results.xls
@@
-58,6
+58,14
@@
my $no_html = HTML::Scrubber->new( deny => '*' );
<%INIT>
require HTML::Entities;
<%INIT>
require HTML::Entities;
+use Spreadsheet::WriteExcel;
+my $xls;
+my $fh;
+open ($fh, ">", \$xls) or die "$!";
+my $workbook = Spreadsheet::WriteExcel->new($fh) or die $!;
+my $worksheet = $workbook->add_worksheet();
+
+
$r->content_type('application/vnd.ms-excel');
my $DisplayFormat = $m->comp('/Elements/ScrubHTML', Content => $Format);
$r->content_type('application/vnd.ms-excel');
my $DisplayFormat = $m->comp('/Elements/ScrubHTML', Content => $Format);
@@
-103,8
+111,12
@@
else {
: () } @Format];
}
: () } @Format];
}
+my $ws_col = 0;
for (@columns) {
for (@columns) {
- $m->out(join("\t", map { $_->{header} } @$_)."\n");
+ foreach my $ws_val (map { $_->{header} } @$_) {
+ $worksheet->write_string(0, $ws_col, $ws_val);
+ $ws_col++;
+ }
}
my $Tickets = RT::Tickets->new( $session{'CurrentUser'} );
}
my $Tickets = RT::Tickets->new( $session{'CurrentUser'} );
@@
-122,10
+134,12
@@
else {
$Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order );
}
$Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order );
}
+my $ws_row = 1;
my $ii = 0;
while (my $row = $Tickets->Next) {
my $ii = 0;
while (my $row = $Tickets->Next) {
+ $ws_col = 0;
for my $col (@columns) {
for my $col (@columns) {
-
$m->out(join("\t", map
{
+
for (@$col)
{
my $val = ProcessColumnMapValue($_->{map}, Arguments => [$row, $ii++], Escape => 0);
$val = loc($val) if $_->{should_loc};
# remove tabs from all field values, they screw up the tsv
my $val = ProcessColumnMapValue($_->{map}, Arguments => [$row, $ii++], Escape => 0);
$val = loc($val) if $_->{should_loc};
# remove tabs from all field values, they screw up the tsv
@@
-134,9
+148,16
@@
while (my $row = $Tickets->Next) {
$val = $no_html->scrub($val);
$val = HTML::Entities::decode_entities($val);
Encode::encode_utf8($val);
$val = $no_html->scrub($val);
$val = HTML::Entities::decode_entities($val);
Encode::encode_utf8($val);
- } @$col)."\n");
+ $worksheet->write_string($ws_row, $ws_col, $val);
+ $ws_col++;
+ }
}
}
+ $ws_row++;
}
}
+
+$workbook->close;
+close($fh);
+$m->print($xls);
$m->abort();
</%INIT>
$m->abort();
</%INIT>