Revision history for Perl distribution Excel::Template
-0.17 Sat Nov 05 23:30:00 2004
+0.18 Fri Nov 12 14:45:00 2004
+ - Removed 'use warnings' from all tests
+ - All warnings are suppressed unless $^W is true
+ - Added 'height' value for ROW
+ - Added 'width' value for CELL
+ - Fixed PM_FILTER to work on Redhat
+
+0.17 Sat Nov 06 23:30:00 2004
- Added worksheet protection
- Fixed several bugs found by adding more tests
- SCOPE node actually works
t/012.xml
t/013_range.t
t/013.xml
+t/014_heightwidth.t
+t/014.xml
t/mock.pm
t/Spreadsheet/WriteExcel.pm
t/Spreadsheet/WriteExcel/Worksheet.pm
use strict;
my $prereqs = {
- 'Test::Simple' => 0.44,
'Spreadsheet::WriteExcel' => 0.42,
+ 'Test::More' => 0.01,
'XML::Parser' => 0.01,
'IO::Scalar' => 0.01,
'File::Basename' => 0.01,
}
my $pm_filter = $use_unicode
- ? 'perl -p -e "s!UNI_YES ! !g;s!UNI_NO !\\#!g"'
- : 'perl -p -e "s!UNI_NO ! !g;s!UNI_YES !\\#!g"';
+ ? q{perl -pi -e "s!UNI_YES ! !g;s!UNI_NO !\\#!g"}
+ : q{perl -pi -e "s!UNI_NO ! !g;s!UNI_YES !\\#!g"};
WriteMakefile(
NAME => 'Excel::Template',
use Excel::Template::Base;
use vars qw ($VERSION @ISA);
- $VERSION = '0.17';
+ $VERSION = '0.18';
@ISA = qw( Excel::Template::Base );
}
$class->import;
};
if ($@) {
- warn "Could not find or compile '$class'\n";
+ warn "Could not find or compile '$class'\n" if $^W;
} else {
$self->{RENDERER} = $class;
last;
else
{
warn "Conditional 'is' value was [$is], defaulting to 'FALSE'" . $/
- if $is ne 'FALSE';
+ if $is ne 'FALSE' && $^W;
return 0 if $istrue;
}
$context->{COL} = 0;
+ # Apply the height to the current row
+ if (my $height = $context->get($self, 'HEIGHT'))
+ {
+ $height =~ s/\D//g;
+ $height *= 1;
+ if ($height > 0)
+ {
+ $context->active_worksheet->set_row(
+ $context->get( $self, 'ROW' ),
+ $height,
+ );
+ }
+ }
+
return $self->SUPER::render($context);
}
=head1 ATTRIBUTES
-None
+=over 4
+
+=item * HEIGHT
+
+Sets the height of the row. The last setting for a given row will win out.
+
+=back 4
=head1 CHILDREN
$context->add_reference( $ref, $row, $col );
}
+ # Apply the cell width to the current column
+ if (my $width = $context->get($self, 'WIDTH'))
+ {
+ $width =~ s/\D//g;
+ $width *= 1;
+ if ($width > 0)
+ {
+ $context->active_worksheet->set_column($col, $col, $width);
+ }
+ }
+
$context->active_worksheet->$method(
$row, $col,
$self->get_text($context),
This is useful when the current cell needs to be referenced by a
formula. See BACKREF and RANGE.
+=item * WIDTH
+
+Sets the width of the column the cell is in. The last setting for a given column
+will win out.
+
=back 4
There will be more parameters added, as features are added.
{
unless ($params{$_})
{
- warn "$_ was not supplied to register()\n";
+ warn "$_ was not supplied to register()\n" if $^W;
return 0;
}
}
my $name = uc $params{name};
if (exists $Manifest{$name})
{
- warn "$params{name} already exists in the manifest.\n";
+ warn "$params{name} already exists in the manifest.\n" if $^W;
return 0;
}
my $isa = uc $params{isa};
unless (exists $Manifest{$isa})
{
- warn "$params{isa} does not exist in the manifest.\n";
+ warn "$params{isa} does not exist in the manifest.\n" if $^W;
return 0;
}
}
}
- warn "Property '$prop' is unrecognized\n";
+ warn "Property '$prop' is unrecognized\n" if $^W;
}
my $new_key = _params_to_key(%params);
{
$self->{NO_PARAMS} = 1;
- warn "INTERNAL ERROR: 'NAME' was blank was blank when passed to ", __PACKAGE__, $/;
+ warn "INTERNAL ERROR: 'NAME' was blank was blank when passed to ", __PACKAGE__, $/ if $^W;
return $self;
}
unless (UNIVERSAL::isa($self->{DATA}, 'ARRAY'))
{
$self->{NO_PARAMS} = 1;
- warn "'$self->{NAME}' does not have a list of parameters", $/;
+ warn "'$self->{NAME}' does not have a list of parameters", $/ if $^W;
return $self;
}
use strict;
-use warnings;
-$|++;
use Test::More tests => 2;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 5;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
</row>
</loop>
+ <loop name="no_iters">
+ <cell text="$value" />
+ </loop>
+
+ <loop name="no_params">
+ <cell text="$value" />
+ </loop>
+
+ <loop name="empty" />
+
+ <loop name="" />
+
</worksheet>
<loop name="worksheets">
+BEGIN{ $^W = 0 }
use strict;
-use warnings;
-$|++;
use Test::More tests => 5;
{ value => 2 },
{ value => 3 },
],
+ no_iters => [
+ ],
),
'Parameters set',
);
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 5;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
use strict;
-use warnings;
-$|++;
use Test::More tests => 4;
--- /dev/null
+<workbook>
+ <worksheet name="heightwidth">
+ <row height="30">
+ <cell width="10" text="1" />
+ </row>
+ </worksheet>
+</workbook>
--- /dev/null
+use strict;
+
+use Test::More tests => 4;
+
+use lib 't';
+use mock;
+mock->reset;
+
+my $CLASS = 'Excel::Template';
+use_ok( $CLASS );
+
+my $object = $CLASS->new(
+ filename => 't/014.xml',
+);
+isa_ok( $object, $CLASS );
+
+ok( $object->write_file( 'filename' ), 'Something returned' );
+
+my @calls = mock->get_calls;
+is( join( $/, @calls, '' ), <<__END_EXPECTED__, 'Calls match up' );
+Spreadsheet::WriteExcel::new( 'filename' )
+Spreadsheet::WriteExcel::add_format( '' )
+Spreadsheet::WriteExcel::add_worksheet( 'heightwidth' )
+Spreadsheet::WriteExcel::Worksheet::new( '' )
+Spreadsheet::WriteExcel::Worksheet::set_row( '0', '30' )
+Spreadsheet::WriteExcel::Worksheet::set_column( '0', '0', '10' )
+Spreadsheet::WriteExcel::Worksheet::write( '0', '0', '1', '1' )
+Spreadsheet::WriteExcel::close( '' )
+__END_EXPECTED__
}
}
+sub set_row {
+ my $self = shift;
+
+ {
+ local $" = "', '";
+ push @mock::calls, __PACKAGE__ . "::set_row( '@_' )";
+ }
+}
+
+sub set_column {
+ my $self = shift;
+
+ {
+ local $" = "', '";
+ push @mock::calls, __PACKAGE__ . "::set_column( '@_' )";
+ }
+}
+
1;
__END__