remove trailing junk from XLSX files, #20337
authorMark Wells <mark@freeside.biz>
Wed, 28 Nov 2012 05:43:37 +0000 (21:43 -0800)
committerMark Wells <mark@freeside.biz>
Wed, 28 Nov 2012 05:43:37 +0000 (21:43 -0800)
httemplate/graph/elements/report.html
httemplate/search/customer_accounting_summary.html
httemplate/search/elements/search-xls.html
httemplate/search/elements/search.html
httemplate/search/report_tax-xls.cgi

index 98b4778..b7073db 100644 (file)
@@ -126,8 +126,8 @@ any delimiter and linked from the elements in @data.
 %   $workbook->close();# or die "Error creating .xls file: $!";
 %
 %   http_header('Content-Length' => length($output) );
-%   
-<% $output %>
+%   $m->print($output);
+%
 % } elsif ( $cgi->param('_type') eq 'png' ) {
 %   # delete any items that shouldn't be on the graph
 %   if ( my $no_graph = $opt{'no_graph'} ) {
index 5ce2e3a..5575283 100644 (file)
   $r++;
   } #$row
   $workbook->close;
+
+  http_header('Content-Length' => length($output));
+  $m->print($output);
 </%perl>
-<% $output %>
-% } else { 
+% } else {
 <& /elements/header.html, $title &>
 % my $myself = $cgi->self_url;
 <P ALIGN="right" CLASS="noprint">
index 94d88b0..26a51c4 100644 (file)
@@ -1,4 +1,3 @@
-<% $data %>
 <%init>
 
 my %args = @_;
@@ -148,5 +147,6 @@ if ( $opt{'footer'} ) {
 $workbook->close();# or die "Error creating .xls file: $!";
 
 http_header('Content-Length' => length($data) );
+$m->print($data);
 
 </%init>
index eca68a2..5a16a22 100644 (file)
@@ -176,7 +176,9 @@ Example:
 %
 % } elsif ( $type =~ /\.xls$/ ) {
 %
-<% include('search-xls.html',  header=>$header, rows=>$rows, opt=>\%opt ) %>
+<& 'search-xls.html',  header=>$header, rows=>$rows, opt=>\%opt &>\
+% # prevent the caller from polluting our output stream
+% $m->abort;
 %
 % } elsif ( $type eq 'xml' ) {
 %
index f19f85a..bb843a7 100755 (executable)
@@ -1,4 +1,3 @@
-<% $data %>
 <%init>
 my $htmldoc = include('report_tax.cgi');
 
@@ -155,4 +154,6 @@ for my $x (0..scalar(@widths)-1) {
 
 $workbook->close;
 
+http_header('Content-Length' => length($data));
+$m->print($data);
 </%init>