use Excel::Template::Base;
use vars qw ($VERSION @ISA);
- $VERSION = '0.20';
+ $VERSION = '0.21';
@ISA = qw( Excel::Template::Base );
}
use XML::Parser;
use IO::Scalar;
+use constant RENDER_NML => 'normal';
+use constant RENDER_BIG => 'big';
+use constant RENDER_XML => 'xml';
+
+my %renderers = (
+ RENDER_NML, 'Spreadsheet::WriteExcel',
+ RENDER_BIG, 'Spreadsheet::WriteExcel::Big',
+ RENDER_XML, 'Spreadsheet::WriteExcelXML',
+);
+
sub new
{
my $class = shift;
if defined $self->{FILENAME};
my @renderer_classes = ( 'Spreadsheet::WriteExcel' );
- if (exists $self->{BIG_FILE} && $self->{BIG_FILE})
+
+ if (exists $self->{RENDERER} && $self->{RENDERER})
{
- unshift @renderer_classes, 'Spreadsheet::WriteExcel::Big';
+ if (exists $renderers{ lc $self->{RENDERER} })
+ {
+ unshift @renderer_classes, $renderers{ lc $self->{RENDERER} };
+ }
+ elsif ($^W)
+ {
+ warn "'$self->{RENDERER}' is not recognized\n";
+ }
}
-
- if (exists $self->{XML} && $self->{XML})
+ elsif (exists $self->{BIG_FILE} && $self->{BIG_FILE})
{
- unshift @renderer_classes, 'Spreadsheet::WriteExcelXML';
+ warn "Use of BIG_FILE is deprecated.\n";
+ unshift @renderer_classes, 'Spreadsheet::WriteExcel::Big';
}
$self->{RENDERER} = undef;
my $name = uc shift;
- my $node = Excel::Template::Factory->create_node($name, @_);
+ my $node = Excel::Template::Factory->_create_node($name, @_);
die "'$name' (@_) didn't make a node!\n" unless defined $node;
if ( $node->isa( 'WORKBOOK' ) )
my $self = shift;
my ($xls) = @_;
- my $context = Excel::Template::Factory->create(
+ my $context = Excel::Template::Factory->_create(
'CONTEXT',
XLS => $xls,
parse the template in the given file. (You can also use the parse() method,
described below.)
-new() accepts an optional BIG_FILE parameter. This will attempt to change the
-renderer from L<Spreadsheet::WriteExcel> to L<Spreadsheet::WriteExcel::Big>. You
-must already have L<OLE::Storage_Lite> (required by Spreadsheet::WriteExcel::Big) installed on your system.
+=head3 Parameters
+
+=over 4
+
+=item * RENDERER
+
+The default rendering engine is Spreadsheet::WriteExcel. You may, if you choose, change that to another choice. The legal values are:
+
+=over 4
+
+=item * Excel::Template->RENDER_NML
+
+This is the default of Spreadsheet::WriteExcel.
-new() also accepts an optional USE_UNICODE parameter. This will use
-L<Unicode::String> to represent strings instead of Perl's internal string
-handling. You must already have L<Unicode::String> installed on your system.
+=item * Excel::Template->RENDER_BIG
+
+This attempts to load Spreadsheet::WriteExcel::Big.
+
+=item * Excel::Template->RENDER_XML
+
+This attempts to load Spreadsheet::WriteExcelXML.
+
+=back
+
+=item * USE_UNICODE
+
+This will use L<Unicode::String> to represent strings instead of Perl's internal string handling. You must already have L<Unicode::String> installed on your system.
The USE_UNICODE parameter will be ignored if you are using Perl 5.8 or higher as
Perl's internal string handling is unicode-aware.
reason. Upgrading to the latest version of L<OLE::Storage_Lite> should fix the
problem.
+=back
+
+=head3 Deprecated
+
+=over 4
+
+=item * BIG_FILE
+
+Instead, use RENDERER => Excel::Template->RENDER_BIG
+
+=back
+
=head2 param()
This method is exactly like L<HTML::Template>'s param() method.
file as a stream, usually for output to the web. (This is when the actual
merging of the template and the parameters occurs.)
+=head2 register()
+
+This allows you to register a class as handling a node. q.v. L<Excel::Template::Factory> for more info.
+
=head1 SUPPORTED NODES
This is a partial list of nodes. See the other classes in this distro for more
This is a variable. It is generally used when the 'text' attribute isn't
sufficient.
-=back 4
+=back
=head1 BUGS
=item * Fixing several bugs in worksheet naming
-=back 4
+=back
=head1 COPYRIGHT