None available.
sub printResults
{ my ($self, $filehandle, $lines, $uniqueResults) = @_;
my $workbook = Spreadsheet::WriteExcel::Big->new($filehandle);
my $worksheet = $workbook->add_worksheet();
$self->attr('workbook', $workbook);
$self->attr('worksheet', $worksheet);
$self->attr('rows', 0);
$self->attr('columns', 0);
my $format = $self->get('workbook')->addformat();
$format->set_align('left');
$format->set_bg_color('white');
$format->set_color('black');
$self->attr('format', $format);
$self->attr('colWidth', undef);
my @displayNames = $self->getTextDisplayNames();
my $formatDisplay = $self->get('workbook')->addformat();
$formatDisplay->set_bold();
$formatDisplay->set_align('centre');
$formatDisplay->set_bg_color('black');
$formatDisplay->set_color('white');
my $width;
foreach(@displayNames) {
$width->{$self->get('columns')} = length($_) * 1.2 ;
$self->get('worksheet')->set_column($self->get('columns'), $self->get('columns'), $width->{$self->get('columns')});
$self->get('worksheet')->write($self->get('rows'), $self->get('columns'), $_, $formatDisplay);
$self->set('columns', $self->get('columns') + 1);
}
$self->set('rows', $self->get('rows') + 1);
$self->get('worksheet')->freeze_panes(1, 0); $self->set('colWidth', $width);
my $new_row;
my $new_row_contents;
my $rtable = $self->get('result_table');
my $counter = 0;
my $row;
my %collisions;
while ($rtable->hasMoreRows)
{
$self->set('columns',0);
$new_row = ();
$row = $rtable->nextRow;
if ($uniqueResults) {
no warnings 'uninitialized';
my $hash = sha256_base64("@{$row}");
next if exists $collisions{$hash};
$collisions{$hash} = undef;
}
$counter++;
if (!$row || ($lines && $counter > $lines))
{
$self->closeWorkBook;
return;
}
map { $_ ||= q{}; } @$row;
my $attribute_positions = $self->get('attribute_positions');
my $attribute_url_positions = $self->get('attribute_url_positions');
my $attribute_url = $self->get('attribute_url');
for (my $i = 0; $i < @{$attribute_positions}; $i++)
{
if ($$attribute_url[$i])
{
my @url_data = map {$$row[$_]} @{$$attribute_url_positions[$i]};
my $url_string = sprintf($$attribute_url[$i],@url_data);
$new_row_contents->{value} = $$row[$$attribute_positions[$i]];
$new_row_contents->{URL} = $url_string;
}
else
{
$new_row_contents->{value} = $$row[$$attribute_positions[$i]];
$new_row_contents->{URL} = undef;
}
push @{$new_row}, $new_row_contents;
$new_row_contents = ();
}
foreach(@{$new_row})
{
if($self->get('colWidth')->{$self->get('columns')} < length($_->{value}) )
{
if ( length($_->{value}) > 200)
{
$self->get('colWidth')->{$self->get('columns')} = 200; $self->get('worksheet')->set_column($self->get('columns'), $self->get('columns'), 200);
}
else
{
$self->get('colWidth')->{$self->get('columns')} = length($_->{value});
$self->get('worksheet')->set_column($self->get('columns'), $self->get('columns'), length($_->{value}));
}
}
if($_->{URL})
{
$self->get('worksheet')->write_url($self->get('rows'), $self->get('columns'), $_->{URL}, $_->{value} ); }
else
{
$self->get('worksheet')->write($self->get('rows'), $self->get('columns'), $_->{value} ); }
$self->set('columns', $self->get('columns') + 1);
}
$self->set('rows', $self->get('rows') + 1);
}
$self->closeWorkBook;
return; } |
sub processQuery
{ my ($self, $query) = @_;
$self->set('original_attributes',[@{$query->getAllAttributes()}])
if ($query->getAllAttributes());
$query = $self->setHTMLAttributes($query);
$self->set('query',$query);
return $query; } |