0.26 Thu Jun 01 17:00:00 2005
- Fixed how widths are whitelisted to allow '.' for fractions
+ - Fixed how certain formats are copied
+ - Added <image>
+ - Added <freezepanes>
0.25 Thu May 26 11:00:00 2005
- Changed how the template file is opened to use 3-arg open() if available
lib/Excel/Template/Element/Backref.pm
lib/Excel/Template/Element/Cell.pm
lib/Excel/Template/Element/Formula.pm
+lib/Excel/Template/Element/FreezePanes.pm
lib/Excel/Template/Element/Image.pm
lib/Excel/Template/Element/Range.pm
lib/Excel/Template/Element/Var.pm
t/022_keep_leading_zeros.t
t/023_relative_values.t
t/024_image.t
+t/025_freezepanes.t
t/998_pod.t
t/999_pod_coverage.t
t/mock.pm
activate/select/set_first_sheet
set_selection
outline_settings
- freeze_panes
thaw_panes
merge_range
set_zoom
--- /dev/null
+package Excel::Template::Element::FreezePanes;
+
+use strict;
+
+BEGIN {
+ use vars qw(@ISA);
+ @ISA = qw(Excel::Template::Element);
+
+ use Excel::Template::Element;
+}
+
+sub render {
+ my $self = shift;
+ my ($context) = @_;
+
+ my ($row, $col) = map { $context->get( $self, $_ ) } qw( ROW COL );
+ $context->active_worksheet->freeze_panes( $row, $col );
+
+ return 1;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Excel::Template::Element::FreezePanes - Excel::Template::Element::FreezePanes
+
+=head1 PURPOSE
+
+To insert an image into the worksheet
+
+=head1 NODE NAME
+
+FREEZEPANES
+
+=head1 INHERITANCE
+
+L<ELEMENT|Excel::Template::Element>
+
+=head1 EFFECTS
+
+This will not conume any columns or rows. It is a zero-width assertion.
+
+=head1 DEPENDENCIES
+
+None
+
+=head1 USAGE
+
+ <freezepanes />
+
+This will do a Freeze Pane at the current cell.
+
+=head1 AUTHOR
+
+Rob Kinyon (rob.kinyon@gmail.com)
+
+=head1 SEE ALSO
+
+Nothing
+
+=cut
my $self = shift;
my ($context) = @_;
- my $path = $context->get( $self, 'PATH' );
- my ($row, $col, $offset, $scale) = map {
+ my ($row, $col, $path, $offset, $scale) = map {
$context->get($self, $_)
- } qw( ROW COL OFFSET SCALE );
+ } qw( ROW COL PATH OFFSET SCALE );
my @offsets = (0,0);
if ( $offset =~ /^\s*([\d.]+)\s*,\s*([\d.]+)/ ) {
@scales = ($1,$2);
}
- $context->active_worksheet->insert_image(
+ $context->active_worksheet->insert_bitmap(
$row, $col, $path, @offsets, @scales,
);
=head1 NODE NAME
-CELL
+IMAGE
=head1 INHERITANCE
L<ELEMENT|Excel::Template::Element>
+=head1 EFFECTS
+
+This will consume one column in the current row.
+
=head1 DEPENDENCIES
None
Please see L<Spreadsheet::WriteExcel/> for more information about the offset and scaling options as well as any other restrictions that might be in place. This node does B<NOT> perform any sort of validation upon your parameters. You are assumed to know what you are doing.
+Note that the offset and scaling values are "X,Y". You I<must> provide both values, even if the Y value is 0. If you provide a 0 value for either scaling option, L<Spreadsheet::WriteExcel/> will default that to 1.
+
=head1 AUTHOR
Rob Kinyon (rob.kinyon@gmail.com)
'WORKBOOK' => 'Excel::Template::Container::Workbook',
'WORKSHEET' => 'Excel::Template::Container::Worksheet',
- 'BACKREF' => 'Excel::Template::Element::Backref',
- 'CELL' => 'Excel::Template::Element::Cell',
- 'FORMULA' => 'Excel::Template::Element::Formula',
- 'IMAGE' => 'Excel::Template::Element::Image',
- 'RANGE' => 'Excel::Template::Element::Range',
- 'VAR' => 'Excel::Template::Element::Var',
+ 'BACKREF' => 'Excel::Template::Element::Backref',
+ 'CELL' => 'Excel::Template::Element::Cell',
+ 'FORMULA' => 'Excel::Template::Element::Formula',
+ 'FREEZEPANES' => 'Excel::Template::Element::FreezePanes',
+ 'IMAGE' => 'Excel::Template::Element::Image',
+ 'RANGE' => 'Excel::Template::Element::Range',
+ 'VAR' => 'Excel::Template::Element::Var',
'FORMAT' => 'Excel::Template::Container::Format',
WORKBOOK WORKSHEET
FORMAT BOLD HIDDEN ITALIC LOCKED OUTLINE SHADOW STRIKEOUT
IF ROW LOOP SCOPE KEEP_LEADING_ZEROS
- CELL FORMULA IMAGE
+ CELL FORMULA FREEZEPANES IMAGE
VAR BACKREF RANGE
);
Spreadsheet::WriteExcel::add_worksheet( '' )
Spreadsheet::WriteExcel::Worksheet::new( '' )
Spreadsheet::WriteExcel::Worksheet::write( '0', '0', 'before', '1' )
-Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '1', '/full/path', '0', '0', '0', '0' )
+Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '1', '/full/path', '0', '0', '0', '0' )
Spreadsheet::WriteExcel::Worksheet::write( '0', '2', 'after', '1' )
-Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '3', '/full/path', '2', '2', '0', '0' )
-Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '4', '/full/path', '0', '0', '2', '2' )
-Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '5', '/full/path', '0', '1', '1.1', '0' )
+Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '3', '/full/path', '2', '2', '0', '0' )
+Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '4', '/full/path', '0', '0', '2', '2' )
+Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '5', '/full/path', '0', '1', '1.1', '0' )
Spreadsheet::WriteExcel::close( '' )
__END_EXPECTED__
<image path="/full/path" scale="1.1,0" offset="0,1"/>
</worksheet>
</workbook>
-
--- /dev/null
+BEGIN{ $^W = 0 }
+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(
+ file => \*DATA,
+);
+isa_ok( $object, $CLASS );
+
+ok( $object->write_file( 'filename' ), 'Successfuly wrote file' );
+
+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( '' )
+Spreadsheet::WriteExcel::Worksheet::new( '' )
+Spreadsheet::WriteExcel::Worksheet::write( '0', '0', 'before', '1' )
+Spreadsheet::WriteExcel::Worksheet::freeze_panes( '0', '1' )
+Spreadsheet::WriteExcel::Worksheet::write( '0', '1', 'after', '1' )
+Spreadsheet::WriteExcel::close( '' )
+__END_EXPECTED__
+
+__DATA__
+<workbook>
+ <worksheet>
+ <cell text="before" />
+ <freezepanes />
+ <cell text="after" />
+ </worksheet>
+</workbook>
}
}
-sub insert_image {
+sub insert_bitmap {
my $self = shift;
{
local $" = "', '";
- push @mock::calls, __PACKAGE__ . "::insert_image( '@_' )";
+ push @mock::calls, __PACKAGE__ . "::insert_bitmap( '@_' )";
+ }
+}
+
+sub freeze_panes {
+ my $self = shift;
+
+ {
+ local $" = "', '";
+ push @mock::calls, __PACKAGE__ . "::freeze_panes( '@_' )";
}
}